Submission #96684

#TimeUsernameProblemLanguageResultExecution timeMemory
96684Rouge_HugoUnija (COCI17_unija)C++14
0 / 100
12 ms1296 KiB
#include <bits/stdc++.h> using namespace std; long long a[100009]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long x,y; int n;cin>>n; for(int i=0;i<n;i++) { cin>>x>>y; x/=2; y/=2; a[y]=max(a[y],x); } long long sum=0; for(int i=1;i<1000000;i++) { if (a[i]>a[i-1]) { sum+=(a[i]-a[i-1])*(i-1)+a[i]; } else sum+=a[i]; } cout<<sum*4; return 0; }

Compilation message (stderr)

unija.cpp: In function 'int main()':
unija.cpp:22:10: warning: iteration 100008 invokes undefined behavior [-Waggressive-loop-optimizations]
   if (a[i]>a[i-1])
       ~~~^
unija.cpp:20:15: note: within this loop
  for(int i=1;i<1000000;i++)
              ~^~~~~~~~
#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...