QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413330 | #6748. Spin the Wheel | gaotianyu# | Compile Error | / | / | C++14 | 1.3kb | 2024-05-17 13:08:29 | 2024-05-17 13:08:29 |
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 (a[1] >= a[n])
{
if (a[1] - a[n] != chazhi) ok = false;
}
else
{
if (a[1] + n - a[n] != chazhi) ok = false;
}
}
if (!ok)
{
cout << -1 << endl;
return ;
}
if (chazhi == 0 && a[1] != 0)
{
cout << n + 1 << endl;
return ;
}
for (int i = 1; i <= n; i++ )
{
if (a[i] == 0)
{
if (i == 1) cout << a[2] << endl;
else
{
if (i == n) cout << a[1] + 1 << endl;
else cout << a[i + 1] + 1 << endl;
}
return ;
}
}
cout << chazhi + 2 << endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt = 1;
while (tt--) solve();
return 0;
}
Details
answer.code:49:9: error: expected unqualified-id before ‘if’ 49 | if (!ok) | ^~ answer.code:54:9: error: expected unqualified-id before ‘if’ 54 | if (chazhi == 0 && a[1] != 0) | ^~ answer.code:59:9: error: expected unqualified-id before ‘for’ 59 | for (int i = 1; i <= n; i++ ) | ^~~ answer.code:59:25: error: ‘i’ does not name a type 59 | for (int i = 1; i <= n; i++ ) | ^ answer.code:59:33: error: ‘i’ does not name a type 59 | for (int i = 1; i <= n; i++ ) | ^ answer.code:72:9: error: ‘cout’ does not name a type 72 | cout << chazhi + 2 << endl; | ^~~~ answer.code:73:1: error: expected declaration before ‘}’ token 73 | } | ^