結果
問題 | No.5001 排他的論理和でランニング |
ユーザー | uafr_cs |
提出日時 | 2018-03-17 03:16:43 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,917 bytes |
コンパイル時間 | 2,403 ms |
実行使用メモリ | 56,216 KB |
スコア | 34,602,925 |
最終ジャッジ日時 | 2020-03-12 19:59:50 |
ジャッジサーバーID (参考情報) |
judge9 / |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | AC | 1,258 ms
54,460 KB |
testcase_02 | AC | 1,338 ms
52,312 KB |
testcase_03 | AC | 1,453 ms
52,620 KB |
testcase_04 | TLE | - |
testcase_05 | AC | 1,385 ms
53,940 KB |
testcase_06 | AC | 1,451 ms
52,316 KB |
testcase_07 | AC | 1,489 ms
0 KB |
testcase_08 | TLE | - |
testcase_09 | AC | 1,224 ms
50,648 KB |
testcase_10 | AC | 1,310 ms
52,272 KB |
testcase_11 | AC | 1,388 ms
52,232 KB |
testcase_12 | AC | 1,316 ms
52,200 KB |
testcase_13 | TLE | - |
testcase_14 | AC | 1,493 ms
52,208 KB |
testcase_15 | AC | 1,377 ms
54,152 KB |
testcase_16 | AC | 1,298 ms
52,256 KB |
testcase_17 | AC | 1,311 ms
52,340 KB |
testcase_18 | AC | 1,476 ms
56,216 KB |
testcase_19 | AC | 1,380 ms
52,188 KB |
testcase_20 | AC | 1,345 ms
52,372 KB |
testcase_21 | AC | 1,321 ms
54,388 KB |
testcase_22 | AC | 1,253 ms
52,564 KB |
testcase_23 | AC | 1,242 ms
51,780 KB |
testcase_24 | AC | 1,301 ms
52,340 KB |
testcase_25 | AC | 1,484 ms
54,340 KB |
testcase_26 | AC | 1,435 ms
52,440 KB |
testcase_27 | AC | 1,338 ms
52,276 KB |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | AC | 1,293 ms
52,424 KB |
testcase_31 | TLE | - |
testcase_32 | AC | 1,344 ms
52,500 KB |
testcase_33 | TLE | - |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
testcase_36 | TLE | - |
testcase_37 | TLE | - |
testcase_38 | AC | 1,339 ms
52,320 KB |
testcase_39 | AC | 1,355 ms
52,200 KB |
testcase_40 | AC | 1,440 ms
52,252 KB |
testcase_41 | AC | 1,277 ms
52,328 KB |
testcase_42 | AC | 1,412 ms
52,500 KB |
testcase_43 | AC | 1,443 ms
52,408 KB |
testcase_44 | TLE | - |
testcase_45 | TLE | - |
testcase_46 | TLE | - |
testcase_47 | AC | 1,384 ms
52,624 KB |
testcase_48 | AC | 1,344 ms
52,240 KB |
testcase_49 | TLE | - |
ソースコード
import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int M = sc.nextInt(); long[] array = new long[N]; for(int i = 0; i < N; i++){ array[i] = sc.nextLong(); } Arrays.sort(array); boolean[] used = new boolean[N]; long max = 0; for(int i = 0; i < M; i++){ used[(N - 1) - i] = true; max ^= array[(N - 1) - i]; } for(int x = 0; x < 6000000; x++){ final int x1 = (int)(Math.random() * N); final int x2 = (int)(Math.random() * N); final int x3 = (int)(Math.random() * N); final int x4 = (int)(Math.random() * N); //final int x5 = (int)(Math.random() * N); //final int x6 = (int)(Math.random() * N); int count = 0; count += used[x1] ? 1 : -1; used[x1] = !used[x1]; count += used[x2] ? 1 : -1; used[x2] = !used[x2]; count += used[x3] ? 1 : -1; used[x3] = !used[x3]; count += used[x4] ? 1 : -1; used[x4] = !used[x4]; //count += used[x5] ? 1 : -1; used[x5] = !used[x5]; //count += used[x6] ? 1 : -1; used[x6] = !used[x6]; if(count != 0){ used[x1] = !used[x1]; used[x2] = !used[x2]; used[x3] = !used[x3]; used[x4] = !used[x4]; //used[x5] = !used[x5]; //used[x6] = !used[x6]; continue; } final long next_max = max ^ array[x1] ^ array[x2] ^ array[x3] ^ array[x4]/* ^ array[x5] ^ array[x6]*/; if(next_max > max){ max = next_max; }else{ used[x1] = !used[x1]; used[x2] = !used[x2]; used[x3] = !used[x3]; used[x4] = !used[x4]; //used[x5] = !used[x5]; //used[x6] = !used[x6]; } } boolean first = true; for(int i = 0; i < N; i++){ if(!used[i]){ continue; } System.out.print((first ? "" : " ") + (array[i])); first = false; } System.out.println(); } }