22762023-01-09 09:44:45sztomiKazamatacpp11Time limit exceeded 16/40349ms4360 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    set<int> megvan;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    int inditasok = 0;
    for(int i = 0; i < n; i++){
        megvan.insert((a[i]+inditasok)%n);
        while(!megvan.count(i)){
            vector<int> ujak;
            for(int x : megvan){
                ujak.push_back((x+1)%n);
            }
            for(int x : ujak){
                megvan.insert(x);
            }
            inditasok++;
        }
    }
    cout << inditasok << "\n"; 
}
SubtaskSumTestVerdictTimeMemory
base16/40
1Accepted0/03ms1688 KiB
2Time limit exceeded0/0300ms1560 KiB
3Accepted2/22ms2048 KiB
4Accepted2/22ms2172 KiB
5Accepted2/22ms2260 KiB
6Accepted2/22ms2520 KiB
7Accepted2/24ms2816 KiB
8Accepted2/26ms2980 KiB
9Accepted2/217ms3056 KiB
10Accepted2/26ms3140 KiB
11Time limit exceeded0/2300ms3140 KiB
12Time limit exceeded0/2257ms3152 KiB
13Time limit exceeded0/2257ms3436 KiB
14Time limit exceeded0/2340ms3400 KiB
15Time limit exceeded0/2340ms3608 KiB
16Time limit exceeded0/2314ms3588 KiB
17Time limit exceeded0/2261ms3620 KiB
18Time limit exceeded0/2266ms3608 KiB
19Time limit exceeded0/2349ms3840 KiB
20Time limit exceeded0/2264ms3820 KiB
21Time limit exceeded0/2257ms4068 KiB
22Time limit exceeded0/2273ms4360 KiB