結果

問題 No.110 しましまピラミッド
ユーザー gorugo30
提出日時 2021-02-26 21:01:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-10-02 13:26:12
合計ジャッジ時間 2,392 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

Nw = int(input())
W = list(map(int, input().split()))
Nb = int(input())
B = list(map(int, input().split()))
Bl = [(W[i], 0) for i in range(Nw)] + [(B[i], 1) for i in range(Nb)]
Bl.sort(reverse = True)

ans = 0
N = Nw + Nb
for bottom in range(2):
    nexc = bottom
    minw = 100
    h = 0
    for i in range(N):
        w, c = Bl[i]
        if c == nexc and w < minw:
            minw = w
            nexc ^= 1
            h += 1
    ans = max(ans, h)
print(ans)
0