結果
問題 | No.5001 排他的論理和でランニング |
ユーザー | uafr_cs |
提出日時 | 2018-03-17 02:45:56 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,553 bytes |
コンパイル時間 | 2,371 ms |
実行使用メモリ | 56,228 KB |
スコア | 45,088,000 |
最終ジャッジ日時 | 2020-03-12 19:55:36 |
ジャッジサーバーID (参考情報) |
judge9 / |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | AC | 1,165 ms
52,336 KB |
testcase_02 | AC | 1,237 ms
52,488 KB |
testcase_03 | AC | 1,354 ms
52,348 KB |
testcase_04 | TLE | - |
testcase_05 | AC | 1,289 ms
52,636 KB |
testcase_06 | AC | 1,332 ms
52,532 KB |
testcase_07 | AC | 1,394 ms
52,684 KB |
testcase_08 | AC | 1,485 ms
56,228 KB |
testcase_09 | AC | 1,145 ms
48,912 KB |
testcase_10 | AC | 1,238 ms
56,080 KB |
testcase_11 | AC | 1,306 ms
55,828 KB |
testcase_12 | AC | 1,221 ms
52,216 KB |
testcase_13 | AC | 1,495 ms
0 KB |
testcase_14 | AC | 1,391 ms
52,240 KB |
testcase_15 | AC | 1,287 ms
54,508 KB |
testcase_16 | AC | 1,216 ms
52,420 KB |
testcase_17 | AC | 1,223 ms
52,692 KB |
testcase_18 | AC | 1,365 ms
56,016 KB |
testcase_19 | AC | 1,289 ms
52,232 KB |
testcase_20 | AC | 1,316 ms
53,860 KB |
testcase_21 | AC | 1,235 ms
52,324 KB |
testcase_22 | AC | 1,159 ms
52,508 KB |
testcase_23 | AC | 1,156 ms
51,904 KB |
testcase_24 | AC | 1,221 ms
52,412 KB |
testcase_25 | AC | 1,396 ms
52,316 KB |
testcase_26 | AC | 1,349 ms
54,436 KB |
testcase_27 | AC | 1,263 ms
56,120 KB |
testcase_28 | AC | 1,438 ms
56,012 KB |
testcase_29 | AC | 1,457 ms
52,668 KB |
testcase_30 | AC | 1,204 ms
52,300 KB |
testcase_31 | AC | 1,421 ms
52,316 KB |
testcase_32 | AC | 1,264 ms
52,380 KB |
testcase_33 | TLE | - |
testcase_34 | TLE | - |
testcase_35 | AC | 1,418 ms
52,260 KB |
testcase_36 | TLE | - |
testcase_37 | AC | 1,410 ms
55,792 KB |
testcase_38 | AC | 1,255 ms
52,280 KB |
testcase_39 | AC | 1,289 ms
52,292 KB |
testcase_40 | AC | 1,336 ms
52,416 KB |
testcase_41 | AC | 1,209 ms
54,364 KB |
testcase_42 | AC | 1,321 ms
54,372 KB |
testcase_43 | AC | 1,345 ms
52,312 KB |
testcase_44 | AC | 1,473 ms
55,804 KB |
testcase_45 | AC | 1,496 ms
0 KB |
testcase_46 | AC | 1,424 ms
52,236 KB |
testcase_47 | AC | 1,301 ms
54,688 KB |
testcase_48 | AC | 1,263 ms
52,348 KB |
testcase_49 | AC | 1,444 ms
54,276 KB |
ソースコード
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); int x2 = (int)(Math.random() * N); while(x1 == x2){ x2 = (int)(Math.random() * N); } int x3 = (int)(Math.random() * N); while(x1 == x3 || x2 == x3){ x3 = (int)(Math.random() * N); } int x4 = (int)(Math.random() * N); while(x1 == x4 || x2 == x4 || x3 == x4){ x4 = (int)(Math.random() * N); } int count = 0; count += used[x1] ? 1 : 0; count += used[x2] ? 1 : 0; count += used[x3] ? 1 : 0; count += used[x4] ? 1 : 0; if(count != 2){ continue; } final long next_max = max ^ array[x1] ^ array[x2] ^ array[x3] ^ array[x4]; if(next_max > max){ max = next_max; used[x1] = !used[x1]; used[x2] = !used[x2]; used[x3] = !used[x3]; used[x4] = !used[x4]; } } 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(); } }