QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#54862 | #2960. Social Distancing | Mostafa_Moharram# | WA | 2ms | 3636kb | C++17 | 630b | 2022-10-11 00:07:05 | 2022-10-11 00:07:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int N = 1003;
bool a[N];
int main() {
ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr);
int s, n;
cin >> s >> n;
for (int i = 0; i < n; ++i) {
int x; cin >> x; --x;
a[x] = true;
}
int cnt = 0;
for (int i = 0; i < s; ++i) {
if (a[i]) {
++i; continue;
}
if ((i + 1 == s and not a[s - 1]) or (i + 1 < s and not a[i + 1])) {
++i; ++cnt;
}
}
cout << cnt << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3636kb
input:
9 2 2 6
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3604kb
input:
10 3 1 4 7
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3576kb
input:
6 2 2 5
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3580kb
input:
100 5 7 14 47 78 99
output:
43
result:
ok single line: '43'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
6 1 3
output:
2
result:
ok single line: '2'
Test #6:
score: -100
Wrong Answer
time: 2ms
memory: 3600kb
input:
3 1 1
output:
1
result:
wrong answer 1st lines differ - expected: '0', found: '1'