QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#312863#4935. Exchange BottleneckAnthonyQwO#WA 1ms3748kbC++23484b2024-01-24 14:21:312024-01-24 14:21:32

Judging History

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

  • [2024-01-24 14:21:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3748kb
  • [2024-01-24 14:21:31]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, ret = 1, cur = 0;
    cin >> n;
    vector<int> arr(n);
    for( int i=1 ; i < n ; i++ ) cin >> arr[i];
    for( int i=1 ; i < n ; i++ ) {
        if( arr[i] == 1 ) {
            if( cur ) ret = max(ret, (int)2);
            cur = 0;
        }
        else cur++;
    }
    cout << max(cur+1, ret) << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

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

input:

7
1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

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

input:

2
0

output:

2

result:

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