結果

問題 No.387 ハンコ
ユーザー maspymaspy
提出日時 2020-04-03 03:58:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 800 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 27,008 KB
最終ジャッジ日時 2023-09-11 03:09:12
合計ジャッジ時間 7,482 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 799 ms
27,008 KB
testcase_01 AC 800 ms
26,800 KB
testcase_02 AC 679 ms
26,336 KB
testcase_03 AC 685 ms
26,324 KB
testcase_04 AC 142 ms
18,792 KB
testcase_05 AC 340 ms
22,500 KB
testcase_06 AC 579 ms
25,776 KB
testcase_07 AC 703 ms
23,776 KB
testcase_08 AC 686 ms
23,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = tuple(map(int,input().split()))
B = int(''.join(input().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))
0