QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413318 | #6748. Spin the Wheel | gaotianyu# | Compile Error | / | / | C++14 | 875b | 2024-05-17 12:14:21 | 2024-05-17 12:14:22 |
Judging History
This is the latest submission verdict.
- [2024-05-17 12:14:22]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-05-17 12:14:21]
- Submitted
answer
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
typedef pair<int,int> PII;
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 ;
}
if(a[1] == 0)
{
cout << a[2] << "\n";
return;
}
cout << 3 << "\n";
}
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
answer.code: In function ‘void solve()’: answer.code:16:24: error: ‘a’ was not declared in this scope 16 | cin >> a[i]; | ^ answer.code:42:12: error: ‘a’ was not declared in this scope 42 | if(a[1] == 0) | ^