Submission #237305

#TimeUsernameProblemLanguageResultExecution timeMemory
237305marlicuUnija (COCI17_unija)C++14
100 / 100
333 ms22136 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define X first #define Y second const int MAXX = 5e6 + 5; int n, x, y; int visina[MAXX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y; x/= 2; visina[x] = max(visina[x], y); } long long povrsina = 0; int maks = 0; for (int i = MAXX - 5; i > 0; i--) { //cout << i << " " << povrsina << " " << maks << '\n'; maks = max(maks, visina[i]); povrsina += 2 * maks; } cout << povrsina; 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...