QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401426 | #6748. Spin the Wheel | chthollys | WA | 0ms | 3536kb | C++14 | 856b | 2024-04-28 17:48:41 | 2024-04-28 17:48:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N = 1e5 + 5, mod = 1e9+7, inf = 0x3f3f3f3f;
const int P = 1e9+9;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
int T; ll n, m, k;
ll a[N];
void solve() {
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
int ans = 0;
for(int i = 1; i <= n/i; i++) {
unordered_set<int> st;
for(int j = 1; j <= n; j++) {
st.insert(a[j]);
a[j] = (a[j] + n - j + 1) % n;
}
if(st.size() == 1) {
if(*st.begin() != 0) ans++;
cout << ans << endl;
return;
} else ans++;
}
cout << -1 << endl;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
T = 1;
//cin >> T;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3536kb
input:
5 1 3 0 2 4
output:
-1
result:
wrong answer 1st numbers differ - expected: '3', found: '-1'