結果
| 問題 | No.3434 [Cherry 8th Tune N] 大きくして Hold on Card! |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-01-25 16:20:20 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 84 ms / 2,000 ms |
| コード長 | 1,077 bytes |
| 記録 | |
| コンパイル時間 | 548 ms |
| コンパイル使用メモリ | 61,604 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-01-25 16:21:06 |
| 合計ジャッジ時間 | 14,903 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
コンパイルメッセージ
次のファイルから読み込み: /usr/local/gcc-15/include/c++/15.2.0/algorithm:62,
次から読み込み: main.cpp:7:
In function ‘typename __gnu_cxx::__enable_if<(std::__is_byte<_Tp>::__value && (std::__are_same< <template-parameter-1-1>, <template-parameter-1-2> >::__value || std::__memcpyable_integer<_Up>::__width)), void>::__type std::__fill_a1(_Up*, _Up*, const _Tp&) [with _Up = char; _Tp = char]’,
inlined from ‘void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = char*; _Tp = char]’ at /usr/local/gcc-15/include/c++/15.2.0/bits/stl_algobase.h:979:21,
inlined from ‘void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = char*; _Tp = char]’ at /usr/local/gcc-15/include/c++/15.2.0/bits/stl_algobase.h:1011:20,
inlined from ‘int main()’ at main.cpp:54:9:
/usr/local/gcc-15/include/c++/15.2.0/bits/stl_algobase.h:951:25: 警告: ‘void* __builtin_memset(void*, int, long unsigned int)’ specified bound between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
951 | __builtin_memset(__first, static_cast<unsigned char>(__val), __len);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 3434.cc: No.3434 [Cherry 8th Tune N] 螟ァ縺阪¥縺励※ Hold on Card! - yukicoder
*/
#include<cstdio>
#include<algorithm>
#include<utility>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
using ll = long long;
using pii = pair<int,int>;
/* global variables */
int as[MAX_N], bs[MAX_N];
pii ais[MAX_N];
char s[MAX_N + 4];
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", as + i);
for (int i = 0; i < n; i++) scanf("%d", bs + i);
for (int i = 0; i < n; i++) ais[i] = {as[i], i};
sort(ais, ais + n);
ll sc = 0;
for (int i = 0; i < n; i++) sc += ais[i].first;
ll maxsc = sc;
int maxl = 0;
for (int i = 0; i < n; i++) {
sc += bs[i] - ais[i].first;
if (maxsc < sc) maxsc = sc, maxl = i + 1;
}
fill(s, s + n, '0');
for (int i = 0; i < maxl; i++) s[ais[i].second] = '1';
s[n] = '\0';
puts(s);
}
return 0;
}
tnakao0123