QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#709519#5080. Folding StickOOBMABTRAMS#WA 1ms5656kbC++17423b2024-11-04 15:08:072024-11-04 15:08:07

Judging History

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

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

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';
}

詳細信息

Test #1:

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

input:

4
3 2 2 3

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 5644kb

input:

5
1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 5648kb

input:

7
1 3 2 3 4 2 2

output:

6

result:

ok single line: '6'

Test #4:

score: 0
Accepted
time: 1ms
memory: 5584kb

input:

9
5 6 3 4 8 8 2 2 5

output:

9

result:

ok single line: '9'

Test #5:

score: 0
Accepted
time: 1ms
memory: 5540kb

input:

10
5 6 3 4 8 6 2 1 8 5

output:

9

result:

ok single line: '9'

Test #6:

score: 0
Accepted
time: 1ms
memory: 5648kb

input:

10
5 8 1 2 6 8 4 3 6 5

output:

14

result:

ok single line: '14'

Test #7:

score: 0
Accepted
time: 1ms
memory: 5636kb

input:

3
4 2 1

output:

4

result:

ok single line: '4'

Test #8:

score: 0
Accepted
time: 0ms
memory: 5516kb

input:

14
7 2 2 2 2 3 4 1 3 5 4 3 1 6

output:

8

result:

ok single line: '8'

Test #9:

score: -100
Wrong Answer
time: 1ms
memory: 5536kb

input:

35
46 93 64 27 72 55 77 11 17 17 79 83 74 26 32 101 54 112 92 111 77 60 51 19 105 11 68 7 100 49 88 54 106 80 57

output:

377

result:

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