#include <bits/stdc++.h>
using namespace std;
int LocateCentre(int n, int p[], int s[], int d[]) {
vector<long long> sp(n + 1, 0);
for (int i = 0; i < n; i++) {
sp[i + 1] = sp[i] + p[i];
}
long long t = sp[n];
int b = 0;
long long m = LLONG_MAX;
for (int k = 0; k < n; k++) {
long long l=sp[k];
long long r=t - sp[k + 1];
long long c=max(l, r);
if (c<m) {
m=c;
b=k;
}
}
return b;
}
# | 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... |