結果
問題 | No.1652 XOR Inequalities |
ユーザー | Kiri8128 |
提出日時 | 2021-08-20 23:41:01 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,468 bytes |
コンパイル時間 | 234 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 83,592 KB |
最終ジャッジ日時 | 2024-10-14 07:51:30 |
合計ジャッジ時間 | 78,209 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
55,496 KB |
testcase_01 | AC | 41 ms
53,760 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 1,544 ms
76,928 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 1,542 ms
76,800 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 1,553 ms
78,304 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 1,550 ms
77,056 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 1,551 ms
77,852 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 1,550 ms
77,280 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 1,551 ms
77,568 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 1,553 ms
77,484 KB |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 47 ms
60,416 KB |
testcase_44 | AC | 45 ms
60,416 KB |
testcase_45 | AC | 42 ms
54,016 KB |
testcase_46 | AC | 45 ms
60,160 KB |
testcase_47 | AC | 46 ms
60,544 KB |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | AC | 43 ms
54,144 KB |
testcase_51 | WA | - |
testcase_52 | AC | 175 ms
78,080 KB |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
ソースコード
from random import randrange from time import time def ra(a, b): la = a.bit_length() lb = b.bit_length() while 1: i = randrange(-1, min(la, lb)) c = a ^ b if i < 0 else a ^ b ^ (1 << i) ^ randrange(1 << i) if chk(a, b, c): return c def chk(a, b, c): if a ^ b <= c and b ^ c <= a and c ^ a <= b: return 1 return 0 N = int(input()) NN = 1 << N A = [int(a) for a in input().split()] if A[0] < 0: A[0] = 0 if N == 1: if A[1] < 0: A[1] = 0 print("Yes") print(*A) exit() ng = 0 B = [max(a, 0) for a in A] for i in range(NN): for j in range(NN): if B[i] ^ B[j] > B[i^j]: if A[i] >= 0 and A[j] >= 0 and A[i^j] >= 0: print("No") exit() ng += 1 sTime = time() while ng and time() - sTime < 1.5: i = randrange(NN) if A[i] >= 0: continue j = 0 while j == 0 or i == j: j = randrange(NN) c = ra(B[j], B[i^j]) while time() - sTime < 1.5: pre = 0 new = 0 for j in range(NN): if chk(c, B[j], B[i^j]) == 0: new += 10000 if A[j] >= 0 and A[i^j] >= 0 else 1 if chk(B[i], B[j], B[i^j]) == 0: pre += 10000 if A[j] >= 0 and A[i^j] >= 0 else 1 if new <= pre + 1: B[i] = c ng += new - pre break c = ra(B[j], B[i^j]) if ng: print("No") else: print("Yes") print(*B)