結果

問題 No.914 Omiyage
ユーザー Series_205Series_205
提出日時 2019-10-25 22:00:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 68,724 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-11 04:12:10
合計ジャッジ時間 1,573 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,356 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,352 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int n,m,t;
int a[10][10];
int ans[501];
int main(){
    cin>>n>>m>>t;
    for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin>>a[i][j];
    for(int i=1;i<=500;i++)ans[i]=-1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=t;j++){
            if(ans[j]==i){
                for(int k=0;k<m;k++){
                    ans[j+a[i][k]]=i+1;
                }
            }
        }
    }
    for(int i=t;i!=-1;i--){
        if(ans[i]==n){
            cout<<t-i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}
0