結果
| 問題 | No.3434 [Cherry 8th Tune N] 大きくして Hold on Card! |
| コンテスト | |
| ユーザー |
Tehom
|
| 提出日時 | 2026-01-23 21:43:34 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 85 ms / 2,000 ms |
| コード長 | 1,034 bytes |
| 記録 | |
| コンパイル時間 | 4,957 ms |
| コンパイル使用メモリ | 281,592 KB |
| 実行使用メモリ | 12,032 KB |
| 最終ジャッジ日時 | 2026-01-23 21:43:59 |
| 合計ジャッジ時間 | 18,890 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repl(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a) (a).begin(),(a).end()
template <typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;}
template <typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;} return false;}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T; cin >> T;
while(T--){
int n; cin >> n;
vector<pair<ll,int>> a(n);
vector<ll> b(n);
rep(i,0,n) cin >> a[i].first, a[i].second=i;
rep(i,0,n) cin >> b[i];
sort(all(a));
vector<ll> sum1(n+1),sum2(n+1);
rep(i,0,n) sum1[i+1]=a[i].first,sum2[i+1]=b[i];
rep(i,0,n) sum1[i+1]+=sum1[i],sum2[i+1]+=sum2[i];
ll sum=sum1[n],cnt=0;
rep(i,1,n+1){
if(chmax(sum,sum1[n]-sum1[i]+sum2[i])) cnt=i;
}
vector<int> bi(n);
rep(i,0,cnt) bi[a[i].second]=1;
for(auto bb:bi) cout << bb;
cout << '\n';
}
}
Tehom