#include <bits/stdc++.h>
using namespace std;
#define int long long
bool sorting(pair<int, int> a, pair<int, int> b) {
if (a.first == b.first) {
return a.second > b.second;
}
return a.first < b.first;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
pair<int,int> pravoagolnik[n];
for (int i=0;i<n;i++) {
cin >> pravoagolnik[i].first >> pravoagolnik[i].second;
pravoagolnik[i].first/=2;
pravoagolnik[i].second/=2;
}
sort(pravoagolnik, pravoagolnik+n, sorting);
// for (int i = 0; i < n; i++) {
// cout << pravoagolnik[i].first << " " << pravoagolnik[i].second << endl;
// }
int rez=pravoagolnik[0].first*pravoagolnik[0].second;
for (int i=1;i<n;i++) {
rez+=(pravoagolnik[i].first-pravoagolnik[i-1].first)*pravoagolnik[i].second;
}
cout << 4*rez << endl;
}
# |
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 |
1 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 |
352 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 |
216 ms |
31064 KB |
Output is correct |
2 |
Correct |
217 ms |
31040 KB |
Output is correct |
3 |
Correct |
211 ms |
31060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
1164 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
3280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
9040 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
225 ms |
31060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |