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 <bits/stdc++.h>
#include "traffic.h"
using namespace std;
int LocateCentre(int N, int P[], int S[], int D[]){
vector<int> suf(N), pref(N), sum(N);
for(int i = 1; i < N; i ++){
pref[i] = P[i-1] + pref[i-1];
}
for(int i = N-2; i >= 0; i --){
suf[i] = suf[i + 1] + P[i+1];
}
int ans = 2e9, x = -1;
for(int i = 0; i < N; i ++){
if(max(suf[i], pref[i]) < ans){
ans = max(suf[i], pref[i]);
x = i;
}
}
return x;
}
# | 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... |