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;
#define ll long long
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
const int mxn=1e6+5;
int a[mxn],b[mxn];
int LocateCentre(int n, int arr[], int S[], int D[]) {
a[0]=arr[0];
for(int i=1;i<n;i++){
a[i]=a[i-1]+arr[i];
}
b[n-1]=arr[n-1];
for(int i=n-2;i>=0;i--){
b[i]=b[i+1]+arr[i];
}
int ans=2000000000;
for(int i=0;i<n;i++){
int x=0;
if(i-1>=0){
x=a[i-1];
//cout<<a[i-1]<<' ';
}
if(i+1<n){
x=max(x,b[i+1]);
//cout<<b[i+1]<<' ';
}
//cout<<endl;
//cout<<x<<' ';
ans=min(ans,x);
}
return ans;
}
# | 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... |