77372024-01-10 20:02:28horvathabelKazamatacpp17Wrong answer 4/4090ms10600 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> room;
    vector<bool> have;
    have.resize(n+1,0);
    set<int> keys;
    for (int i=0; i<n;i++){
        int x;
        cin>>x;
        room.push_back(x);
    }
    int ans=0;
    for (int i=0; i<n;i++){
        int nowkey=room[i]+ans;
        nowkey%=n;
        keys.insert(nowkey);
        have[nowkey]=true;
        while (!have[i]){
            ans++;
            for (int x:keys) have[(x+ans)%n]=true;
        }
    }
    cout<<ans<<endl;

}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/03ms1964 KiB
2Wrong answer0/037ms5468 KiB
3Accepted2/23ms2400 KiB
4Accepted2/23ms2488 KiB
5Wrong answer0/23ms2624 KiB
6Wrong answer0/23ms2836 KiB
7Wrong answer0/23ms3084 KiB
8Wrong answer0/23ms2828 KiB
9Wrong answer0/23ms3044 KiB
10Wrong answer0/23ms2896 KiB
11Wrong answer0/281ms9700 KiB
12Wrong answer0/290ms9668 KiB
13Wrong answer0/276ms9656 KiB
14Wrong answer0/289ms9920 KiB
15Wrong answer0/285ms10012 KiB
16Wrong answer0/281ms10108 KiB
17Wrong answer0/275ms10324 KiB
18Wrong answer0/275ms10516 KiB
19Wrong answer0/282ms10600 KiB
20Wrong answer0/290ms10532 KiB
21Wrong answer0/276ms10492 KiB
22Wrong answer0/283ms10456 KiB