結果
| 問題 |
No.914 Omiyage
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-13 14:09:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 606 bytes |
| コンパイル時間 | 2,321 ms |
| コンパイル使用メモリ | 195,696 KB |
| 最終ジャッジ日時 | 2025-01-30 22:12:22 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int N,M,K; cin >> N >> M >> K;
vector<int> dp(K + 1, 0);
dp[K] = 1;
rep(_,N) {
vector<int> nt(K + 1, 0);
rep(i,M) {
int a; cin >> a;
for(int k = 0; k <= K - a; k++) nt[k] |= dp[k + a];
}
swap(dp, nt);
}
for(int k = 0; k <= K; k++) {
if(dp[k]) {
cout << k << endl;
return 0;
}
}
cout << -1 << endl;
}