7582022-01-09 12:36:48vandrasKazamatacpp14Time limit exceeded 0/40344ms1832 KiB
#include <bits/stdc++.h>
using namespace std;

int n, vis[100005];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin >> n;
	vector<int> keys;

	int ans = 0;

	for(int i = 0; i < n; ++i){
		int x; cin >> x;
		x = (x+ans)%n;

		keys.push_back(x);
		vis[x] = 1;

		while(!vis[i]){
			vector<int> nkeys;
			for(int k : keys){
				if(!vis[(k+1)%n]) nkeys.push_back((k+1)%n);
				vis[(k+1)%n] = 1;
			}
			swap(keys, nkeys);
			keys = nkeys;
			++ans;
		}

	}

	cout << ans << '\n';


	return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/02ms1832 KiB
2Time limit exceeded0/0284ms936 KiB
3Time limit exceeded0/2296ms1012 KiB
4Time limit exceeded0/2282ms1084 KiB
5Time limit exceeded0/2280ms1148 KiB
6Time limit exceeded0/2287ms1036 KiB
7Time limit exceeded0/2289ms1036 KiB
8Time limit exceeded0/2270ms980 KiB
9Time limit exceeded0/2264ms1108 KiB
10Time limit exceeded0/2289ms1048 KiB
11Time limit exceeded0/2293ms1120 KiB
12Time limit exceeded0/2296ms1048 KiB
13Time limit exceeded0/2296ms1032 KiB
14Time limit exceeded0/2298ms1176 KiB
15Time limit exceeded0/2298ms1128 KiB
16Time limit exceeded0/2296ms1076 KiB
17Time limit exceeded0/2344ms1092 KiB
18Time limit exceeded0/2333ms1172 KiB
19Time limit exceeded0/2277ms1232 KiB
20Time limit exceeded0/2289ms1140 KiB
21Time limit exceeded0/2287ms1172 KiB
22Time limit exceeded0/2330ms1240 KiB