This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "traffic.h"
int LocateCentre(int N, int pp[], int S[], int D[]) {
long long pre[N];
pre[0] = pp[0];
for(int i=1; i<N; i++){
pre[i] = pre[i-1] + pp[i];
}
int sol = -1;
long long congestion = 1e18;
for(int i=0; i<N; i++){
long long mayor = (pre[i] - pp[i] > pre[N-1] - pre[i] ? pre[i] - pp[i] : pre[N-1] - pre[i]);
if(mayor < congestion){
mayor = congestion;
sol = i;
}
}
return sol;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |