Contest Duration: - (local time) (120 minutes) Back to Home

Submission #214882

Source Code Expand

Copy
```import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Main {
//public static final int C = 1000000007;
//static BigDecimal map[][];
//static int N;
//static int M;

public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
BufferedInputStream bs = new BufferedInputStream(System.in);
Scanner sc = new Scanner(bs);
int n = sc.nextInt();
int m = sc.nextInt();
int d = sc.nextInt();

//ArrayList<Integer> al = new ArrayList<Integer>();
int a[] = new int[m];
for ( int i=0; i < m; i++) {
a[i] = sc.nextInt();
}

//int m = sc.nextInt();
//HashMap<Integer, ArrayList<Integer>> hm = new HashMap<Integer, ArrayList<Integer>>();

int ans[] = new int[n];
int next[] = new int[n];
for (int i = 0; i < n; i++) {
next[i] = i;
ans[i] = i+1;
}
for (int i=0; i < m; i++) {
int x = next[a[i]-1];
next[a[i]-1] = next[a[i]];
next[a[i]] = x;
}
int bef[] = ans;
int num = 0;
int all[][] = new int[d][];
for (int i=0; i < d; i++) {
all[i] = ans.clone();
num++;
int x[] = new int[n];
for (int t=0; t < n; t++) {
x[next[t]] = ans[t];
}

ans = x;
if (bef.equals(ans)) {
int nok = d%num;
ans = all[nok];
break;
}

}

for (int i=0; i < n; i++) {

sb.append(ans[i] + "\n");

}

System.out.print(sb);

}
}
```

#### Submission Info

Submission Time 2014-08-16 23:12:46+0900 D - 阿弥陀 kiki33 Java (OpenJDK 1.7.0) 30 1548 Byte MLE 4651 ms 277612 KB

#### Judge Result

Score / Max Score 10 / 10 20 / 20 0 / 20 0 / 50
Status
 AC × 9
 AC × 18
 AC × 2 TLE × 1 RE × 15
 AC × 3 MLE × 1 RE × 25
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 1026 ms 41812 KB
01_random01.txt AC 431 ms 23048 KB
01_random02.txt AC 451 ms 22984 KB
01_random03.txt AC 437 ms 22944 KB
01_random04.txt AC 667 ms 33764 KB
01_random05.txt AC 823 ms 41016 KB
01_random06.txt AC 962 ms 41536 KB
01_random07.txt AC 1006 ms 41200 KB
02_i.txt AC 558 ms 33844 KB
02_p.txt AC 531 ms 34168 KB
02_random01.txt AC 459 ms 23084 KB
02_random02.txt AC 431 ms 23068 KB
02_random03.txt AC 594 ms 28712 KB
02_random04.txt AC 475 ms 34408 KB
02_random05.txt AC 704 ms 36980 KB
02_random06.txt AC 817 ms 38472 KB
02_random07.txt AC 928 ms 42320 KB
02_random08.txt AC 936 ms 42556 KB
02_rp01.txt AC 518 ms 29684 KB
02_rp02.txt AC 516 ms 29304 KB
02_rp03.txt AC 522 ms 26024 KB
02_rp04.txt AC 521 ms 29336 KB
02_rp05.txt AC 517 ms 29432 KB
03_i.txt RE 456 ms 24356 KB
03_random01.txt RE 715 ms 37192 KB
03_random02.txt RE 888 ms 38408 KB
03_random03.txt RE 882 ms 38088 KB
03_random04.txt RE 866 ms 37716 KB
03_random05.txt RE 758 ms 37948 KB
03_random06.txt RE 726 ms 36520 KB
03_random07.txt RE 782 ms 37804 KB
03_random08.txt RE 566 ms 27432 KB
03_random09.txt RE 779 ms 38032 KB
03_random10.txt RE 837 ms 38764 KB
03_random11.txt RE 883 ms 39840 KB
03_random12.txt RE 888 ms 38480 KB
03_random13.txt RE 850 ms 38044 KB
03_random14.txt TLE 4651 ms 277612 KB
03_random15.txt RE 782 ms 37524 KB
04_i.txt RE 1038 ms 40620 KB
04_p1.txt RE 831 ms 39544 KB
04_p2.txt RE 819 ms 39308 KB
04_random01.txt RE 847 ms 38612 KB
04_random02.txt RE 801 ms 38708 KB
04_random03.txt RE 822 ms 37568 KB
04_random04.txt RE 942 ms 39340 KB
04_random05.txt RE 901 ms 39016 KB
04_random06.txt RE 831 ms 38412 KB
04_random07.txt RE 964 ms 38276 KB
04_random08.txt RE 910 ms 39388 KB
04_random09.txt RE 952 ms 39316 KB
04_random10.txt RE 777 ms 38648 KB
04_random11.txt RE 964 ms 40588 KB
04_random12.txt RE 964 ms 40832 KB
04_random13.txt MLE 3003 ms 276844 KB
04_rp01.txt RE 848 ms 40032 KB
04_rp02.txt RE 828 ms 40556 KB
04_rp03.txt RE 837 ms 40932 KB
04_rp04.txt RE 847 ms 38824 KB
04_rp05.txt RE 857 ms 39904 KB
04_rp06.txt RE 855 ms 39836 KB
04_rp07.txt RE 835 ms 39764 KB
04_rp08.txt RE 841 ms 40424 KB
04_rp09.txt RE 837 ms 39964 KB
04_rp10.txt RE 851 ms 39928 KB
sample_1.txt AC 442 ms 23068 KB
sample_2.txt AC 436 ms 23076 KB
sample_3.txt AC 437 ms 23204 KB