結果
| 問題 | No.3434 [Cherry 8th Tune N] 大きくして Hold on Card! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-23 21:32:27 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 1,178 bytes |
| 記録 | |
| コンパイル時間 | 1,943 ms |
| コンパイル使用メモリ | 195,068 KB |
| 実行使用メモリ | 8,236 KB |
| 最終ジャッジ日時 | 2026-01-23 21:32:49 |
| 合計ジャッジ時間 | 15,639 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
const ll MOD1000000007 = 1000000007;
const ll MOD998244353 = 998244353;
const ll MOD[3] = {999727999, 1070777777, 1000000007};
const ll LINF = 1LL << 60LL;
const int IINF = (1 << 30) - 1;
void solve(){
int n; cin >> n;
vector<pair<ll, int>> a(n);
vector<ll> b(n);
for(int i=0; i<n; i++){
cin >> a[i].fi;
a[i].se = i;
}
for(int i=0; i<n; i++) cin >> b[i];
sort(all(a));
int k = 0;
ll score = 0; for(int i=0; i<n; i++) score += a[i].fi;
ll ans = score;
for(int i=0; i<n; i++){
score += b[i] - a[i].fi;
if(ans < score){
ans = score;
k = i+1;
}
}
vector<char> s(n, '0');
for(int i=0; i<k; i++) s[a[i].se] = '1';
for(int i=0; i<n; i++) cout << s[i];
cout << '\n';
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int T=1;
cin >> T;
while(T--) solve();
}