QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#54865#2960. Social DistancingMostafa_Moharram#WA 2ms3744kbC++17625b2022-10-11 00:10:372022-10-11 00:10:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-11 00:10:59]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3744kb
  • [2022-10-11 00:10:37]
  • 提交

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 ((0 < i or not a[s - 1]) and (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: 3584kb

input:

9 2
2 6

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3664kb

input:

10 3
1 4 7

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3740kb

input:

6 2
2 5

output:

0

result:

ok single line: '0'

Test #4:

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

input:

100 5
7 14 47 78 99

output:

43

result:

ok single line: '43'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3588kb

input:

6 1
3

output:

2

result:

ok single line: '2'

Test #6:

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

input:

3 1
1

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3572kb

input:

4 2
1 3

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3592kb

input:

4 2
2 4

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

5 2
1 3

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3528kb

input:

5 2
2 4

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3572kb

input:

5 2
3 5

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 2ms
memory: 3528kb

input:

5 2
1 4

output:

0

result:

ok single line: '0'

Test #13:

score: 0
Accepted
time: 2ms
memory: 3744kb

input:

5 2
2 5

output:

0

result:

ok single line: '0'

Test #14:

score: 0
Accepted
time: 2ms
memory: 3516kb

input:

7 1
1

output:

2

result:

ok single line: '2'

Test #15:

score: 0
Accepted
time: 2ms
memory: 3664kb

input:

1000 1
1

output:

499

result:

ok single line: '499'

Test #16:

score: -100
Wrong Answer
time: 2ms
memory: 3516kb

input:

1000 1
2

output:

498

result:

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