結果

問題 No.110 しましまピラミッド
ユーザー aaaaaaaaaa2230
提出日時 2022-03-13 16:18:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 666 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 53,636 KB
最終ジャッジ日時 2024-09-18 23:28:06
合計ジャッジ時間 2,185 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

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

S = [[w,0] for w in W] + [[b,1] for b in B]
S = sorted(S,reverse=True)
now = 100
w = 0
b = 0
for l,i in S:
    if (w+b)%2 == 0:
        if i == 0 and l < now:
            now = l
            w += 1
    else:
        if i == 1 and l < now:
            now = l
            b += 1

ans = (w+b)

now = 100
w = 0
b = 0
for l,i in S:
    if (w+b)%2 == 0:
        if i == 1 and l < now:
            now = l
            b += 1
    else:
        if i == 0 and l < now:
            now = l
            w += 1
print(max(ans,w+b))
0