22902023-01-09 16:48:42TuruTamasKazamatacpp11Accepted 40/4043ms5188 KiB
#include<bits/stdc++.h>
using namespace std;

int N;

int main() {
    cin >> N;
    vector<bool> keys(N, false);
    vector<int> rooms;
    int a;
    for (int i = 0; i <= N; i++)
    {
        cin >> a;
        rooms.push_back(a);        
    }
    int loc = 0;
    int offset = 0;
    while (loc != N)
    {
        loc = 0;
        for (int i = 0; i < N; i++)
        {
            loc++;
            keys[(rooms[i] + offset) % N] = true;
            if (keys[i]) continue;
            offset++;
            break;
        }
    }
    cout << offset;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1816 KiB
2Accepted0/021ms2668 KiB
3Accepted2/22ms2256 KiB
4Accepted2/22ms2288 KiB
5Accepted2/22ms2416 KiB
6Accepted2/22ms2488 KiB
7Accepted2/22ms2624 KiB
8Accepted2/23ms2860 KiB
9Accepted2/22ms2936 KiB
10Accepted2/22ms2936 KiB
11Accepted2/241ms4168 KiB
12Accepted2/243ms4364 KiB
13Accepted2/243ms4456 KiB
14Accepted2/243ms4448 KiB
15Accepted2/241ms4568 KiB
16Accepted2/241ms4648 KiB
17Accepted2/241ms4652 KiB
18Accepted2/243ms4644 KiB
19Accepted2/241ms4736 KiB
20Accepted2/243ms4860 KiB
21Accepted2/241ms4976 KiB
22Accepted2/243ms5188 KiB