QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#23749 | #2960. Social Distancing | George_Plover# | WA | 3ms | 3668kb | C++20 | 573b | 2022-03-19 12:36:34 | 2022-04-30 04:05:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n, k, a, b, c;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
for (a = -1; k--; a = b)
{
cin >> b;
c += max(0, ((b - a) >> 1) - 1);
// cerr << "CUR A " << a << " B " << b << " ADD " << max(0, ((b - a) >> 1) - 1) << '\n';
}
// cerr << "CUR A " << a << " B " << (n + 1) << " ADD " << max(0, ((n + 1 - a) >> 1) - 1) << '\n';
c += max(0, ((n + 1 - a) >> 1) - 1);
cout << c << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
input:
9 2 2 6
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 3ms
memory: 3580kb
input:
10 3 1 4 7
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3608kb
input:
6 2 2 5
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 3ms
memory: 3464kb
input:
100 5 7 14 47 78 99
output:
43
result:
ok single line: '43'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
6 1 3
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 3ms
memory: 3604kb
input:
3 1 1
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
4 2 1 3
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
4 2 2 4
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 3ms
memory: 3580kb
input:
5 2 1 3
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
5 2 2 4
output:
0
result:
ok single line: '0'
Test #11:
score: -100
Wrong Answer
time: 1ms
memory: 3460kb
input:
5 2 3 5
output:
1
result:
wrong answer 1st lines differ - expected: '0', found: '1'