QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#709511#5080. Folding StickOOBMABTRAMS#WA 1ms5608kbC++17422b2024-11-04 15:06:582024-11-04 15:07:02

Judging History

你现在查看的是最新测评结果

  • [2024-11-04 15:07:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5608kb
  • [2024-11-04 15:06:58]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=500013;
int a[N],b[N];
int n;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int len=a[1],pre=1,s=0;
    for(int i=2;i<=n;i++){
        s+=a[i];
        if(s>len){
            while(s-a[pre+1]>=len+a[pre+1])s-=a[pre+1],len+=a[pre+1],pre++;
            len=s,s=0,pre=i;
        }
    }
    cout<<len<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5608kb

input:

4
3 2 2 3

output:

4

result:

ok single line: '4'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 5596kb

input:

5
1 1 1 1 1

output:

2

result:

wrong answer 1st lines differ - expected: '1', found: '2'