QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#584414 | #9182. Infinite Race | chengning0909 | 0 | 0ms | 3712kb | C++20 | 438b | 2024-09-23 14:01:45 | 2024-09-23 14:01:45 |
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, q, cnt[N], ans;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> q;
while (q--) {
int x; cin >> x;
if (x < 0) {
if (cnt[-x]) cnt[-x]--;
} else cnt[x]++;
}
for (int i = 1; i < n; i++) cout << cnt[i] << ' ', ans = max(ans, cnt[i] - 1);
cout << ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
2 1 1
output:
1 0
result:
wrong answer 1st lines differ - expected: '0', found: '1 0'
Subtask #2:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 0ms
memory: 3556kb
input:
2 2 1 1
output:
2 1
result:
wrong answer 1st lines differ - expected: '1', found: '2 1'
Subtask #3:
score: 0
Wrong Answer
Test #45:
score: 0
Wrong Answer
time: 0ms
memory: 3580kb
input:
2 1 1
output:
1 0
result:
wrong answer 1st lines differ - expected: '0', found: '1 0'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%