結果

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

ソースコード

diff #
raw source code

for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	a_ = sum(A)
	A = [(A[i], i) for i in range(n)]
	A.sort()
	ans = a_
	now = ans
	for i in range(n):
		now -= A[i][0] - B[i]
		ans = max(ans, now)
	now = a_
	C = [0] * n
	if now == ans:
		print("".join([str(C[i]) for i in range(n)]))
	else:
		for i in range(n):
			now -= A[i][0] - B[i]
			C[A[i][1]] = 1
			if now == ans:
				print("".join([str(c) for c in C]))
				break
0