| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 81624 | 李言 | cake | C++ | Time Limit Exceeded | 6 | 2000 MS | 1036 KB | 436 | 2023-08-09 17:11:12 |
#include<bits/stdc++.h> using namespace std; long long n,a[114514],ans,to,tk; int check(int num,int l){ int t=0; for(int i=l;t<num;i=(i+1)%n) t+=a[i]; return num<=tk-num-t; } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; tk+=a[i]; } to=tk/3; for(int i=1;i<=n;i++){ long long k=0,z=i; while(k<=to) k+=a[z],z=(z+1)%n; k-=a[--z]; if(check(k,z)) ans=max(ans,k); } cout<<ans; return 0; }