結果
問題 | No.2195 AND Set |
ユーザー | deepjuggling |
提出日時 | 2023-01-20 22:24:50 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,214 bytes |
コンパイル時間 | 742 ms |
コンパイル使用メモリ | 86,764 KB |
実行使用メモリ | 93,504 KB |
最終ジャッジ日時 | 2023-09-05 14:44:02 |
合計ジャッジ時間 | 13,392 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,448 KB |
testcase_01 | AC | 74 ms
71,472 KB |
testcase_02 | AC | 677 ms
81,460 KB |
testcase_03 | AC | 719 ms
86,944 KB |
testcase_04 | AC | 640 ms
82,596 KB |
testcase_05 | AC | 810 ms
85,748 KB |
testcase_06 | AC | 809 ms
86,616 KB |
testcase_07 | AC | 674 ms
80,656 KB |
testcase_08 | AC | 801 ms
86,044 KB |
testcase_09 | WA | - |
testcase_10 | AC | 943 ms
92,252 KB |
testcase_11 | AC | 931 ms
92,692 KB |
testcase_12 | AC | 927 ms
92,864 KB |
testcase_13 | AC | 938 ms
93,504 KB |
testcase_14 | AC | 941 ms
93,156 KB |
ソースコード
q = int(input()) joutai = [0 for i in range(30)] s = {} ss = {} for i in range(q): a = list(map(int,input().split())) if a[0] == 1: if a[1] not in s: b = [] x = a[1] while x > 1: if x % 2 == 0: b.append("0") else: b.append("1") x //= 2 b.append("1") # print(b) for j in range(len(b)): if b[j] == "1": joutai[j] += 1 s[a[1]] = 1 elif a[0] == 2: if a[1] in s: b = [] x = a[1] while x > 1: if x % 2 == 0: b.append("0") else: b.append("1") x //= 2 b.append("1") # print(b) for j in range(len(b)): if b[j] == "1": joutai[j] -= 1 s.pop(a[1]) else: ans = 0 su = len(s) if su == 0: print(-1) continue for i in range(30): if joutai[i] == su: ans += 2**i print(ans) # print(s,joutai)