結果
問題 | No.2195 AND Set |
ユーザー | titia |
提出日時 | 2023-01-21 00:04:55 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 758 bytes |
コンパイル時間 | 72 ms |
コンパイル使用メモリ | 10,776 KB |
実行使用メモリ | 16,824 KB |
最終ジャッジ日時 | 2023-09-05 16:32:57 |
合計ジャッジ時間 | 25,786 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,772 KB |
testcase_01 | AC | 16 ms
7,804 KB |
testcase_02 | AC | 1,059 ms
9,508 KB |
testcase_03 | AC | 1,226 ms
11,396 KB |
testcase_04 | AC | 1,055 ms
9,340 KB |
testcase_05 | AC | 1,696 ms
11,480 KB |
testcase_06 | AC | 1,701 ms
11,468 KB |
testcase_07 | AC | 1,419 ms
9,148 KB |
testcase_08 | AC | 1,683 ms
11,552 KB |
testcase_09 | WA | - |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
ソースコード
import sys input = sys.stdin.readline Q=int(input()) S=set() A=[0]*32 ko=0 for tests in range(Q): X=list(map(int,input().split())) if X[0]==1: x=X[1] if x in S: pass else: S.add(x) ko+=1 for i in range(32): if x & (1<<i) != 0: A[i]+=1 elif X[0]==2: x=X[1] if x in S: S.remove(x) ko-=1 for i in range(32): if x & (1<<i) != 0: A[i]-=1 else: ANS=-1 for i in range(32): if A[i]>0 and ANS==-1: ANS=0 if A[i]>0 and A[i]==ko: ANS|=(1<<i) print(ANS)