結果

問題 No.110 しましまピラミッド
ユーザー roarisroaris
提出日時 2019-12-18 16:51:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 779 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 71,556 KB
最終ジャッジ日時 2023-09-20 19:31:48
合計ジャッジ時間 4,148 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,176 KB
testcase_01 AC 72 ms
71,148 KB
testcase_02 AC 72 ms
71,508 KB
testcase_03 AC 72 ms
71,328 KB
testcase_04 AC 72 ms
71,280 KB
testcase_05 AC 73 ms
71,320 KB
testcase_06 AC 73 ms
71,556 KB
testcase_07 AC 73 ms
71,264 KB
testcase_08 AC 72 ms
71,184 KB
testcase_09 AC 73 ms
71,532 KB
testcase_10 AC 72 ms
71,148 KB
testcase_11 AC 72 ms
71,300 KB
testcase_12 AC 72 ms
71,556 KB
testcase_13 AC 71 ms
71,192 KB
testcase_14 AC 72 ms
71,552 KB
testcase_15 AC 72 ms
71,336 KB
testcase_16 AC 71 ms
71,344 KB
testcase_17 AC 73 ms
71,208 KB
testcase_18 AC 75 ms
71,324 KB
testcase_19 AC 74 ms
71,320 KB
testcase_20 AC 73 ms
71,284 KB
testcase_21 AC 74 ms
71,504 KB
testcase_22 AC 74 ms
71,020 KB
testcase_23 AC 73 ms
71,496 KB
testcase_24 AC 73 ms
71,304 KB
testcase_25 AC 73 ms
71,440 KB
testcase_26 AC 72 ms
71,212 KB
testcase_27 AC 74 ms
71,016 KB
testcase_28 AC 75 ms
71,404 KB
testcase_29 AC 75 ms
71,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

Nw = int(input())
W = list(map(int, input().split()))
Nb = int(input())
B = list(map(int, input().split()))
W.sort()
B.sort()
ans = 0

cur = W[-1]
c = 1

while True:
    if c%2==1:
        idx = bisect_left(B, cur)
    else:
        idx = bisect_left(W, cur)
    
    if idx==0:
        ans = max(ans, c)
        break
    else:
        if c%2==1:
            cur = B[idx-1]
        else:
            cur = W[idx-1]
        
        c += 1

cur = B[-1]
c = 1

while True:
    if c%2==1:
        idx = bisect_left(W, cur)
    else:
        idx = bisect_left(B, cur)
    
    if idx==0:
        ans = max(ans, c)
        break
    else:
        if c%2==1:
            cur = W[idx-1]
        else:
            cur = B[idx-1]
        
        c += 1

print(ans)
0