QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#54862#2960. Social DistancingMostafa_Moharram#WA 2ms3636kbC++17630b2022-10-11 00:07:052022-10-11 00:07:07

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:07:07]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3636kb
  • [2022-10-11 00:07:05]
  • 提交

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'