結果
| 問題 | No.54 Happy Hallowe'en |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-27 16:45:04 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 83 ms / 5,000 ms |
| + 375µs | |
| コード長 | 558 bytes |
| 記録 | |
| コンパイル時間 | 1,170 ms |
| コンパイル使用メモリ | 222,768 KB |
| 実行使用メモリ | 9,408 KB |
| 最終ジャッジ日時 | 2026-07-12 19:52:29 |
| 合計ジャッジ時間 | 3,029 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<pair<int,int>> VT(N);
for(auto &[v,t] : VT) cin >> v >> t;
sort(VT.begin(),VT.end(),[&](auto &a,auto &b){return a.first+a.second<b.first+b.second;});
bitset<20001> dp; dp.set(0);
bitset<20001> d;
for(auto [v,t] : VT){
d.reset();
for(int i=0; i<t; i++) d.set(i);
dp |= (dp&d)<<v;
}
for(int i=20000; i>=0; i--) if(dp.test(i)){cout << i << endl; break;}
}