QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#23746#2960. Social Distancingmaze#WA 3ms3844kbC++14385b2022-03-19 12:29:202022-04-30 04:05:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 04:05:01]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3844kb
  • [2022-03-19 12:29:20]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define N 1010

int a[N];

int main()
{
    int l, n;
    scanf("%d%d", &l, &n);
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; i++)
    {
        ans += ((a[(i + 1) % n] + l - a[i]) % l) / 2 - 1;
    }
    printf("%d\n", ans);

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3804kb

input:

9 2
2 6

output:

2

result:

ok single line: '2'

Test #2:

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

input:

10 3
1 4 7

output:

1

result:

ok single line: '1'

Test #3:

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

input:

6 2
2 5

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 3ms
memory: 3640kb

input:

100 5
7 14 47 78 99

output:

43

result:

ok single line: '43'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3844kb

input:

6 1
3

output:

-1

result:

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