結果
| 問題 |
No.2329 Nafmo、イカサマをする
|
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2023-05-28 14:03:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 569 bytes |
| コンパイル時間 | 2,476 ms |
| コンパイル使用メモリ | 202,936 KB |
| 最終ジャッジ日時 | 2025-02-13 10:44:28 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 RE * 24 TLE * 2 MLE * 1 |
ソースコード
#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;
}
}
}
keisuke6