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[]) {
int res = 0;
long long int menor = 2000000000000001;
long long int a[1000002];
for(int i = 1; i <= N; ++i){
a[i] = pp[i - 1] + a[i - 1];
}
for(int i = 2; i < N; ++i){
long long int aux = a[N] - a[i];
long long int aux2 = a[i - 1];
aux = max(aux, aux2);
if(aux < menor){
menor = aux;
res = i;
}
}
long long int aux = 0;
aux = a[N] - a[1];
if(aux < menor){
menor = aux;
res = 1;
}
aux = a[N - 1];
if(aux < menor){
menor = aux;
res = N - 1;
}
res--;
return res;
}
# | 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... |