Submission #655598


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[ 100000 + 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 0
Code Size 1469 Byte
Status RE
Exec Time 459 ms
Memory 13296 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 10 0 / 20 0 / 20 0 / 50
Status
AC × 6
RE × 3
AC × 16
RE × 2
AC × 10
RE × 8
AC × 18
RE × 11
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 RE 334 ms 1260 KB
01_random01.txt AC 27 ms 792 KB
01_random02.txt AC 28 ms 744 KB
01_random03.txt AC 27 ms 792 KB
01_random04.txt AC 42 ms 1256 KB
01_random05.txt AC 353 ms 13032 KB
01_random06.txt RE 333 ms 1128 KB
01_random07.txt RE 332 ms 1260 KB
02_i.txt AC 31 ms 1036 KB
02_p.txt AC 31 ms 876 KB
02_random01.txt AC 27 ms 792 KB
02_random02.txt AC 29 ms 796 KB
02_random03.txt AC 34 ms 920 KB
02_random04.txt AC 31 ms 876 KB
02_random05.txt AC 39 ms 992 KB
02_random06.txt AC 72 ms 1252 KB
02_random07.txt RE 321 ms 1256 KB
02_random08.txt RE 322 ms 1232 KB
02_rp01.txt AC 31 ms 876 KB
02_rp02.txt AC 44 ms 932 KB
02_rp03.txt AC 29 ms 1048 KB
02_rp04.txt AC 29 ms 996 KB
02_rp05.txt AC 33 ms 924 KB
03_i.txt AC 26 ms 840 KB
03_random01.txt AC 32 ms 924 KB
03_random02.txt RE 316 ms 1256 KB
03_random03.txt RE 308 ms 1248 KB
03_random04.txt RE 318 ms 1136 KB
03_random05.txt AC 36 ms 916 KB
03_random06.txt AC 34 ms 868 KB
03_random07.txt AC 38 ms 1004 KB
03_random08.txt AC 28 ms 868 KB
03_random09.txt AC 43 ms 1004 KB
03_random10.txt RE 303 ms 1252 KB
03_random11.txt RE 304 ms 1256 KB
03_random12.txt RE 301 ms 1128 KB
03_random13.txt RE 307 ms 1252 KB
03_random14.txt RE 299 ms 1136 KB
03_random15.txt AC 41 ms 996 KB
04_i.txt RE 328 ms 1248 KB
04_p1.txt AC 350 ms 13292 KB
04_p2.txt AC 287 ms 10692 KB
04_random01.txt RE 330 ms 1132 KB
04_random02.txt AC 184 ms 6372 KB
04_random03.txt RE 329 ms 1224 KB
04_random04.txt RE 319 ms 1232 KB
04_random05.txt RE 343 ms 1256 KB
04_random06.txt AC 234 ms 8420 KB
04_random07.txt RE 320 ms 1248 KB
04_random08.txt RE 319 ms 1132 KB
04_random09.txt RE 319 ms 1248 KB
04_random10.txt AC 217 ms 8428 KB
04_random11.txt RE 319 ms 1260 KB
04_random12.txt RE 328 ms 1264 KB
04_random13.txt RE 323 ms 1256 KB
04_rp01.txt AC 364 ms 13284 KB
04_rp02.txt AC 365 ms 13288 KB
04_rp03.txt AC 447 ms 13268 KB
04_rp04.txt AC 352 ms 13288 KB
04_rp05.txt AC 353 ms 13296 KB
04_rp06.txt AC 364 ms 13292 KB
04_rp07.txt AC 355 ms 13284 KB
04_rp08.txt AC 459 ms 13292 KB
04_rp09.txt AC 425 ms 13296 KB
04_rp10.txt AC 418 ms 13284 KB
sample_1.txt AC 28 ms 916 KB
sample_2.txt AC 27 ms 836 KB
sample_3.txt AC 27 ms 796 KB