結果

問題 No.110 しましまピラミッド
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-27 01:21:18
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 783 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 6,752 KB
実行使用メモリ 6,152 KB
最終ジャッジ日時 2023-08-30 03:47:45
合計ジャッジ時間 2,064 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
5,884 KB
testcase_01 AC 12 ms
5,884 KB
testcase_02 AC 11 ms
5,960 KB
testcase_03 AC 11 ms
5,864 KB
testcase_04 AC 11 ms
5,948 KB
testcase_05 AC 11 ms
5,892 KB
testcase_06 AC 11 ms
6,108 KB
testcase_07 AC 11 ms
5,988 KB
testcase_08 AC 11 ms
5,992 KB
testcase_09 AC 11 ms
5,856 KB
testcase_10 AC 11 ms
6,004 KB
testcase_11 AC 11 ms
5,896 KB
testcase_12 AC 11 ms
5,932 KB
testcase_13 AC 11 ms
6,152 KB
testcase_14 AC 11 ms
6,104 KB
testcase_15 AC 11 ms
5,856 KB
testcase_16 AC 11 ms
5,872 KB
testcase_17 AC 11 ms
6,048 KB
testcase_18 AC 11 ms
6,052 KB
testcase_19 AC 11 ms
6,140 KB
testcase_20 AC 12 ms
5,880 KB
testcase_21 AC 11 ms
6,008 KB
testcase_22 AC 11 ms
6,052 KB
testcase_23 AC 11 ms
5,964 KB
testcase_24 AC 11 ms
6,012 KB
testcase_25 AC 11 ms
6,048 KB
testcase_26 AC 11 ms
6,052 KB
testcase_27 AC 11 ms
6,092 KB
testcase_28 AC 11 ms
6,100 KB
testcase_29 AC 11 ms
6,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Nw=int(raw_input())
W=map(int,raw_input().split())
Nb=int(raw_input())
B=map(int,raw_input().split())
W.sort()
B.sort()
wi=Nw-1
bi=Nb-1
cur=W[Nw-1]
ansW=1
while True:
    if ansW%2==1:
        while bi>=0 and cur<=B[bi]:
            bi-=1
        if bi<0:
            break
        cur=B[bi]
        ansW+=1
    else:
        while wi>=0 and cur<=W[wi]:
            wi-=1
        if wi<0:
            break
        cur=W[wi]
        ansW+=1
wi=Nw-1
bi=Nb-1
cur=B[Nb-1]
ansB=1
while True:
    if ansB%2==0:
        while bi>=0 and cur<=B[bi]:
            bi-=1
        if bi<0:
            break
        cur=B[bi]
        ansB+=1
    else:
        while wi>=0 and cur<=W[wi]:
            wi-=1
        if wi<0:
            break
        cur=W[wi]
        ansB+=1
print max(ansW,ansB)
0