結果
問題 |
No.387 ハンコ
|
ユーザー |
![]() |
提出日時 | 2020-04-03 03:56:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,254 ms / 5,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 65 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 29,636 KB |
最終ジャッジ日時 | 2024-06-28 17:40:34 |
合計ジャッジ時間 | 10,768 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) A = tuple(map(int, readline().split())) B = int(b''.join(read().rstrip().split())[::-1], 2) U = 10 ** 5 color_ind = [[] for _ in range(U + 1)] for i, x in enumerate(A): color_ind[x].append(i) dp = 0 for ind in color_ind: if not ind: continue x = 0 for i in ind: x |= B << i dp ^= x dp ^= (1 << (N + N)) answer = ('ODD' if x == '1' else 'EVEN' for x in bin(dp)[::-1][:N + N - 1]) print('\n'.join(answer))