Submission #100734

#TimeUsernameProblemLanguageResultExecution timeMemory
100734dalgerokUnija (COCI17_unija)C++17
100 / 100
407 ms28584 KiB
#include<bits/stdc++.h> using namespace std; const int N = 1e7 + 5; int n, x, y, a[N]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n; for(int i = 1; i <= n; i++){ cin >> x >> y; a[x] = max(a[x], y); } long long ans = 0; int mx = 0; for(int i = 1e7; i >= 1; i--){ mx = max(mx, a[i]); ans += mx; } cout << ans; }
#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...