QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#709506#5080. Folding StickOOBMABTRAMS#WA 1ms5692kbC++17464b2024-11-04 15:06:192024-11-04 15:06:24

Judging History

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

  • [2024-11-04 15:06:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5692kb
  • [2024-11-04 15:06:19]
  • 提交

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<<i<<' '<<s<<' '<<len<<'\n';
    }
    cout<<len<<'\n';
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5692kb

input:

4
3 2 2 3

output:

2 2 3
3 0 4
4 3 4
4

result:

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