Submission #370968

#TimeUsernameProblemLanguageResultExecution timeMemory
370968FatihSolakUnija (COCI17_unija)C++17
0 / 100
24 ms512 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/2] = max(arr[a/2],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*2; }

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...