# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
332381 | lumen | Traffic (IOI10_traffic) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include<iomanip>
#include<cmath>
using namespace std;
typedef long long int lli;
#define PB push_back
#define MP make_pair
#define FR first
#define SR second
#define LB lower_bound
#define UB upper_bound
typedef vector<long long int> vi;
typedef pair<long long int,long long int> pi;
#define all(a) (a).begin(),(a).end()
#define allr(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=a;i<b;i++)
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli N;
cin>>N;
vi P(N+1);
vi S(N+1),D(N+1);
FOR(i,1,N+1)
{
cin>>P[i];
}
FOR(i,1,N)
{
cin>>S[i];
}
FOR(i,1,N)
{
cin>>D[i];
}
vi pre(N+1,0);
FOR(i,1,N+1)
{
pre[i]=pre[i-1]+P[i];
}
lli ans=INT_MAX;
lli index;
FOR(j,1,N+1)
{
lli point1=max(pre[j-1],pre[N]-pre[j]);
if(ans>point1)
{
ans=point1;
index=j-1;
}
}
cout<<index;
}