結果
| 問題 |
No.3329 Only the Rightest Choice is Right!!!
|
| コンテスト | |
| ユーザー |
DeltaStruct
|
| 提出日時 | 2025-08-07 20:11:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 545 bytes |
| コンパイル時間 | 1,750 ms |
| コンパイル使用メモリ | 200,788 KB |
| 実行使用メモリ | 28,672 KB |
| 最終ジャッジ日時 | 2025-11-02 16:29:45 |
| 合計ジャッジ時間 | 10,145 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 73 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(false),cin.tie(0);
int n,m; cin >> n >> m; vector<int> dp(m+1); vector<vector<int>> rc(m+1);
vector<int> A(n),B(n);
for (int& a:A) cin >> a;
for (int& a:B) cin >> a;
for (int i(n-1);i > -1;--i) for (int k(m);k >= B[i];--k) if (dp[k]<dp[k-B[i]]+A[i]){
dp[k] = dp[k-B[i]]+A[i],rc[k] = rc[k-B[i]],rc[k].emplace_back(i+1);
}
cout << rc[m].size() << endl; reverse(rc[m].begin(),rc[m].end());
for (int a:rc[m]) cout << a << ' ';
cout << endl;
}
DeltaStruct