結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:05:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 50 ms / 5,000 ms |
コード長 | 617 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 82,580 KB |
実行使用メモリ | 63,512 KB |
最終ジャッジ日時 | 2025-03-20 21:06:03 |
合計ジャッジ時間 | 1,994 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
def main():import sysinput = sys.stdin.read().split()n = int(input[0])A = list(map(int, input[1:n+1]))max_bit = 14 # since A_i <= 16384 = 2^14basis = [0] * (max_bit + 1)for num in A:x = numfor i in range(max_bit, -1, -1):if (x >> i) & 1:if basis[i]:x ^= basis[i]else:basis[i] = xbreak# Count the number of non-zero elements in the basisr = sum(1 for b in basis if b != 0)print(1 << r)if __name__ == "__main__":main()