QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#401426#6748. Spin the WheelchthollysWA 0ms3536kbC++14856b2024-04-28 17:48:412024-04-28 17:48:41

Judging History

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

  • [2024-04-28 17:48:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3536kb
  • [2024-04-28 17:48:41]
  • 提交

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'