結果
問題 | No.2386 Udon Coupon (Easy) |
ユーザー | nemutai |
提出日時 | 2023-07-21 21:45:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 173 ms / 2,000 ms |
コード長 | 1,153 bytes |
コンパイル時間 | 1,863 ms |
コンパイル使用メモリ | 208,404 KB |
実行使用メモリ | 20,308 KB |
最終ジャッジ日時 | 2023-10-21 21:43:46 |
合計ジャッジ時間 | 5,796 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 173 ms
20,308 KB |
testcase_08 | AC | 1 ms
4,348 KB |
testcase_09 | AC | 2 ms
4,348 KB |
testcase_10 | AC | 31 ms
7,608 KB |
testcase_11 | AC | 11 ms
5,388 KB |
testcase_12 | AC | 123 ms
16,132 KB |
testcase_13 | AC | 162 ms
19,656 KB |
testcase_14 | AC | 136 ms
17,476 KB |
testcase_15 | AC | 158 ms
19,556 KB |
testcase_16 | AC | 113 ms
15,380 KB |
testcase_17 | AC | 141 ms
18,296 KB |
testcase_18 | AC | 51 ms
9,800 KB |
testcase_19 | AC | 7 ms
4,780 KB |
testcase_20 | AC | 99 ms
14,580 KB |
testcase_21 | AC | 142 ms
18,200 KB |
testcase_22 | AC | 74 ms
12,052 KB |
testcase_23 | AC | 68 ms
11,248 KB |
testcase_24 | AC | 18 ms
6,180 KB |
testcase_25 | AC | 94 ms
13,784 KB |
testcase_26 | AC | 137 ms
17,752 KB |
testcase_27 | AC | 171 ms
19,940 KB |
testcase_28 | AC | 68 ms
11,428 KB |
testcase_29 | AC | 35 ms
8,080 KB |
testcase_30 | AC | 6 ms
4,564 KB |
testcase_31 | AC | 64 ms
10,940 KB |
testcase_32 | AC | 8 ms
4,888 KB |
testcase_33 | AC | 171 ms
20,288 KB |
testcase_34 | AC | 80 ms
12,168 KB |
testcase_35 | AC | 120 ms
15,604 KB |
testcase_36 | AC | 169 ms
19,720 KB |
testcase_37 | AC | 125 ms
16,044 KB |
testcase_38 | AC | 89 ms
13,016 KB |
testcase_39 | AC | 57 ms
10,172 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; #define all(v) v.begin(),v.end() using ll = long long; using ull = unsigned long long; using vll=vector<ll>; using vvll = vector<vector<ll>>; using P = pair<ll,ll>; using vp=vector<pair<ll, ll>>; const ll INF=1ll<<60; ll mod10=1e9+7; ll mod99=998244353; const double PI = acos(-1); #define rep(i,n) for (ll i=0;i<n;++i) #define per(i,n) for(ll i=n-1;i>=0;--i) #define rep2(i,a,n) for (ll i=a;i<n;++i) #define per2(i,a,n) for (ll i=a;i>=n;--i) template <typename T> bool chmax(T &a,const T& b){ if(a<b){ a=b; return true; } return false; } template <typename T> bool chmin(T &a,const T& b){ if(a>b){ a=b; return true; } return false; } ll powmod(ll x,ll n){ ll res=1; while(n>0){ if(n&1) res*=x; x*=x; n>>=1; } return res; } ll N,a,b,c; map<ll,ll> mp; ll f(ll x){ if(mp.count(x))return mp[x]; ll ans=0; if(x>=3) chmax(ans,f(x-3)+a); if(x>=5) chmax(ans,f(x-5)+b); if(x>=10) chmax(ans,f(x-10)+c); return mp[x]=ans; } int main(){ cin>>N; cin>>a>>b>>c; cout<<f(N)<<endl; }