結果

問題 No.110 しましまピラミッド
ユーザー 👑 rin204rin204
提出日時 2022-01-20 10:13:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 86,248 KB
実行使用メモリ 70,848 KB
最終ジャッジ日時 2023-08-15 08:36:29
合計ジャッジ時間 3,986 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
70,716 KB
testcase_01 AC 68 ms
70,680 KB
testcase_02 AC 67 ms
70,848 KB
testcase_03 AC 66 ms
70,656 KB
testcase_04 AC 70 ms
70,704 KB
testcase_05 AC 67 ms
70,748 KB
testcase_06 AC 68 ms
70,488 KB
testcase_07 AC 66 ms
70,844 KB
testcase_08 AC 68 ms
70,752 KB
testcase_09 AC 64 ms
70,808 KB
testcase_10 AC 65 ms
70,720 KB
testcase_11 AC 68 ms
70,680 KB
testcase_12 AC 67 ms
70,688 KB
testcase_13 AC 67 ms
70,796 KB
testcase_14 AC 69 ms
70,756 KB
testcase_15 AC 68 ms
70,612 KB
testcase_16 AC 70 ms
70,756 KB
testcase_17 AC 70 ms
70,484 KB
testcase_18 AC 63 ms
70,660 KB
testcase_19 AC 65 ms
70,640 KB
testcase_20 AC 68 ms
70,828 KB
testcase_21 AC 65 ms
70,716 KB
testcase_22 AC 66 ms
70,748 KB
testcase_23 AC 69 ms
70,784 KB
testcase_24 AC 68 ms
70,356 KB
testcase_25 AC 67 ms
70,648 KB
testcase_26 AC 66 ms
70,756 KB
testcase_27 AC 63 ms
70,648 KB
testcase_28 AC 65 ms
70,828 KB
testcase_29 AC 70 ms
70,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

nw = int(input())
W = list(map(int, input().split()))
nb = int(input())
B = list(map(int, input().split()))
W.sort(reverse = True)
B.sort(reverse = True)
ans = 0
wp = 0
bp = 0
bef = 1 << 40
while 1:
    while wp != nw and W[wp] >= bef:
        wp += 1
    if wp == nw:
        break
    ans += 1
    bef = W[wp]
    
    while bp != nb and B[bp] >= bef:
        bp += 1
    if bp == nb:
        break
    ans += 1
    bef = B[bp]
    
ans2 = 0
wp = 0
bp = 0
bef = 1 << 40
while 1:
    while bp != nb and B[bp] >= bef:
        bp += 1
    if bp == nb:
        break
    ans2 += 1
    bef = B[bp]
    
    while wp != nw and W[wp] >= bef:
        wp += 1
    if wp == nw:
        break
    ans2 += 1
    bef = W[wp]
print(max(ans, ans2))
0