結果

問題 No.110 しましまピラミッド
ユーザー tcltktcltk
提出日時 2021-01-17 02:57:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 1,406 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 89,300 KB
最終ジャッジ日時 2024-05-06 15:23:02
合計ジャッジ時間 6,291 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
89,300 KB
testcase_01 AC 143 ms
88,960 KB
testcase_02 AC 143 ms
89,216 KB
testcase_03 AC 144 ms
88,960 KB
testcase_04 AC 146 ms
88,704 KB
testcase_05 AC 146 ms
89,148 KB
testcase_06 AC 141 ms
88,960 KB
testcase_07 AC 146 ms
88,704 KB
testcase_08 AC 140 ms
89,100 KB
testcase_09 AC 141 ms
89,216 KB
testcase_10 AC 145 ms
89,088 KB
testcase_11 AC 147 ms
89,088 KB
testcase_12 AC 145 ms
89,100 KB
testcase_13 AC 143 ms
89,200 KB
testcase_14 AC 144 ms
89,216 KB
testcase_15 AC 141 ms
88,892 KB
testcase_16 AC 145 ms
88,960 KB
testcase_17 AC 147 ms
88,704 KB
testcase_18 AC 149 ms
88,712 KB
testcase_19 AC 147 ms
88,704 KB
testcase_20 AC 145 ms
88,832 KB
testcase_21 AC 146 ms
89,088 KB
testcase_22 AC 146 ms
89,288 KB
testcase_23 AC 147 ms
88,900 KB
testcase_24 AC 141 ms
89,152 KB
testcase_25 AC 140 ms
88,704 KB
testcase_26 AC 142 ms
89,216 KB
testcase_27 AC 144 ms
89,216 KB
testcase_28 AC 146 ms
89,164 KB
testcase_29 AC 148 ms
89,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """2
# 1 3
# 1
# 2
# """
# sys.stdin = io.StringIO(_INPUT)


def solve(NW, W, NB, B, flag):
    i1 = 0
    i2 = 0
    l = 10**10
    n = 0
    while True:
        if flag:
            while True:
                if i1 == NW:
                    return n
                elif W[i1] < l:
                    l = W[i1]
                    i1 += 1
                    n += 1
                    break
                i1 += 1
        else:
            while True:
                if i2 == NB:
                    return n
                elif B[i2] < l:
                    l = B[i2]
                    i2 += 1
                    n += 1
                    break
                i2 += 1
        flag = not flag

def main():
    NW = int(input())
    W = sorted(list(map(int, input().split())), reverse=True)
    NB = int(input())
    B = sorted(list(map(int, input().split())), reverse=True)


    n1 = solve(NW, W, NB, B, True)
    n2 = solve(NW, W, NB, B, False)
    print(max(n1, n2))


if __name__ == '__main__':
    main()
0