結果

問題 No.3434 [Cherry 8th Tune N] 大きくして Hold on Card!
コンテスト
ユーザー まぬお
提出日時 2026-01-23 21:30:08
言語 PyPy3
(7.3.17)
結果
AC  
実行時間 771 ms / 2,000 ms
コード長 822 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 542 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 142,132 KB
最終ジャッジ日時 2026-01-23 21:31:09
合計ジャッジ時間 36,284 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations
from heapq import heappop, heappush
import math, sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
_int = lambda x: int(x)-1
MOD = 998244353 #10**9+7
INF = 1<<60
Yes, No = "Yes", "No"

for _ in range(int(input())):
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = [(A[i], i) for i in range(N)]
    C.sort(reverse=True)
    cum = [0]
    for b in B: cum.append(cum[-1]+b)


    ans = (cum[N], 0)
    cnt = 0
    for i in range(N):
        cnt += C[i][0]
        rem = N-i-1
        ans = max(ans, (cnt+cum[rem], i+1))
    li = ["1"]*N
    for i in range(ans[1]):
        li[C[i][1]] = "0"
    print("".join(li))
0