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 P[], int S[], int D[])
{
int sumR = 0, sumL = 0;
for (int i = 1; i < N; i++)
{
sumR += P[i];
}
int minW = sumR, maxL = -1, idxOpt = 0;
for (int i = 1; i < N; i++)
{
sumL += P[i -1];
sumR -= P[i];
maxL = max(sumL, sumR);
if (maxL < minW)
{
idxOpt = i;
minW = maxL;
}
}
return idxOpt;
}
# | 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... |