結果
問題 | No.2390 Udon Coupon (Hard) |
ユーザー |
|
提出日時 | 2023-07-21 22:31:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,082 bytes |
コンパイル時間 | 836 ms |
コンパイル使用メモリ | 88,744 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 23:59:51 |
合計ジャッジ時間 | 2,074 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 24 |
ソースコード
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<cmath> #include<queue> #include<stack> #include<map> #include<set> using namespace std; typedef long long ll; #define loop1(n) for(int loopt = 0; loopt < (n); loopt++) #define loop2(i,n) for((i) = 0; (i) < (n); (i)++) #define loop3(i,k,n) for((i) = (k); (i) < (n); (i)++) #define GET_NAME_LOOP(_2,_3,NAME,...) NAME #define loop(n,...) GET_NAME_LOOP(__VA_ARGS__,loop3,loop2,loop1)(n,__VA_ARGS__) #define rloop1(n) for(int loopt = (n)-1; loopt >= 0; loopt--) #define rloop2(i,n) for((i) = (n)-1; (i) >= 0; (i)--) #define rloop3(i,k,n) for((i) = (k)-1; (i) >= (n); (i)--) #define GET_NAME_RLOOP(_2,_3,NAME,...) NAME #define rloop(n,...) GET_NAME_RLOOP(__VA_ARGS__,rloop3,rloop2,rloop1)(n,__VA_ARGS__) #define outone cout << "First" << endl #define outtwo cout << "Second" << endl #define outyes cout << "Yes" << endl #define outno cout << "No" << endl #define outans cout << ans << endl #define all(i) i.begin(),i.end() //const ll mod = 998244353L; //const ll mod = 1e9+7L; //const double PI =3.14159265359d; //const double E =2.718281828d; int main() { int i,j,k; ll n; vector<pair<ll,pair<ll,ll>>> input(3); cin >> n; cin >> input[0].second.first>> input[0].second.second; cin >> input[1].second.first>> input[1].second.second; cin >> input[2].second.first>> input[2].second.second; input[0].first = input[0].second.second*input[1].second.first*input[2].second.first; input[1].first = input[1].second.second*input[0].second.first*input[2].second.first; input[2].first = input[2].second.second*input[0].second.first*input[1].second.first; sort(all(input), [](pair<ll,pair<ll,ll>> x, pair<ll,pair<ll,ll>> y) -> int { if(x.first != y.first)return ( x.first > y.first ); else return ( x.second.first < y.second.first); }); ll ans = 0; for(auto e: input){ ans += n/e.second.first*e.second.second; n %= e.second.first; } outans; }