# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
849496 |
2023-09-14T16:58:44 Z |
erering |
Unija (COCI17_unija) |
C++17 |
|
238 ms |
31064 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 |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
29268 KB |
Output is correct |
2 |
Correct |
225 ms |
31060 KB |
Output is correct |
3 |
Correct |
226 ms |
31040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
860 KB |
Output is correct |
2 |
Correct |
6 ms |
860 KB |
Output is correct |
3 |
Correct |
6 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
1884 KB |
Output is correct |
2 |
Correct |
21 ms |
3164 KB |
Output is correct |
3 |
Correct |
20 ms |
3408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
7444 KB |
Output is correct |
2 |
Correct |
63 ms |
8972 KB |
Output is correct |
3 |
Correct |
63 ms |
9040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
238 ms |
29412 KB |
Output is correct |
2 |
Correct |
227 ms |
31064 KB |
Output is correct |
3 |
Correct |
221 ms |
30920 KB |
Output is correct |