Submission #214997


Source Code Expand

#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int n,m,d;
int x[100000], tx[100000], ans[100000];
vector<int> y;

int main(){
	scanf("%d%d%d", &n, &m, &d);
	for(int i = 0; i < 100000; i++){
		tx[i] = i;
		ans[i] = -1;
	}
	for(int i = 0; i < m; i++){
		int a; scanf("%d", &a);
		swap(tx[a],tx[a-1]);
	}
	for(int i = 0; i < m; i++) x[tx[i]] = i;
	for(int i = 0; i < n; i++){
		if(ans[i] != -1) continue;
		if(i == x[i]){
			ans[i] = i;
			continue;
		}
		int tmp = i, cnt = 0;
		y.clear();
		while(true){
			y.push_back(tmp);
			tmp = x[tmp];
			cnt++;
			if(tmp == i) break;
		}
		for(int j = 0; j < y.size(); j++){
			int td = d%cnt;
			ans[y[j]] = y[(j+td)%y.size()];
		}
	}
	for(int i = 0; i < n; i++) printf("%d\n", ans[i]+1);
}

Submission Info

Submission Time
Task D - 阿弥陀
User gasin
Language C++ (G++ 4.6.4)
Score 0
Code Size 803 Byte
Status MLE
Exec Time 3398 ms
Memory 1048576 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:17:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 10 0 / 20 0 / 20 0 / 50
Status
AC × 5
MLE × 1
RE × 3
AC × 7
MLE × 11
AC × 10
MLE × 2
RE × 6
AC × 5
MLE × 13
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 287 ms 1960 KB
01_random01.txt AC 23 ms 1564 KB
01_random02.txt AC 57 ms 1568 KB
01_random03.txt AC 21 ms 1572 KB
01_random04.txt AC 24 ms 1568 KB
01_random05.txt MLE 3284 ms 1048576 KB
01_random06.txt RE 270 ms 1956 KB
01_random07.txt RE 286 ms 1956 KB
02_i.txt AC 23 ms 1696 KB
02_p.txt MLE 3281 ms 1048576 KB
02_random01.txt MLE 3297 ms 1048576 KB
02_random02.txt MLE 3282 ms 1048576 KB
02_random03.txt AC 22 ms 1568 KB
02_random04.txt MLE 3298 ms 1048576 KB
02_random05.txt AC 25 ms 1688 KB
02_random06.txt AC 36 ms 1960 KB
02_random07.txt MLE 3332 ms 1048576 KB
02_random08.txt MLE 3289 ms 1048576 KB
02_rp01.txt MLE 3167 ms 1048576 KB
02_rp02.txt MLE 3244 ms 1048576 KB
02_rp03.txt MLE 3296 ms 1048576 KB
02_rp04.txt MLE 3313 ms 1048576 KB
02_rp05.txt MLE 3280 ms 1048576 KB
03_i.txt AC 32 ms 1576 KB
03_random01.txt AC 23 ms 1568 KB
03_random02.txt RE 273 ms 1952 KB
03_random03.txt RE 268 ms 1876 KB
03_random04.txt RE 263 ms 1956 KB
03_random05.txt AC 25 ms 1700 KB
03_random06.txt AC 27 ms 1576 KB
03_random07.txt AC 28 ms 1704 KB
03_random08.txt AC 23 ms 1688 KB
03_random09.txt AC 28 ms 1684 KB
03_random10.txt RE 260 ms 1964 KB
03_random11.txt RE 271 ms 1968 KB
03_random12.txt RE 276 ms 1952 KB
03_random13.txt MLE 3291 ms 1048576 KB
03_random14.txt MLE 3276 ms 1048576 KB
03_random15.txt AC 27 ms 1708 KB
04_i.txt RE 284 ms 1956 KB
04_p1.txt MLE 3296 ms 1048576 KB
04_p2.txt MLE 3229 ms 1048576 KB
04_random01.txt RE 271 ms 1948 KB
04_random02.txt AC 38 ms 1960 KB
04_random03.txt RE 263 ms 1952 KB
04_random04.txt RE 281 ms 1956 KB
04_random05.txt RE 275 ms 1956 KB
04_random06.txt AC 47 ms 2212 KB
04_random07.txt RE 283 ms 1960 KB
04_random08.txt RE 309 ms 1952 KB
04_random09.txt RE 282 ms 1956 KB
04_random10.txt MLE 3300 ms 1048576 KB
04_random11.txt RE 279 ms 1960 KB
04_random12.txt RE 318 ms 1956 KB
04_random13.txt RE 284 ms 1948 KB
04_rp01.txt MLE 3240 ms 1048576 KB
04_rp02.txt MLE 3304 ms 1048576 KB
04_rp03.txt MLE 3226 ms 1048576 KB
04_rp04.txt MLE 3276 ms 1048576 KB
04_rp05.txt MLE 3263 ms 1048576 KB
04_rp06.txt MLE 3337 ms 1048576 KB
04_rp07.txt MLE 3290 ms 1048576 KB
04_rp08.txt MLE 3228 ms 1048576 KB
04_rp09.txt MLE 3398 ms 1048576 KB
04_rp10.txt MLE 3261 ms 1048576 KB
sample_1.txt AC 22 ms 1688 KB
sample_2.txt AC 22 ms 1696 KB
sample_3.txt AC 39 ms 1700 KB