Submission #463453

#TimeUsernameProblemLanguageResultExecution timeMemory
463453osmanallazovTraffic (IOI10_traffic)C++14
50 / 100
341 ms53316 KiB
#include "traffic.h" #include<bits/stdc++.h> using namespace std; int LocateCentre(int n, int p[], int s[], int d[]){ long long sum=0,sum1=0,s1[n],s2[n],res[n],mini=1e9; for(int i=0;i<n;i++){ sum=sum+p[i]; s1[i]=sum-p[i]; } for(int i=0;i<n;i++){ s2[i]=sum-s1[i]-p[i]; } for(int i=0;i<n;i++){ res[i]=max(s1[i],s2[i]); } for(int i=0;i<n;i++){ mini=min(res[i],mini); } for(int i=0;i<n;i++){ if(mini==res[i]){ return i; } } }

Compilation message (stderr)

traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:5:21: warning: unused variable 'sum1' [-Wunused-variable]
    5 |     long long sum=0,sum1=0,s1[n],s2[n],res[n],mini=1e9;
      |                     ^~~~
traffic.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...