# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
849497 |
2023-09-14T17:01:06 Z |
vjudge1 |
Unija (COCI17_unija) |
C++17 |
|
224 ms |
16088 KB |
#include<bits/stdc++.h>
#define endl '\n'
#define pb push_back
using ll = long long;
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie();
ll n;
cin >> n;
pair<ll, ll> arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i].first >> arr[i].second;
arr[i].first /= 2;
arr[i].second /= 2;
}
sort(arr, arr + n);
ll maxy = arr[n-1].second, sum = 0;
for (int i = n-2; i >=0; i--) {
if (arr[i].first != arr[i + 1].first) {
sum += maxy*(arr[i+1].first-arr[i].first);
}
maxy = max(maxy, arr[i].second);
}
sum+=arr[0].first*maxy;
cout << sum * 4;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
219 ms |
15960 KB |
Output is correct |
2 |
Correct |
222 ms |
15960 KB |
Output is correct |
3 |
Correct |
219 ms |
16088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
856 KB |
Output is correct |
2 |
Correct |
6 ms |
856 KB |
Output is correct |
3 |
Correct |
6 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1880 KB |
Output is correct |
2 |
Correct |
20 ms |
1880 KB |
Output is correct |
3 |
Correct |
20 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
4952 KB |
Output is correct |
2 |
Correct |
59 ms |
4952 KB |
Output is correct |
3 |
Correct |
61 ms |
4952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
224 ms |
16084 KB |
Output is correct |
2 |
Correct |
216 ms |
16080 KB |
Output is correct |
3 |
Correct |
218 ms |
16080 KB |
Output is correct |