QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#23746 | #2960. Social Distancing | maze# | WA | 3ms | 3844kb | C++14 | 385b | 2022-03-19 12:29:20 | 2022-04-30 04:05:01 |
Judging History
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'