Submission #400673

#TimeUsernameProblemLanguageResultExecution timeMemory
400673ioiTraffic (IOI10_traffic)C++14
0 / 100
1 ms204 KiB
#include "traffic.h" #include<bits/stdc++.h> using namespace std ; int LocateCentre(int N, int pp[], int S[], int D[]) { long long sum = 0 ; for(int i = 0 ;i < N ; i ++) sum += pp[i]; long long mn = 1e18 , ans ; long long sum2 = 0 ; for(int i = 0 ; i < N ; i ++){ sum2 += pp[i]; sum -= pp[i] ; if(max(sum , sum2) < mn) mn = max(sum , sum2) , ans = i ; } return ans ; return N/2; }

Compilation message (stderr)

traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:25:16: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |         return 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...