結果

問題 No.3434 [Cherry 8th Tune N] 大きくして Hold on Card!
コンテスト
ユーザー daiota
提出日時 2026-01-23 22:05:59
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 775 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,394 ms
コンパイル使用メモリ 222,880 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2026-01-23 22:07:56
合計ジャッジ時間 17,010 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)













int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;




	int T;
	cin >> T;
	while(T--){


		ll N;
		cin >> N;

		vector<P> a(N);
		vector<ll> b(N);

		REP(i,N){
			ll c;
			cin >> c;
			a[i]=P(c,i);
		}

		sort(a.begin(),a.end());

		for(i=1;i<N;i++) a[i].first+=a[i-1].first;

		REP(i,N) cin >> b[i];

		for(i=1;i<N;i++) b[i]+=b[i-1];

		ll mx=a[N-1].first,e=-1;
		REP(i,N){

			ll s=a[N-1].first-a[i].first+b[i];
			if(mx<s){
				e=i;
				mx=s;
			}

		}


		vector<ll> ans(N,0);
		for(i=0;i<=e;i++){
			ans[a[i].second]=1;
		}

		REP(i,N) cout << ans[i];
		cout << endl;



	}







	return 0;

}
0