結果
問題 | No.2442 線形写像 |
ユーザー | Nikkuniku029 |
提出日時 | 2023-08-25 22:11:16 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 241 ms / 2,000 ms |
コード長 | 918 bytes |
コンパイル時間 | 314 ms |
コンパイル使用メモリ | 87,036 KB |
実行使用メモリ | 87,264 KB |
最終ジャッジ日時 | 2023-08-26 12:18:20 |
合計ジャッジ時間 | 3,942 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,652 KB |
testcase_01 | AC | 71 ms
71,388 KB |
testcase_02 | AC | 69 ms
71,116 KB |
testcase_03 | AC | 68 ms
71,288 KB |
testcase_04 | AC | 76 ms
71,480 KB |
testcase_05 | AC | 71 ms
71,348 KB |
testcase_06 | AC | 68 ms
71,196 KB |
testcase_07 | AC | 69 ms
71,140 KB |
testcase_08 | AC | 69 ms
71,580 KB |
testcase_09 | AC | 70 ms
71,588 KB |
testcase_10 | AC | 79 ms
76,792 KB |
testcase_11 | AC | 85 ms
76,924 KB |
testcase_12 | AC | 86 ms
76,808 KB |
testcase_13 | AC | 85 ms
76,908 KB |
testcase_14 | AC | 88 ms
76,620 KB |
testcase_15 | AC | 135 ms
78,020 KB |
testcase_16 | AC | 131 ms
78,060 KB |
testcase_17 | AC | 240 ms
87,264 KB |
testcase_18 | AC | 178 ms
78,328 KB |
testcase_19 | AC | 180 ms
78,676 KB |
testcase_20 | AC | 174 ms
78,556 KB |
testcase_21 | AC | 241 ms
87,200 KB |
ソースコード
def popcount(x): '''xの立っているビット数をカウントする関数 (xは64bit整数)''' # 2bitごとの組に分け、立っているビット数を2bitで表現する x = x - ((x >> 1) & 0x5555555555555555) # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333) x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと x = x + (x >> 8) # 16bitごと x = x + (x >> 16) # 32bitごと x = x + (x >> 32) # 64bitごと = 全部の合計 return x & 0x0000007f N = int(input()) A = [int(input()) for _ in range(1 << N)] ans = 'Yes' if A[0] != 0: exit(print('No')) for i in range(1, 1 << N): if popcount(i) > 1: tmp = 0 for j in range(N): if i & (1 << j): tmp ^= A[(1 << j)] if tmp != A[i]: ans = 'No' print(ans)