Submission #1058179

#TimeUsernameProblemLanguageResultExecution timeMemory
1058179vjudge1Unija (COCI17_unija)C++17
100 / 100
799 ms50812 KiB
// Author: RainPPR // Datetime: 2024-08-14 08:02 #include <bits/stdc++.h> #ifdef __linux__ #include <bits/extc++.h> #define gc() getchar_unlocked() #else #include <ext/rope> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/list_update_policy.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/trie_policy.hpp> #define gc() getchar() #endif #define endl "\n" using namespace std; template<typename T> T read() { T n = 0; int f = 0, c = gc(); for (; !isdigit(c); c = gc()) f |= c == '-'; for (; isdigit(c); c = gc()) n = n * 10 + c - '0'; return f ? -n : n; } template<typename T, typename CMP = less<T>> using pqueue = __gnu_pbds::priority_queue<T, CMP>; // using pqueue = priority_queue<T, vector<T>, CMP>; // ----------------------------------------------------------------------------- void Main() { int n; cin >> n; map<int, int, greater<int>> app; for (int i = 1; i <= n; ++i) { int x, y; cin >> x >> y; x >>= 1, y >>= 1; app[x] = max(app[x], y); } int lt = 0; long long ans = 0; for (auto t : app) { int x = t.first; int y = t.second; ans += 1ll * max(y - lt, 0) * x; lt = max(lt, y); } cout << (ans << 2) << endl; } signed main() { // freopen("unija.in", "r", stdin); // freopen("unija.out", "w", stdout); ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); Main(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...