結果

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

ソースコード

diff #

def pyrm_count(first, second):
    fi = 1
    si = 0
    pyrm_cur = first[0]
    cur = True
    count = 1
    while True:
        tmp = 100
        if cur:
            if si >= len(second):
                return count
            while si < len(second):
                tmp = second[si]
                si += 1
                if pyrm_cur > tmp:
                    pyrm_cur = tmp
                    count += 1
                    cur = not cur
                    break
        else:
            if fi >= len(first):
                return count
            while fi < len(first):
                tmp = first[fi]
                fi += 1
                if pyrm_cur > tmp:
                    pyrm_cur = tmp
                    count += 1
                    cur = not cur
                    break




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

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