結果

問題 No.2329 Nafmo、イカサマをする
ユーザー keisuke6keisuke6
提出日時 2023-05-28 14:03:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 569 bytes
コンパイル時間 2,466 ms
コンパイル使用メモリ 206,656 KB
実行使用メモリ 813,652 KB
最終ジャッジ日時 2023-08-27 08:56:40
合計ジャッジ時間 16,903 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 TLE -
testcase_09 AC 919 ms
361,596 KB
testcase_10 AC 1,485 ms
499,712 KB
testcase_11 AC 1,086 ms
370,956 KB
testcase_12 AC 225 ms
91,532 KB
testcase_13 TLE -
testcase_14 AC 142 ms
63,048 KB
testcase_15 AC 1,235 ms
476,932 KB
testcase_16 AC 969 ms
349,928 KB
testcase_17 AC 158 ms
65,800 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 MLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,M,K;
  cin>>N>>M>>K;
  vector<vector<int>> G(M+1);
  vector<int> dist(M+1,1e18);
  queue<int> q;
  dist[0] = 0;
  q.push(0);
  for(int i=0;i<N;i++){
  	int a;
  	cin>>a;
  	for(int j=0;j+a<=M;j++) G[j].push_back(j+a);
  }
  while(!q.empty()){
  	int pos = q.front();
  	q.pop();
  	for(int x:G[pos]){
  		if(dist[x] != 1e18) continue;
  		dist[x] = dist[pos] + 1;
  		q.push(x);
  	}
  }
  for(int i=M;i>=0;i--){
  	if(dist[i] <= K){
  		cout<<i<<endl;
  		return 0;
  	}
  }
}
0