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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define MAXI (int)1e5
#define pb(x) push_back(x)
int LocateCentre(int n,int p[],int s[],int d[]){
ll left[n+1];
ll right[n+1];
left[0] = 0;
right[0] = 0;
ll miniRechts = 1e18;
ll miniLinks = 1e18;
for(int i = 0;i<n;i++){
left[i+1] = left[i] + p[i];
right[i+1] = right[i] + p[n-i-1];
}
int node = 0;
for(int i = 1;i<n;i++){
if(miniRechts > right[i] && miniLinks > left[i]){
miniRechts = right[i];
miniLinks = left[i];
node = i;
}
}
return node;
}
# | 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... |