結果
| 問題 | No.710 チーム戦 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-07 18:24:07 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 3,000 ms |
| コード長 | 1,028 bytes |
| 記録 | |
| コンパイル時間 | 1,449 ms |
| コンパイル使用メモリ | 216,036 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-07 00:30:54 |
| 合計ジャッジ時間 | 2,791 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/vector:67,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/functional:66,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:55,
from main.cpp:4:
In function '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = int*; _ForwardIterator = int*]',
inlined from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _Sentinel, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = int*; _Sentinel = int*; _ForwardIterator = int*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_uninitialized.h:637:37,
inlined from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/vector.tcc:257:35,
inlined from 'int main()' at main.cpp:29:14:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_uninitialized.h:273:31: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing between 1 and 400004 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
273 | __builtin_memcpy(std::__niter_base(__result),
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
274 | std::__niter_base(__first),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
275 | __n * sizeof(_ValT));
| ~~~~~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/
ソースコード
//=================================
// Created on: 2018/07/07 18:19:37
//=================================
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
mt19937 mt{random_device{}()};
int main()
{
int N;
cin >> N;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++) { cin >> A[i] >> B[i]; }
const int MAX = 100000;
vector<int> dp(MAX + 1, INF<int>);
dp[0] = 0;
for (int i = 0; i < N; i++) {
vector<int> tmp(MAX + 1, INF<int>);
for (int j = 0; j <= MAX; j++) {
if (dp[j] == INF<int>) { continue; }
tmp[j] = min(tmp[j], dp[j] + B[i]);
tmp[j + A[i]] = min(tmp[j + A[i]], dp[j]);
}
dp = tmp;
}
int ans = INF<int>;
for (int i = 0; i <= MAX; i++) { ans = min(ans, max(dp[i], i)); }
cout << ans << endl;
return 0;
}