QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413322 | #6748. Spin the Wheel | gaotianyu# | WA | 0ms | 3648kb | C++14 | 861b | 2024-05-17 12:16:50 | 2024-05-17 12:16:51 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
typedef pair<int, int> PII;
const int N = 2e5 + 10;
int a[N];
void solve()
{
int n;
cin >> n;
int chazhi = 0;
bool ok = true;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
if (i > 1)
{
if (a[i] >= a[i - 1])
{
if (!chazhi) chazhi = a[i] - a[i - 1];
else
{
if (chazhi != a[i] - a[i - 1]) ok = false;
}
}
else
{
if (!chazhi) chazhi = a[i] + n - a[i - 1];
else
{
if (chazhi != a[i] + n - a[i - 1]) ok = false;
}
}
}
}
if (!ok)
{
cout << -1 << endl;
return ;
}
cout << a[2] - a[1];
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt = 1;
// cin>>tt;
while (tt--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3648kb
input:
5 1 3 0 2 4
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'