7852022-01-11 13:40:25kidesoKazamatacpp11Wrong answer 0/40138ms8076 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N;
	cin >> N;
	
	vector <int> x(N);
	vector <int> y(N, 0);
	for (int i = 0; i < N; ++i) cin >> x[i];

	int r = 0, h_db=N;
	int i = 0;

	while (h_db > 0)
	{
		if (y[(x[i] + r) % N] == 0) --h_db;
		y[(x[i] + r) % N] = 1;
		while (y[i] == 1)
		{
			++i;
			if (i == N) { h_db = 0; break; }
			
			if (y[(x[i] + r) % N] == 0) --h_db;
			y[(x[i] + r) % N] = 1;
		}

		++r;
	}

	cout << r - 1;

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/02ms1788 KiB
2Wrong answer0/054ms2868 KiB
3Wrong answer0/21ms2116 KiB
4Wrong answer0/22ms2120 KiB
5Wrong answer0/21ms2124 KiB
6Wrong answer0/21ms2136 KiB
7Wrong answer0/21ms2148 KiB
8Wrong answer0/21ms2144 KiB
9Wrong answer0/21ms2164 KiB
10Wrong answer0/21ms2160 KiB
11Wrong answer0/2111ms4140 KiB
12Wrong answer0/264ms4708 KiB
13Wrong answer0/293ms5280 KiB
14Wrong answer0/287ms5872 KiB
15Wrong answer0/2138ms6432 KiB
16Wrong answer0/2126ms6484 KiB
17Wrong answer0/290ms6460 KiB
18Wrong answer0/267ms6848 KiB
19Wrong answer0/285ms7456 KiB
20Wrong answer0/265ms8032 KiB
21Wrong answer0/2104ms8076 KiB
22Wrong answer0/2119ms8068 KiB