結果
| 問題 | No.2386 Udon Coupon (Easy) |
| コンテスト | |
| ユーザー |
cubinglover
|
| 提出日時 | 2023-07-21 21:41:14 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 441 bytes |
| 記録 | |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 86,628 KB |
| 最終ジャッジ日時 | 2026-07-01 20:17:44 |
| 合計ジャッジ時間 | 983 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:22: error: 'max_element' was not declared in this scope
25 | cout<<max(0,*max_element(dp.begin(),dp.begin()+n+1))<<endl;
| ^~~~~~~~~~~
ソースコード
#include<functional>
#include<iostream>
#include<vector>
using namespace std;
int n,a,b,c;
int N=200005;
int main(){
cin>>n>>a>>b>>c;
vector<int> dp(N,-1);
dp[0]=0;
for(int i=0;i<N;++i){
if(dp[i]==-1)continue;
if(i+3<N){
dp[i+3]=max(dp[i+3], dp[i]+a);
}
if(i+5<N){
dp[i+5]=max(dp[i+5], dp[i]+b);
}
if(i+10<N){
dp[i+10]=max(dp[i+10], dp[i]+c);
}
}
cout<<max(0,*max_element(dp.begin(),dp.begin()+n+1))<<endl;
}
cubinglover