結果

問題 No.110 しましまピラミッド
ユーザー tcltktcltk
提出日時 2021-01-17 02:57:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 215 ms / 5,000 ms
コード長 1,406 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 83,348 KB
最終ジャッジ日時 2023-08-19 08:08:29
合計ジャッジ時間 8,541 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 205 ms
83,068 KB
testcase_01 AC 201 ms
82,916 KB
testcase_02 AC 196 ms
83,200 KB
testcase_03 AC 196 ms
83,344 KB
testcase_04 AC 201 ms
83,212 KB
testcase_05 AC 215 ms
83,156 KB
testcase_06 AC 204 ms
83,144 KB
testcase_07 AC 193 ms
83,284 KB
testcase_08 AC 195 ms
83,288 KB
testcase_09 AC 196 ms
83,148 KB
testcase_10 AC 207 ms
83,152 KB
testcase_11 AC 196 ms
83,020 KB
testcase_12 AC 195 ms
83,016 KB
testcase_13 AC 195 ms
83,192 KB
testcase_14 AC 198 ms
83,304 KB
testcase_15 AC 199 ms
83,316 KB
testcase_16 AC 203 ms
83,160 KB
testcase_17 AC 197 ms
83,128 KB
testcase_18 AC 202 ms
83,252 KB
testcase_19 AC 201 ms
83,212 KB
testcase_20 AC 201 ms
83,156 KB
testcase_21 AC 200 ms
83,216 KB
testcase_22 AC 207 ms
83,348 KB
testcase_23 AC 206 ms
83,208 KB
testcase_24 AC 204 ms
83,264 KB
testcase_25 AC 199 ms
83,132 KB
testcase_26 AC 198 ms
83,220 KB
testcase_27 AC 203 ms
83,112 KB
testcase_28 AC 200 ms
83,124 KB
testcase_29 AC 203 ms
83,196 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