結果

問題 No.110 しましまピラミッド
ユーザー nebukuro09
提出日時 2016-10-26 14:29:44
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 7,076 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-24 03:50:33
合計ジャッジ時間 1,493 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

Nw = input()
W = sorted(list(set(map(int, raw_input().split()))))
Nb = input()
B = sorted(list(set(map(int, raw_input().split()))))
last = None
ans = 0
while len(W) > 0 and len(B) > 0:
    if W[-1] == B[-1]:
        W.pop()
        B.pop()
        ans += 1
        last = None
    elif W[-1] > B[-1]:
        W.pop()
        if last == 'B' or last == None:
            ans += 1
            last = 'W'
    else:
        B.pop()
        if last == 'W' or last == None:
            ans += 1
            last = 'B'
if len(W) > 0 and (last == 'B' or last == None):
    print ans + 1
elif len(B) > 0 and (last == 'W' or last == None):
    print ans + 1
else:
    print ans
0