結果
問題 |
No.914 Omiyage
|
ユーザー |
|
提出日時 | 2020-09-16 21:56:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 728 bytes |
コンパイル時間 | 6,167 ms |
コンパイル使用メモリ | 202,180 KB |
最終ジャッジ日時 | 2025-01-14 15:20:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >> k; vector<vector<int> > a(n, vector<int>(m)); REP (i, n) REP (j, m) cin >> a[i][j]; vector<vector<bool> > dp(n+1, vector<bool>(k+1)); dp[0][k] = true; REP (i, n) REP (j, k+1) { if (dp[i][j]) { REP (l, m) { if (j - a[i][l] >= 0) dp[i+1][j-a[i][l]] = true; } } } int p = -1; REP (i, k+1) if (dp[n][i]) { p = i; break; } cout << p << endl; return 0; }