Submission #370967

#TimeUsernameProblemLanguageResultExecution timeMemory
370967FatihSolakUnija (COCI17_unija)C++17
0 / 100
21 ms492 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; }

Compilation message (stderr)

unija.cpp: In function 'int main()':
unija.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    8 |  freopen("in.txt","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
unija.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  freopen("out.txt","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...