結果

問題 No.200 カードファイト!
ユーザー maspymaspy
提出日時 2020-05-14 17:06:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 8,300 KB
最終ジャッジ日時 2023-10-13 14:54:24
合計ジャッジ時間 2,179 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 14 ms
8,216 KB
testcase_03 AC 13 ms
8,216 KB
testcase_04 AC 15 ms
8,136 KB
testcase_05 AC 14 ms
8,136 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 13 ms
8,216 KB
testcase_14 AC 14 ms
8,196 KB
testcase_15 AC 15 ms
8,216 KB
testcase_16 AC 15 ms
8,136 KB
testcase_17 AC 15 ms
8,184 KB
testcase_18 AC 14 ms
8,288 KB
testcase_19 AC 15 ms
8,216 KB
testcase_20 WA -
testcase_21 AC 14 ms
8,284 KB
testcase_22 AC 13 ms
8,280 KB
testcase_23 AC 14 ms
8,280 KB
testcase_24 AC 14 ms
8,244 KB
testcase_25 AC 13 ms
8,216 KB
testcase_26 AC 14 ms
8,228 KB
testcase_27 AC 14 ms
8,300 KB
testcase_28 AC 14 ms
8,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from bisect import bisect_left, bisect_right

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = int(readline())
B0 = list(map(int, readline().split()))
C = int(readline())
D0 = list(map(int, readline().split()))

B0.sort()
D0.sort()

def game():
    B = []
    D = []
    for _ in range(N):
        if not B:
            B += B0
        if not D:
            D += D0
        if len(B) <= len(D):
            x = B.pop()
            i = bisect_left(D, x)
            y = D.pop(i - 1)
            yield x, y
        else:
            y = D.pop(0)
            i = bisect_right(B, y)
            if i == len(B):
                x = B.pop()
            else:
                x = B.pop(i)
            yield x, y

answer = sum(x > y for x, y in game())
print(answer)
0