結果

問題 No.110 しましまピラミッド
ユーザー rpy3cpp
提出日時 2015-07-16 22:34:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-08 08:13:53
合計ジャッジ時間 1,791 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 21 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

Nw = int(input())
Ws = list(map(int, input().split()))
Nb = int(input())
Bs = list(map(int, input().split()))

def solve(Bs, Ws, Nb, Nw):
    Ws.sort(reverse=True)
    Bs.sort(reverse=True)
    if Bs[0] > Ws[0]:
        Bs, Ws = Ws, Bs
        Nb, Nw = Nw, Nb
    depth = 1
    idxW = 0
    idxB = 0
    while True:
        while Bs[idxB] >= Ws[idxW]:
            idxB += 1
            if idxB == Nb:
                return depth
        depth += 1
        while Ws[idxW] >= Bs[idxB]:
            idxW += 1
            if idxW == Nw:
                return depth
        depth += 1

print(solve(Bs, Ws, Nb, Nw))
0