Submission #2236204


Source Code Expand

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(void){
	int n, m, d;

	cin >> n >> m >> d;


	map< int, vector<int> > mp;

	vector<int> map(n+1, 0);

	for (int i = 0; i < n + 1; i++)
		map[i] = i;

	vector<int> a(m);
	for (int i = 0; i < m; i++){
		cin >> a[i];
	}

	for (int i = m-1; i >= 0; i--){
		int t = map[a[i]];
		map[a[i]] = map[a[i] + 1];
		map[a[i] + 1] = t;
	}

	vector<int> root(n + 1);
	vector<int> index(n + 1, 0);
	vector<int> member(n + 1, 0);

	for (int i = 1; i < n + 1; i++){
		if (index[i] != 0)
			continue;
		int t = i;
		int num = 1;
		mp[i] = vector<int>(0);

		do {
			root[t] = i;
			index[t] = num++;
			mp[i].push_back(t);
			t = map[t];
		} while(t != i);

		member[i] = num - 1;
	}



	for (int i = 1; i < n + 1; i++){
		int t = d % member[root[i]];

		cout << mp[root[i]][(index[i] + t + member[root[i]] - 1) % member[root[i]]] << endl;
	}

}

Submission Info

Submission Time
Task D - 阿弥陀
User h2929
Language C++14 (GCC 5.4.1)
Score 100
Code Size 970 Byte
Status AC
Exec Time 277 ms
Memory 14080 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 10 / 10 20 / 20 20 / 20 50 / 50
Status
AC × 9
AC × 18
AC × 18
AC × 29
Set Name Test Cases
Subtask1 sample_1.txt, 01_i.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_i.txt, 02_p.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_rp01.txt, 02_rp02.txt, 02_rp03.txt, 02_rp04.txt, 02_rp05.txt
Subtask3 sample_1.txt, sample_2.txt, 03_i.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt
Subtask4 sample_1.txt, sample_2.txt, sample_3.txt, 04_i.txt, 04_p1.txt, 04_p2.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt, 04_random06.txt, 04_random07.txt, 04_random08.txt, 04_random09.txt, 04_random10.txt, 04_random11.txt, 04_random12.txt, 04_random13.txt, 04_rp01.txt, 04_rp02.txt, 04_rp03.txt, 04_rp04.txt, 04_rp05.txt, 04_rp06.txt, 04_rp07.txt, 04_rp08.txt, 04_rp09.txt, 04_rp10.txt
Case Name Status Exec Time Memory
01_i.txt AC 271 ms 14080 KB
01_random01.txt AC 1 ms 256 KB
01_random02.txt AC 1 ms 256 KB
01_random03.txt AC 1 ms 256 KB
01_random04.txt AC 8 ms 512 KB
01_random05.txt AC 195 ms 11008 KB
01_random06.txt AC 214 ms 8192 KB
01_random07.txt AC 229 ms 7808 KB
02_i.txt AC 3 ms 384 KB
02_p.txt AC 3 ms 256 KB
02_random01.txt AC 1 ms 256 KB
02_random02.txt AC 1 ms 256 KB
02_random03.txt AC 3 ms 256 KB
02_random04.txt AC 3 ms 384 KB
02_random05.txt AC 7 ms 384 KB
02_random06.txt AC 24 ms 640 KB
02_random07.txt AC 45 ms 1024 KB
02_random08.txt AC 46 ms 1024 KB
02_rp01.txt AC 3 ms 256 KB
02_rp02.txt AC 3 ms 256 KB
02_rp03.txt AC 3 ms 256 KB
02_rp04.txt AC 3 ms 256 KB
02_rp05.txt AC 3 ms 256 KB
03_i.txt AC 1 ms 256 KB
03_random01.txt AC 4 ms 256 KB
03_random02.txt AC 31 ms 1024 KB
03_random03.txt AC 26 ms 896 KB
03_random04.txt AC 25 ms 896 KB
03_random05.txt AC 6 ms 384 KB
03_random06.txt AC 5 ms 384 KB
03_random07.txt AC 8 ms 384 KB
03_random08.txt AC 2 ms 256 KB
03_random09.txt AC 10 ms 512 KB
03_random10.txt AC 17 ms 640 KB
03_random11.txt AC 29 ms 1024 KB
03_random12.txt AC 31 ms 1024 KB
03_random13.txt AC 24 ms 768 KB
03_random14.txt AC 19 ms 640 KB
03_random15.txt AC 8 ms 384 KB
04_i.txt AC 277 ms 14080 KB
04_p1.txt AC 184 ms 3328 KB
04_p2.txt AC 146 ms 2688 KB
04_random01.txt AC 124 ms 4480 KB
04_random02.txt AC 90 ms 3968 KB
04_random03.txt AC 43 ms 1152 KB
04_random04.txt AC 60 ms 1280 KB
04_random05.txt AC 62 ms 1408 KB
04_random06.txt AC 127 ms 4992 KB
04_random07.txt AC 113 ms 2944 KB
04_random08.txt AC 96 ms 2560 KB
04_random09.txt AC 80 ms 1792 KB
04_random10.txt AC 123 ms 5504 KB
04_random11.txt AC 229 ms 7808 KB
04_random12.txt AC 228 ms 7808 KB
04_random13.txt AC 229 ms 7808 KB
04_rp01.txt AC 188 ms 3320 KB
04_rp02.txt AC 185 ms 3192 KB
04_rp03.txt AC 183 ms 3228 KB
04_rp04.txt AC 182 ms 3196 KB
04_rp05.txt AC 186 ms 3328 KB
04_rp06.txt AC 186 ms 3324 KB
04_rp07.txt AC 183 ms 3196 KB
04_rp08.txt AC 185 ms 3324 KB
04_rp09.txt AC 190 ms 3192 KB
04_rp10.txt AC 185 ms 3324 KB
sample_1.txt AC 1 ms 256 KB
sample_2.txt AC 1 ms 256 KB
sample_3.txt AC 1 ms 256 KB