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 acumulado[1000002];
int LocateCentre(int N, int pp[], int S[], int D[]) {
for (int i = 0; i < N; i++){
if (i == 0){
acumulado[i] = pp[i];
}else{
acumulado[i] = pp[i] + acumulado[i - 1];
}
}
int res = 0;
int maxi = INT_MAX;
int aux = 0;
int der = 0;
int izq = 0;
for (int i = 0; i < N; i++){
der = acumulado[N - 1] - acumulado[i];
if (i == 0){
maxi = der;
res = i;
}else{
izq = acumulado[i - 1];
aux = min(izq, der);
if (aux < maxi){
maxi = aux;
res = i;
}
}
}
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... |