結果

問題 No.3434 [Cherry 8th Tune N] 大きくして Hold on Card!
コンテスト
ユーザー flippergo
提出日時 2026-04-02 08:06:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 296 ms / 2,000 ms
コード長 656 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 303 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 289,320 KB
最終ジャッジ日時 2026-04-02 08:06:31
合計ジャッジ時間 21,009 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    A = [(A[i],i) for i in range(N)]
    A = sorted(A,key=lambda x: x[0])
    C = [B[i]-A[i][0] for i in range(N)]
    cmax = 0
    tot = 0
    indmax = -1
    for i in range(N):
        tot += C[i]
        if tot > cmax:
            cmax = tot
            indmax = i
    if cmax>0:
        Ind = []
        for i in range(indmax+1):
            Ind.append(A[i][1])
        Ind = sorted(Ind)
        ans = ["0"]*N
        for i in Ind:
            ans[i] = "1"
        print("".join(ans))
    else:
        print("0"*N)
0