Submission #370969

#TimeUsernameProblemLanguageResultExecution timeMemory
370969FatihSolakUnija (COCI17_unija)C++17
100 / 100
342 ms28524 KiB
#include <bits/stdc++.h> #define N 10000005 using namespace std; int arr[N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int n; cin >> n; for(int i=0;i<n;i++){ int a,b; cin >> a >> b; arr[a] = max(arr[a],b); } long long ans = 0; int maxi = 0; for(int i=N-1;i>0;i--){ maxi = max(maxi,arr[i]); ans+=maxi; } 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...