結果

問題 No.110 しましまピラミッド
ユーザー MitI_7
提出日時 2017-01-09 13:40:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 726 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-31 11:25:26
合計ジャッジ時間 2,173 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(block_a, block_b):
    block_a = list(sorted(block_a, reverse=True))
    block_b = list(sorted(block_b, reverse=True))

    ans = 0
    last = -1
    height = 2 ** 64
    change = True
    while change:
        change = False
        block_list = block_a if last == -1 else block_b

        for block in block_list:
            if block < height:
                ans += 1
                height = block
                last *= -1
                change = True
                break

    return ans


def main():
    nw = int(input())
    w = list(map(int, input().split()))
    nb = int(input())
    b = list(map(int, input().split()))
    print(max(solve(w, b), solve(b, w)))

if __name__ == '__main__':
    main()
0