QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#244385#4935. Exchange Bottleneckrgnerdplayer#WA 0ms3820kbC++20733b2023-11-09 00:53:222023-11-09 00:53:22

Judging History

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

  • [2023-11-09 00:53:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2023-11-09 00:53:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    auto solve = [&]() {
        int n;
        cin >> n;

        vector<int> a(n - 1);
        int z = 0;

        for (int i = 0; i < n - 1; i++) {
            cin >> a[i];
            if (a[i] == 1) {
                z = 0;
            } else {
                z++;
            }
        }

        if (z == 0) {
            if (a == vector(n - 1, 1)) {
                cout << "1\n";
            } else {
                cout << "2\n";
            }
        } else {
            cout << z + 1 << '\n';
        }
    };
    
    solve();
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

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

input:

7
1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

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

input:

2
0

output:

2

result:

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