Submission #600594

# Submission time Handle Problem Language Result Execution time Memory
600594 2022-07-21T06:04:30 Z starchan Unija (COCI17_unija) C++17
100 / 100
334 ms 31076 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)1e6+1
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
vector<in> p;
signed main()
{
	fast();
	int n;
	cin >> n;
	p.resize(n+1);
	for(int i = 1; i <= n; i++)
	{
		int x, y;
		cin >> x >> y;
		x/=2;
		y/=2;
		p[i] = {x, y};
	}
	p[0] = {INF, -INF};
	sort(p.rbegin(), p.rend());
	int ans = 0;
	int prevy = 0;
	for(int i = 1; i <= n; i++)
	{
		if(p[i].s > prevy)
		{
			ans+=((p[i].s-prevy)*p[i].f);
			prevy = p[i].s;
		}
	}
	cout << 4*ans;
	return 0;
}	
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 334 ms 30952 KB Output is correct
2 Correct 323 ms 31064 KB Output is correct
3 Correct 304 ms 31072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1108 KB Output is correct
2 Correct 9 ms 1108 KB Output is correct
3 Correct 7 ms 1052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 3148 KB Output is correct
2 Correct 25 ms 3176 KB Output is correct
3 Correct 24 ms 3284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 8972 KB Output is correct
2 Correct 74 ms 8980 KB Output is correct
3 Correct 73 ms 8976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 332 ms 31076 KB Output is correct
2 Correct 275 ms 31076 KB Output is correct
3 Correct 309 ms 31068 KB Output is correct