結果
問題 |
No.3249 AND
|
ユーザー |
![]() |
提出日時 | 2025-08-30 15:02:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 175 ms / 2,000 ms |
コード長 | 461 bytes |
コンパイル時間 | 187 ms |
コンパイル使用メモリ | 82,300 KB |
実行使用メモリ | 106,960 KB |
最終ジャッジ日時 | 2025-09-05 11:41:31 |
合計ジャッジ時間 | 4,645 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 23 |
ソースコード
N = int(input()) B = list(map(int, input().split())) if B.count(0) == N: exit(print(1<<N.bit_length())) ans = [-1]*20 for i in range(N): for j in range(20): if not 1<<j & (i+1): if 1<<j & B[i]: exit(print(-1)) continue if ans[j] != -1 and ans[j] != (B[i]>>j & 1): exit(print(-1)) ans[j] = B[i]>>j & 1 n = 0 for i in range(20): if ans[i] == 1: n |= 1<<i print(n)