結果

問題 No.387 ハンコ
ユーザー maspymaspy
提出日時 2020-04-03 03:54:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 26,996 KB
最終ジャッジ日時 2023-09-11 03:08:53
合計ジャッジ時間 7,608 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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()), 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))
0