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 = 0;
long long congestion = pre[N-1] - pre[0];
for(int i=1; i<N; i++){
long long mayor = (pre[i-1] > pre[N-1] - pre[i] ? pre[i-1] : pre[N-1] - pre[i]);
//cout << mayor << endl;
if(mayor < congestion){
congestion = mayor;
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... |