14632022-10-17 18:53:30lacitoKazamatacpp11Time limit exceeded 16/40298ms11144 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<bool> megvan(n);
	vector<int> szoba(n);
	for (int i = 0; i < n; i++) {
		cin >> szoba[i];
	}
	int hany = 0;
	bool kesz = false;
	while(!kesz) {
		hany++;
		kesz = true;
		for (int i = 0; i < n; i++) {
			megvan[szoba[i]] = true;
			if (!megvan[i]) {
				kesz = false;
				break;
			}
		}
		for (int i = 0; i < n; i++) {
			szoba[i]++;
			szoba[i] %= n;
		}
	}
	cout << hany - 1;
}
SubtaskSumTestVerdictTimeMemory
base16/40
1Accepted0/03ms1936 KiB
2Time limit exceeded0/0298ms1856 KiB
3Accepted2/22ms2708 KiB
4Accepted2/22ms2956 KiB
5Accepted2/22ms2988 KiB
6Accepted2/22ms3112 KiB
7Accepted2/23ms3324 KiB
8Accepted2/24ms3408 KiB
9Accepted2/26ms3368 KiB
10Accepted2/24ms3484 KiB
11Time limit exceeded0/2298ms3920 KiB
12Time limit exceeded0/2277ms4776 KiB
13Time limit exceeded0/2261ms5312 KiB
14Time limit exceeded0/2264ms5892 KiB
15Time limit exceeded0/2282ms6812 KiB
16Time limit exceeded0/2261ms7232 KiB
17Time limit exceeded0/2266ms7892 KiB
18Time limit exceeded0/2273ms8404 KiB
19Time limit exceeded0/2261ms9056 KiB
20Time limit exceeded0/2257ms9884 KiB
21Time limit exceeded0/2254ms10492 KiB
22Time limit exceeded0/2282ms11144 KiB