Submission #655600


Source Code Expand

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

int A[ 1000000 + 10 ];
 
int main()
{
	int N,M,D;
 
	cin >> N >> M >> D;
	int doubling[N+1][31];
 
	rep(i,M) {
		cin >> A[ i ];
	}
 
    for(int i = 1; i <= N; ++i)
        doubling[ i ][ 0 ] = i;
	
	//阿弥陀のシュミレーション
    for(int i = M - 1; i >= 0; --i){
		swap(doubling[A[i]][0],doubling[A[i]+1][0]);
	}
 
	REP(k,1,30) { //2^1 ~ 2^30
		REP(i,1,N+1) {
            int f = doubling[ i ][ k - 1 ];
			doubling[i][k] = doubling[f][k-1];
		}
	}
 
	//ダブリング:工程2
	REP(i,1,N+1) {
		int next = i;
		int DD = D;
 
		rep(k,30+1)
		{
			if (DD & 1) {
				next = doubling[next][k];
			}
			DD = DD >> 1;
		}
		cout << next << endl;
	}
 
	return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User Ow1
Language C++11 (GCC 4.8.1)
Score 100
Code Size 1470 Byte
Status AC
Exec Time 411 ms
Memory 13796 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 407 ms 13748 KB
01_random01.txt AC 27 ms 948 KB
01_random02.txt AC 26 ms 1052 KB
01_random03.txt AC 26 ms 1048 KB
01_random04.txt AC 39 ms 1336 KB
01_random05.txt AC 304 ms 13112 KB
01_random06.txt AC 379 ms 13624 KB
01_random07.txt AC 409 ms 13748 KB
02_i.txt AC 31 ms 1080 KB
02_p.txt AC 28 ms 1080 KB
02_random01.txt AC 26 ms 1048 KB
02_random02.txt AC 26 ms 1048 KB
02_random03.txt AC 56 ms 1004 KB
02_random04.txt AC 29 ms 984 KB
02_random05.txt AC 37 ms 1076 KB
02_random06.txt AC 70 ms 1460 KB
02_random07.txt AC 110 ms 1844 KB
02_random08.txt AC 110 ms 1848 KB
02_rp01.txt AC 32 ms 1180 KB
02_rp02.txt AC 31 ms 1176 KB
02_rp03.txt AC 30 ms 1076 KB
02_rp04.txt AC 30 ms 1080 KB
02_rp05.txt AC 30 ms 1076 KB
03_i.txt AC 26 ms 1052 KB
03_random01.txt AC 31 ms 1044 KB
03_random02.txt AC 85 ms 1624 KB
03_random03.txt AC 72 ms 1460 KB
03_random04.txt AC 76 ms 1464 KB
03_random05.txt AC 34 ms 1076 KB
03_random06.txt AC 33 ms 1052 KB
03_random07.txt AC 40 ms 1076 KB
03_random08.txt AC 27 ms 1048 KB
03_random09.txt AC 42 ms 1076 KB
03_random10.txt AC 58 ms 1336 KB
03_random11.txt AC 81 ms 1592 KB
03_random12.txt AC 83 ms 1584 KB
03_random13.txt AC 69 ms 1460 KB
03_random14.txt AC 62 ms 1332 KB
03_random15.txt AC 40 ms 1072 KB
04_i.txt AC 401 ms 13740 KB
04_p1.txt AC 352 ms 13364 KB
04_p2.txt AC 292 ms 10808 KB
04_random01.txt AC 227 ms 7992 KB
04_random02.txt AC 165 ms 6452 KB
04_random03.txt AC 104 ms 2612 KB
04_random04.txt AC 138 ms 2724 KB
04_random05.txt AC 137 ms 3124 KB
04_random06.txt AC 231 ms 8500 KB
04_random07.txt AC 223 ms 5940 KB
04_random08.txt AC 192 ms 5172 KB
04_random09.txt AC 171 ms 3768 KB
04_random10.txt AC 219 ms 8500 KB
04_random11.txt AC 411 ms 13772 KB
04_random12.txt AC 403 ms 13796 KB
04_random13.txt AC 405 ms 13792 KB
04_rp01.txt AC 368 ms 13364 KB
04_rp02.txt AC 354 ms 13364 KB
04_rp03.txt AC 356 ms 13364 KB
04_rp04.txt AC 357 ms 13368 KB
04_rp05.txt AC 357 ms 13364 KB
04_rp06.txt AC 371 ms 13364 KB
04_rp07.txt AC 359 ms 13360 KB
04_rp08.txt AC 361 ms 13360 KB
04_rp09.txt AC 358 ms 13368 KB
04_rp10.txt AC 369 ms 13368 KB
sample_1.txt AC 26 ms 952 KB
sample_2.txt AC 26 ms 1048 KB
sample_3.txt AC 26 ms 952 KB