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)
vector<int> ad[MAXI];
vector<bool> vis(MAXI,0);
void dfs(int x){
if(vis[x]) return;
vis[x] = 1;
for(auto s:ad[x]){
dfs(s);
}
}
int LocateCentre(int n,int p[],int s[],int d[]){
ll left = 0;
ll right = 0;
ll maxi = 1e18;
for(int i = 0;i<n;i++){
right += p[i];
}
int node = 0;
for(int i = 1;i<n;i++){
left += p[i-1];
right -= p[i];
if(maxi > max(right,left)){
maxi = max(right,left);
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... |