QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#244385 | #4935. Exchange Bottleneck | rgnerdplayer# | WA | 0ms | 3820kb | C++20 | 733b | 2023-11-09 00:53:22 | 2023-11-09 00:53:22 |
Judging History
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'