結果

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

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

T=int(input())

for tests in range(T):
    N=int(input())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))

    AX=[(A[i],i) for i in range(N)]
    AX.sort()

    ind=0
    MAX=0

    score=0
    for i in range(N):
        score+=B[i]-AX[i][0]

        if MAX<score:
            MAX=score
            ind=i+1

    LANS=[0]*N

    for i in range(ind):
        LANS[AX[i][1]]=1

    print("".join(map(str,LANS)))
    
0