結果

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

ソースコード

diff #

def check(N, s, M, t):
    i = 0
    j = 0
    flg = 1
    ret = 1
    while True:
        if flg:
            while j < M and s[i] <= t[j]:
                j += 1
            if j == M:
                return ret
        else:
            while i < N and t[j] <= s[i]:
                i += 1
            if i == N:
                return ret
        flg ^= 1
        ret += 1

N = int(input())
W = list(map(int,input().split()))
M = int(input())
B = list(map(int,input().split()))
W.sort(reverse=True)
B.sort(reverse=True)
print(max(check(N, W, M, B), check(M, B, N, W)))
0