Submission #344396


Source Code Expand

#include<iostream>
using namespace std;
#define rep(i,a,b) for(auto (i)=(a);(i)<=(b);(i)++)
#define rev(i,a,b) for(auto (i)=(b)-1;(i)>=(a);(i)--)
int bin[40][1 << 20];
int result[1 << 20];
int tmp[1 << 20];
void swap(int* i, int* j){
	int t = *i;
	*i = *j;
	*j = t;
}

int main(void){
	int N, M, D, A;
	cin >> N >> M >> D;
	rep(i, 1, N)bin[0][i] = result[i] = i;
	rep(i, 1, M){ 
		cin >> A; 
		swap(bin[0][A],bin[0][A+1]); 
	}
	rep(i, 1, 29){
		rep(j, 1, N)
			bin[i][j] = bin[i - 1][bin[i - 1][j]];
	}
	A = 0;
	while (D){
		if (D & 1){
			rep(i, 1, N)tmp[i] = result[bin[A][i]];
			rep(i, 1, N)result[i] = tmp[i];
		}
		D >>= 1; A++;
	}
	rep(i, 1, N)tmp[result[i]] = i;
	rep(i, 1, N)cout<<tmp[i] << endl;
	/*rep(i, 0, 1){
		rep(j, 1, N)cout << " " << bin[i][j]; cout << endl;
	}*/
	return(0);
}

Submission Info

Submission Time
Task D - 阿弥陀
User btk15049
Language C++11 (GCC 4.8.1)
Score 100
Code Size 834 Byte
Status AC
Exec Time 446 ms
Memory 13420 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 375 ms 13352 KB
01_random01.txt AC 27 ms 936 KB
01_random02.txt AC 27 ms 1064 KB
01_random03.txt AC 27 ms 1044 KB
01_random04.txt AC 41 ms 1320 KB
01_random05.txt AC 372 ms 13356 KB
01_random06.txt AC 353 ms 13392 KB
01_random07.txt AC 446 ms 13352 KB
02_i.txt AC 30 ms 1072 KB
02_p.txt AC 34 ms 1172 KB
02_random01.txt AC 26 ms 944 KB
02_random02.txt AC 26 ms 1040 KB
02_random03.txt AC 30 ms 944 KB
02_random04.txt AC 27 ms 1176 KB
02_random05.txt AC 37 ms 1064 KB
02_random06.txt AC 69 ms 1068 KB
02_random07.txt AC 107 ms 1184 KB
02_random08.txt AC 108 ms 1064 KB
02_rp01.txt AC 31 ms 1188 KB
02_rp02.txt AC 30 ms 1056 KB
02_rp03.txt AC 32 ms 1168 KB
02_rp04.txt AC 28 ms 1064 KB
02_rp05.txt AC 29 ms 1172 KB
03_i.txt AC 26 ms 1044 KB
03_random01.txt AC 32 ms 932 KB
03_random02.txt AC 88 ms 996 KB
03_random03.txt AC 74 ms 984 KB
03_random04.txt AC 72 ms 928 KB
03_random05.txt AC 36 ms 1040 KB
03_random06.txt AC 34 ms 980 KB
03_random07.txt AC 39 ms 1040 KB
03_random08.txt AC 27 ms 1044 KB
03_random09.txt AC 44 ms 980 KB
03_random10.txt AC 58 ms 940 KB
03_random11.txt AC 81 ms 1060 KB
03_random12.txt AC 82 ms 1040 KB
03_random13.txt AC 70 ms 980 KB
03_random14.txt AC 62 ms 940 KB
03_random15.txt AC 38 ms 932 KB
04_i.txt AC 382 ms 13352 KB
04_p1.txt AC 328 ms 13360 KB
04_p2.txt AC 263 ms 10796 KB
04_random01.txt AC 217 ms 7844 KB
04_random02.txt AC 166 ms 6556 KB
04_random03.txt AC 100 ms 2212 KB
04_random04.txt AC 139 ms 2024 KB
04_random05.txt AC 134 ms 2600 KB
04_random06.txt AC 223 ms 8360 KB
04_random07.txt AC 210 ms 5292 KB
04_random08.txt AC 185 ms 4652 KB
04_random09.txt AC 167 ms 2984 KB
04_random10.txt AC 211 ms 8484 KB
04_random11.txt AC 383 ms 13348 KB
04_random12.txt AC 384 ms 13356 KB
04_random13.txt AC 391 ms 13364 KB
04_rp01.txt AC 330 ms 13352 KB
04_rp02.txt AC 332 ms 13352 KB
04_rp03.txt AC 328 ms 13348 KB
04_rp04.txt AC 328 ms 13352 KB
04_rp05.txt AC 328 ms 13420 KB
04_rp06.txt AC 334 ms 13356 KB
04_rp07.txt AC 334 ms 13352 KB
04_rp08.txt AC 325 ms 13352 KB
04_rp09.txt AC 330 ms 13356 KB
04_rp10.txt AC 336 ms 13356 KB
sample_1.txt AC 25 ms 1048 KB
sample_2.txt AC 27 ms 1048 KB
sample_3.txt AC 24 ms 1048 KB