結果

問題 No.110 しましまピラミッド
ユーザー H3PO4
提出日時 2020-04-27 22:28:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 543 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-22 12:14:35
合計ジャッジ時間 2,343 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

Nw = int(input())
W = sorted(list(map(int, input().split())), reverse=True)
Nb = int(input())
B = sorted(list(map(int, input().split())), reverse=True)


def solve(P, Q):
    i, j = 1, 0
    x = P[0]
    ct = 1
    while True:
        while j < len(Q) and Q[j] >= x:
            j += 1
        if j == len(Q):
            return ct
        x = Q[j]
        ct += 1

        while i < len(P) and P[i] >= x:
            i += 1
        if i == len(P):
            return ct
        x = P[i]
        ct += 1


print(max(solve(W, B), solve(B, W)))
0