結果
問題 | No.2195 AND Set |
ユーザー | 👑 H20 |
提出日時 | 2023-01-20 21:42:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,243 ms / 2,000 ms |
コード長 | 777 bytes |
コンパイル時間 | 386 ms |
コンパイル使用メモリ | 87,116 KB |
実行使用メモリ | 99,460 KB |
最終ジャッジ日時 | 2023-09-05 13:56:34 |
合計ジャッジ時間 | 15,674 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 95 ms
71,612 KB |
testcase_01 | AC | 98 ms
71,508 KB |
testcase_02 | AC | 766 ms
83,448 KB |
testcase_03 | AC | 813 ms
85,004 KB |
testcase_04 | AC | 763 ms
85,328 KB |
testcase_05 | AC | 1,007 ms
86,456 KB |
testcase_06 | AC | 974 ms
86,188 KB |
testcase_07 | AC | 868 ms
86,368 KB |
testcase_08 | AC | 976 ms
86,188 KB |
testcase_09 | AC | 767 ms
81,656 KB |
testcase_10 | AC | 1,243 ms
98,856 KB |
testcase_11 | AC | 1,243 ms
99,460 KB |
testcase_12 | AC | 1,232 ms
98,116 KB |
testcase_13 | AC | 1,238 ms
97,444 KB |
testcase_14 | AC | 1,235 ms
97,724 KB |
ソースコード
import collections CA = collections.Counter() S = set() for _ in range(int(input())): Q = list(map(int, input().split())) if Q[0]==1: x = Q[1] if not x in S: S.add(x) bx = format(x, 'b').zfill(30)[::-1] for i,v in enumerate(bx): if v=='1': CA[i]+=1 if Q[0]==2: x = Q[1] if x in S: S.discard(x) bx = format(x, 'b').zfill(30)[::-1] for i,v in enumerate(bx): if v=='1': CA[i]-=1 if Q[0]==3: if len(S)==0: print(-1) else: ans = 0 for i,v in CA.items(): if v == len(S): ans+=2**i print(ans)