AtCoder Regular Contest 073

Submission #1302293

Source codeソースコード

#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <string>
#include <iostream>
#include <climits>
using namespace std;

#define int long long
const int INF = LLONG_MAX*0.8;
typedef pair<int, int> PII;

int N;
vector<PII> v;

signed main()
{
	int mi = INF, ma = -INF;
	int rMax = -INF, bMin = INF;
	cin >> N;
	v.resize(N);
	for (int i = 0; i < N; i++)
	{
		cin >> v[i].first >> v[i].second;
		if (v[i].first > v[i].second) swap(v[i].first, v[i].second);
		mi = min(mi, v[i].first);
		ma = max(ma, v[i].second);
		rMax = max(rMax, v[i].first);
		bMin = min(bMin, v[i].second);
	}
	int ans = (rMax - mi)*(ma - bMin);

	int rMin = INF;
	sort(v.begin(), v.end());
	for (int i = 0; i < N - 1; i++)
	{
		rMax = max(rMax, v[i].second);
		rMin = min(rMin, v[i].second);
		ans = min(ans, (rMax - min(rMin, v[i + 1].first))*(ma - mi));
	}
	printf("%lld\n", ans);
	return 0;
}

Submission

Task問題 E - Ball Coloring
User nameユーザ名 学習性無力感
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 700
Source lengthソースコード長 988 Byte
File nameファイル名
Exec time実行時間 176 ms
Memory usageメモリ使用量 3328 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - example0,example1,example2
All 700 / 700 div20,div21,div22,div23,div24,example0,example1,example2,maxrand0,maxrand1,maxrand2,maxrand20,maxrand21,maxrand210,maxrand211,maxrand22,maxrand23,maxrand24,maxrand25,maxrand26,maxrand27,maxrand28,maxrand29,maxrand3,maxrand4,smallrand0,smallrand1,smallrand2,smallrand3,smallrand4,sparse0,sparse1,sparse2,sparse3,sparse4

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
div20 AC 173 ms 3328 KB
div21 AC 173 ms 3328 KB
div22 AC 174 ms 3328 KB
div23 AC 174 ms 3328 KB
div24 AC 174 ms 3328 KB
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
maxrand0 AC 172 ms 3328 KB
maxrand1 AC 173 ms 3328 KB
maxrand2 AC 172 ms 3328 KB
maxrand20 AC 171 ms 3328 KB
maxrand21 AC 174 ms 3328 KB
maxrand210 AC 174 ms 3328 KB
maxrand211 AC 175 ms 3328 KB
maxrand22 AC 176 ms 3328 KB
maxrand23 AC 176 ms 3328 KB
maxrand24 AC 174 ms 3328 KB
maxrand25 AC 175 ms 3328 KB
maxrand26 AC 176 ms 3328 KB
maxrand27 AC 175 ms 3328 KB
maxrand28 AC 175 ms 3328 KB
maxrand29 AC 174 ms 3328 KB
maxrand3 AC 172 ms 3328 KB
maxrand4 AC 172 ms 3328 KB
smallrand0 AC 1 ms 256 KB
smallrand1 AC 1 ms 256 KB
smallrand2 AC 1 ms 256 KB
smallrand3 AC 1 ms 256 KB
smallrand4 AC 1 ms 256 KB
sparse0 AC 171 ms 3328 KB
sparse1 AC 172 ms 3328 KB
sparse2 AC 172 ms 3328 KB
sparse3 AC 172 ms 3328 KB
sparse4 AC 173 ms 3328 KB