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"
#include "bits/stdc++.h"
using namespace std;
int LocateCentre(int N, int pp[], int S[], int D[]) {
long long n = N;
vector<long long> a(n), b(n);
for(long long i = 0; i < n; i++){
a[i] = (long long)pp[i];
if(i > 0) a[i] += a[i - 1];
}
for(long long i = n - 1; i > -1; i--){
b[i] = (long long)pp[i];
if(i < (n - 1)) b[i] += b[i + 1];
}
long long r = 2222222222222222;
for(long long i = 0; i < n; i++){
long long p = 0;
if(i > 0) p += a[i - 1];
if(i < (n - 1)) p += b[i + 1];
r = min(r, p);
}
return (int)r;
}
# | 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... |