Submission #3818345


Source Code Expand

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int MAX_N = (int)2e5 + 5;

int A[MAX_N];
int db[31][MAX_N];

int main()
{
	memset(A, 0, sizeof(A));
	rep (i, 31) rep (j, MAX_N) db[i][j] = 0;

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, M, D; cin >> N >> M >> D;
	rep (i, M){
		cin >> A[i];
		--A[i];
	} // end rep

	vector<int> t(N, 0);
	rep (i, N) t[i] = i;
	
	rep (i, M){
		swap(t[A[i]], t[A[i]+1]);
	} // end rep

	rep (i, N){
		db[0][t[i]] = i;
	} // end rep

	rep (i, 30){
		rep (j, N){
			db[i+1][j] = db[i][db[i][j]];
		} // end rep
	} // end rep

	rep (i, N){
		int p = i;
		for (int j = 30; j >= 0; --j){
			if (D & (1<<j)) p = db[j][p];
		} // end for
		cout << p + 1 << endl;
	} // end rep	

	return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User ty70
Language C++14 (GCC 5.4.1)
Score 100
Code Size 904 Byte
Status AC
Exec Time 200 ms
Memory 26240 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 181 ms 26240 KB
01_random01.txt AC 10 ms 25216 KB
01_random02.txt AC 10 ms 25216 KB
01_random03.txt AC 10 ms 25216 KB
01_random04.txt AC 16 ms 25344 KB
01_random05.txt AC 167 ms 26240 KB
01_random06.txt AC 184 ms 26240 KB
01_random07.txt AC 182 ms 26240 KB
02_i.txt AC 12 ms 25216 KB
02_p.txt AC 12 ms 25216 KB
02_random01.txt AC 10 ms 25216 KB
02_random02.txt AC 11 ms 25216 KB
02_random03.txt AC 12 ms 25216 KB
02_random04.txt AC 12 ms 25216 KB
02_random05.txt AC 13 ms 25216 KB
02_random06.txt AC 19 ms 25216 KB
02_random07.txt AC 25 ms 25216 KB
02_random08.txt AC 25 ms 25216 KB
02_rp01.txt AC 12 ms 25216 KB
02_rp02.txt AC 12 ms 25216 KB
02_rp03.txt AC 12 ms 25216 KB
02_rp04.txt AC 12 ms 25216 KB
02_rp05.txt AC 12 ms 25216 KB
03_i.txt AC 10 ms 25216 KB
03_random01.txt AC 11 ms 25216 KB
03_random02.txt AC 21 ms 25216 KB
03_random03.txt AC 20 ms 25216 KB
03_random04.txt AC 19 ms 25216 KB
03_random05.txt AC 12 ms 25216 KB
03_random06.txt AC 12 ms 25216 KB
03_random07.txt AC 13 ms 25216 KB
03_random08.txt AC 10 ms 25216 KB
03_random09.txt AC 14 ms 25216 KB
03_random10.txt AC 16 ms 25216 KB
03_random11.txt AC 21 ms 25216 KB
03_random12.txt AC 21 ms 25216 KB
03_random13.txt AC 19 ms 25216 KB
03_random14.txt AC 17 ms 25216 KB
03_random15.txt AC 13 ms 25216 KB
04_i.txt AC 200 ms 26240 KB
04_p1.txt AC 186 ms 26240 KB
04_p2.txt AC 153 ms 25984 KB
04_random01.txt AC 112 ms 25856 KB
04_random02.txt AC 91 ms 25728 KB
04_random03.txt AC 35 ms 25344 KB
04_random04.txt AC 38 ms 25344 KB
04_random05.txt AC 44 ms 25344 KB
04_random06.txt AC 116 ms 25856 KB
04_random07.txt AC 86 ms 25600 KB
04_random08.txt AC 74 ms 25600 KB
04_random09.txt AC 56 ms 25472 KB
04_random10.txt AC 122 ms 25856 KB
04_random11.txt AC 190 ms 26240 KB
04_random12.txt AC 195 ms 26240 KB
04_random13.txt AC 190 ms 26240 KB
04_rp01.txt AC 181 ms 26240 KB
04_rp02.txt AC 182 ms 26240 KB
04_rp03.txt AC 186 ms 26240 KB
04_rp04.txt AC 177 ms 26240 KB
04_rp05.txt AC 186 ms 26240 KB
04_rp06.txt AC 193 ms 26240 KB
04_rp07.txt AC 183 ms 26240 KB
04_rp08.txt AC 182 ms 26240 KB
04_rp09.txt AC 191 ms 26240 KB
04_rp10.txt AC 185 ms 26240 KB
sample_1.txt AC 10 ms 25216 KB
sample_2.txt AC 10 ms 25216 KB
sample_3.txt AC 10 ms 25216 KB