QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387403#6748. Spin the Wheelk1nsomWA 0ms3588kbC++17513b2024-04-12 14:41:252024-04-12 14:41:26

Judging History

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

  • [2024-04-12 14:41:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-04-12 14:41:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define int long long
#define endl '\n'
int ans = 0, n, gc, a[N];
signed main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    gc = (a[2] - a[1] + n - 1) % n + 1; // 公差
    for (int i = 2; i <= n; i++)
        if ((a[i % n + 1] - a[i] + n - 1) % n + 1 != gc)
        {
            cout << -1;
            // cout << i;
            return 0;
        }
    cout << ((a[1] == 0) + gc);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3588kb

input:

5
1 3 0 2 4

output:

2

result:

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