結果
| 問題 |
No.2390 Udon Coupon (Hard)
|
| コンテスト | |
| ユーザー |
PAKACHU
|
| 提出日時 | 2023-07-22 15:47:58 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 1,092 bytes |
| コンパイル時間 | 3,772 ms |
| コンパイル使用メモリ | 164,464 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-06 02:02:37 |
| 合計ジャッジ時間 | 5,296 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 |
コンパイルメッセージ
main.cpp:20:21: warning: relational comparison result unused [-Wunused-comparison]
20 | l.first < r.first;
| ~~~~~~~~^~~~~~~~~
1 warning generated.
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const long long mod = 998244353;
const ll inf = 1LL << 60;
const int INF = 1e9 + 1;
int main()
{
ll n;
cin >> n;
vector<pair<int, int>> v(3);
for (int i = 0; i < 3; i++)
cin >> v[i].first >> v[i].second;
auto comp = [&](pair<int, int>& l, pair<int, int>& r) {
if (l.second * r.first == r.second * l.first)
l.first < r.first;
return l.second * r.first > r.second * l.first;
};
sort(v.begin(), v.end(), comp);
ll ans = 0;
for (int i = 0; i < v[0].first; i++) {
for (int j = 0; j < v[0].first; j++) {
if (1LL * i * v[1].first + 1LL * j * v[2].first > n)
continue;
ll ret = (n - 1LL * i * v[1].first - 1LL * j * v[2].first) / v[0].first * v[0].second + i * v[1].second + j * v[2].second;
ans = max(ans, ret);
}
}
cout << ans << endl;
}
PAKACHU