Submission #215019


Source Code Expand

Copy
import std.stdio, std.string, std.conv
	,std.array,std.algorithm, std.range
	,std.math;

void main(){
	auto buf = readln().strip().split().map!(to!int)();
	immutable int N = buf[0];
	immutable int M = buf[1];
	immutable int D = buf[2];
	auto A = readln().strip().split().map!(to!int)();

	int[] amd = iota(0,N).array;
	int[] alln = amd.dup;

	foreach_reverse(int e; A) {
		swap(amd[e-1], amd[e]);
	}

	int ansn = 0;
	int[] ans = iota(0,N).array;
	int[] tm = amd.dup;
	int tmn = 1;

	while(ansn < D) {
		foreach(int i; 0 .. (D%(tmn*2))/tmn) {
			foreach(int j; 0 .. N) {
				ans[j] = tm[ans[j]];
			}
			ansn += tmn;
		}

		if(ansn * 2 <= D) {
			int[] ttm = tm.dup;
			foreach(int j; 0 .. N) {
				tm[j] = ttm[tm[j]];
			}
			tmn *= 2;
		}
	}

	foreach(int i; 0 .. N) {
		writeln(ans[i]+1);
	}
}

Submission Info

Submission Time
Task D - 阿弥陀
User diginatu
Language D (DMD 2.060)
Score 100
Code Size 842 Byte
Status AC
Exec Time 183 ms
Memory 10412 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 140 ms 10208 KB
01_random01.txt AC 21 ms 932 KB
01_random02.txt AC 19 ms 796 KB
01_random03.txt AC 21 ms 796 KB
01_random04.txt AC 24 ms 1112 KB
01_random05.txt AC 59 ms 3748 KB
01_random06.txt AC 106 ms 7092 KB
01_random07.txt AC 127 ms 10216 KB
02_i.txt AC 21 ms 924 KB
02_p.txt AC 20 ms 880 KB
02_random01.txt AC 20 ms 932 KB
02_random02.txt AC 21 ms 928 KB
02_random03.txt AC 21 ms 920 KB
02_random04.txt AC 21 ms 864 KB
02_random05.txt AC 26 ms 1312 KB
02_random06.txt AC 50 ms 4388 KB
02_random07.txt AC 80 ms 7456 KB
02_random08.txt AC 80 ms 7528 KB
02_rp01.txt AC 21 ms 928 KB
02_rp02.txt AC 21 ms 1052 KB
02_rp03.txt AC 20 ms 924 KB
02_rp04.txt AC 25 ms 928 KB
02_rp05.txt AC 21 ms 932 KB
03_i.txt AC 20 ms 804 KB
03_random01.txt AC 23 ms 1304 KB
03_random02.txt AC 63 ms 7144 KB
03_random03.txt AC 58 ms 6832 KB
03_random04.txt AC 58 ms 6832 KB
03_random05.txt AC 26 ms 1432 KB
03_random06.txt AC 26 ms 1316 KB
03_random07.txt AC 28 ms 1752 KB
03_random08.txt AC 21 ms 1044 KB
03_random09.txt AC 32 ms 2716 KB
03_random10.txt AC 42 ms 4648 KB
03_random11.txt AC 57 ms 6452 KB
03_random12.txt AC 114 ms 7100 KB
03_random13.txt AC 51 ms 6020 KB
03_random14.txt AC 46 ms 5600 KB
03_random15.txt AC 29 ms 1688 KB
04_i.txt AC 162 ms 10212 KB
04_p1.txt AC 117 ms 7140 KB
04_p2.txt AC 99 ms 6692 KB
04_random01.txt AC 94 ms 6084 KB
04_random02.txt AC 68 ms 3736 KB
04_random03.txt AC 62 ms 6060 KB
04_random04.txt AC 87 ms 6996 KB
04_random05.txt AC 183 ms 8664 KB
04_random06.txt AC 91 ms 6840 KB
04_random07.txt AC 120 ms 10412 KB
04_random08.txt AC 98 ms 8204 KB
04_random09.txt AC 105 ms 10324 KB
04_random10.txt AC 80 ms 6744 KB
04_random11.txt AC 160 ms 10208 KB
04_random12.txt AC 164 ms 10208 KB
04_random13.txt AC 157 ms 10156 KB
04_rp01.txt AC 119 ms 7136 KB
04_rp02.txt AC 118 ms 7136 KB
04_rp03.txt AC 117 ms 7140 KB
04_rp04.txt AC 115 ms 7064 KB
04_rp05.txt AC 155 ms 7196 KB
04_rp06.txt AC 118 ms 7140 KB
04_rp07.txt AC 115 ms 7072 KB
04_rp08.txt AC 118 ms 7140 KB
04_rp09.txt AC 118 ms 7128 KB
04_rp10.txt AC 120 ms 7132 KB
sample_1.txt AC 23 ms 764 KB
sample_2.txt AC 20 ms 924 KB
sample_3.txt AC 21 ms 932 KB