提出 #233792


ソースコード 拡げる

Copy
#include<iostream>
using namespace std;
 
int main(){
	int N,M;
	long long D;
	cin >> N >> M >> D;
	
	int *A = new int[M];
 
	for(int i = 0;i < M;i++)
		cin >> A[i];
 
 
	int *temp = new int[M];
	int *result = new int[M];
	for(int i = 0;i < M;i++){
		temp[i] = A[i];
	}
 
	for(int i = 0;i < N;i++){
		result[i] = i + 1;
	}
 
	int t;
	for(int i = M - 1;i >= 0;i--){
		t = result[temp[i] - 1];
		result[temp[i] - 1] = result[temp[i]];
		result[temp[i]] = t;
	}
 
 
	int *tmpresult = new int[N];
	for(int i = 0;i < N;i++){
		tmpresult[i] = result[i];
	}
	int count = 0;

	for(int i = 0;i < N;i++){
		if(result[i] != i+1)
			count++;
	}

	for(int i = 0;i < N;i++){
		result[i] = i + 1;
	}

	if(count != 0)
		D = D % count;
	else
		D = 0;
 
	for(int i = 0;i < D;i++){
		for(int j = 0;j < N;j++){
			result[j] = tmpresult[result[j] - 1];
		}
	}
 
 
	for(int i = 0;i < N;i++){
		cout << result[i] << endl;
	}
 
	return 0;
}

提出情報

提出日時
問題 D - 阿弥陀
ユーザ doi_ken
言語 C++ (G++ 4.6.4)
得点 0
コード長 980 Byte
結果 WA
実行時間 4038 ms
メモリ 3304 KB

ジャッジ結果

セット名 Subtask1 Subtask2 Subtask3 Subtask4
得点 / 配点 0 / 10 0 / 20 0 / 20 0 / 50
結果
AC × 8
RE × 1
AC × 10
WA × 7
RE × 1
AC × 16
WA × 2
AC × 4
WA × 12
TLE × 13
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
01_i.txt AC 332 ms 3176 KB
01_random01.txt AC 25 ms 920 KB
01_random02.txt AC 26 ms 812 KB
01_random03.txt AC 26 ms 856 KB
01_random04.txt AC 36 ms 880 KB
01_random05.txt RE 271 ms 1328 KB
01_random06.txt AC 310 ms 2788 KB
01_random07.txt AC 331 ms 3176 KB
02_i.txt AC 31 ms 924 KB
02_p.txt WA 26 ms 816 KB
02_random01.txt AC 26 ms 800 KB
02_random02.txt AC 24 ms 800 KB
02_random03.txt AC 28 ms 816 KB
02_random04.txt WA 26 ms 920 KB
02_random05.txt AC 36 ms 1000 KB
02_random06.txt AC 82 ms 1580 KB
02_random07.txt WA 103 ms 2380 KB
02_random08.txt WA 101 ms 2408 KB
02_rp01.txt RE 290 ms 876 KB
02_rp02.txt WA 32 ms 856 KB
02_rp03.txt AC 28 ms 920 KB
02_rp04.txt WA 29 ms 808 KB
02_rp05.txt WA 30 ms 924 KB
03_i.txt AC 26 ms 912 KB
03_random01.txt AC 31 ms 1056 KB
03_random02.txt AC 77 ms 2272 KB
03_random03.txt AC 67 ms 2032 KB
03_random04.txt AC 67 ms 2096 KB
03_random05.txt AC 33 ms 1108 KB
03_random06.txt AC 31 ms 1036 KB
03_random07.txt AC 36 ms 1128 KB
03_random08.txt AC 25 ms 880 KB
03_random09.txt WA 42 ms 1244 KB
03_random10.txt AC 54 ms 1644 KB
03_random11.txt AC 83 ms 2276 KB
03_random12.txt AC 78 ms 2344 KB
03_random13.txt AC 65 ms 2016 KB
03_random14.txt WA 59 ms 1772 KB
03_random15.txt AC 39 ms 1224 KB
04_i.txt AC 349 ms 3176 KB
04_p1.txt WA 1746 ms 2416 KB
04_p2.txt TLE 4032 ms 2164 KB
04_random01.txt WA 2712 ms 2012 KB
04_random02.txt WA 1262 ms 1520 KB
04_random03.txt WA 126 ms 1768 KB
04_random04.txt WA 196 ms 2412 KB
04_random05.txt WA 373 ms 2144 KB
04_random06.txt TLE 4035 ms 2028 KB
04_random07.txt WA 1479 ms 2684 KB
04_random08.txt WA 456 ms 2348 KB
04_random09.txt WA 452 ms 2540 KB
04_random10.txt WA 3463 ms 1772 KB
04_random11.txt WA 3064 ms 3148 KB
04_random12.txt TLE 4035 ms 3304 KB
04_random13.txt TLE 4034 ms 3304 KB
04_rp01.txt TLE 4034 ms 2540 KB
04_rp02.txt WA 2445 ms 2392 KB
04_rp03.txt TLE 4038 ms 2480 KB
04_rp04.txt TLE 4035 ms 2532 KB
04_rp05.txt TLE 4034 ms 2536 KB
04_rp06.txt TLE 4033 ms 2552 KB
04_rp07.txt TLE 4033 ms 2436 KB
04_rp08.txt TLE 4034 ms 2548 KB
04_rp09.txt TLE 4033 ms 2544 KB
04_rp10.txt TLE 4033 ms 2540 KB
sample_1.txt AC 26 ms 912 KB
sample_2.txt AC 25 ms 864 KB
sample_3.txt AC 24 ms 792 KB