QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#709506 | #5080. Folding Stick | OOBMABTRAMS# | WA | 1ms | 5692kb | C++17 | 464b | 2024-11-04 15:06:19 | 2024-11-04 15:06:24 |
Judging History
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';
}
Details
Tip: Click on the bar to expand more detailed information
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'