# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
707982 |
2023-03-10T16:32:18 Z |
TAhmed33 |
Unija (COCI17_unija) |
C++ |
|
299 ms |
31020 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector <pair <int, int>> arr2;
signed main () {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
while (n--) {
int x, y;
cin >> x >> y;
x /= 2;
arr2.push_back({x, y});
}
sort(arr2.begin(), arr2.end());
int ans = 0;
int prev = 0;
for (int i = (int)arr2.size() - 2; i >= 0; i--) {
arr2[i].second = max(arr2[i].second, arr2[i + 1].second);
}
for (auto i : arr2) {
ans += (i.first - prev) * i.second;
prev = i.first;
}
ans *= 2;
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
271 ms |
16764 KB |
Output is correct |
2 |
Correct |
299 ms |
30996 KB |
Output is correct |
3 |
Correct |
274 ms |
30972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
984 KB |
Output is correct |
2 |
Correct |
7 ms |
964 KB |
Output is correct |
3 |
Correct |
8 ms |
884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
2552 KB |
Output is correct |
2 |
Correct |
25 ms |
2512 KB |
Output is correct |
3 |
Correct |
28 ms |
2512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
8644 KB |
Output is correct |
2 |
Correct |
75 ms |
8572 KB |
Output is correct |
3 |
Correct |
75 ms |
8604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
295 ms |
16812 KB |
Output is correct |
2 |
Correct |
282 ms |
31020 KB |
Output is correct |
3 |
Correct |
278 ms |
30964 KB |
Output is correct |