22782023-01-09 11:55:03rennKazamatacpp11Accepted 40/4021ms4428 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    cin.tie(0);
    iostream::sync_with_stdio(0);
    int n;
    cin >> n;
    
    vector<bool> kulcsok(n, false);
    vector<int> szobak(n);
    
    int inditasok = 0;
    int index = 0;
    
    for(int i = 0; i < n; i++)
    {
        cin >> szobak[i];
    }
    
    int i;
    int kulcs;
    
    while(index < n-1)
    {
        for(i = 0; i < n-1; i++)
        {
            kulcs = (szobak[i]+inditasok)%n;
            if(!kulcsok[kulcs])
            {
                kulcsok[kulcs] = true;
            }
            
            if(!kulcsok[i])
            {
                inditasok++;
                break;
            }
        }
        index = i;
    }
    
    cout << inditasok << endl;
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1832 KiB
2Accepted0/010ms2316 KiB
3Accepted2/22ms2288 KiB
4Accepted2/22ms2640 KiB
5Accepted2/22ms2700 KiB
6Accepted2/22ms2936 KiB
7Accepted2/22ms3020 KiB
8Accepted2/22ms2988 KiB
9Accepted2/22ms3084 KiB
10Accepted2/22ms3364 KiB
11Accepted2/219ms4144 KiB
12Accepted2/220ms4204 KiB
13Accepted2/220ms4088 KiB
14Accepted2/220ms4368 KiB
15Accepted2/219ms4220 KiB
16Accepted2/219ms4100 KiB
17Accepted2/217ms4376 KiB
18Accepted2/219ms4304 KiB
19Accepted2/218ms4304 KiB
20Accepted2/220ms4304 KiB
21Accepted2/217ms4300 KiB
22Accepted2/221ms4428 KiB