結果

問題 No.2386 Udon Coupon (Easy)
ユーザー Ricky_pon
提出日時 2023-07-21 21:22:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 3,287 bytes
コンパイル時間 1,269 ms
コンパイル使用メモリ 132,032 KB
最終ジャッジ日時 2025-02-15 16:13:41
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <string.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <ciso646>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define REP_OVERLOAD(arg1, arg2, arg3, arg4, NAME, ...) NAME
#define REP3(i, l, r, s) \
for (int i = int(l), rep3_r = int(r), rep3_s = int(s); i < rep3_r; \
i += rep3_s)
#define REP2(i, l, r) REP3(i, l, r, 1)
#define REP1(i, n) REP2(i, 0, n)
#define rep(...) REP_OVERLOAD(__VA_ARGS__, REP3, REP2, REP1, )(__VA_ARGS__)
#define repin(i, l, r) for (int i = int(l), repin_r = int(r); i <= repin_r; ++i)
#define RREP_OVERLOAD(arg1, arg2, arg3, arg4, NAME, ...) NAME
#define RREP3(i, l, r, s) \
for (int i = int(r) - 1, rrep3_l = int(l), rrep3_s = int(s); i >= rrep3_l; \
i -= rrep3_s)
#define RREP2(i, l, r) RREP3(i, l, r, 1)
#define RREP1(i, n) RREP2(i, 0, n)
#define rrep(...) RREP_OVERLOAD(__VA_ARGS__, RREP3, RREP2, RREP1, )(__VA_ARGS__)
#define rrepin(i, l, r) \
for (int i = int(r), rrepin_l = int(l); i >= rrepin_l; --i)
#define all(v) v.begin(), v.end()
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
namespace rklib {
template <class T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) {
os << "[";
for (auto d : v) os << d << ", ";
return os << "]";
}
// a <- max(a, b)
template <class T>
bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// a <- min(a, b)
template <class T>
bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
// if a < 0: a <- b
// else: a <- min(a, b)
template <class T>
bool chmin_non_negative(T &a, const T &b) {
if (a < 0 || a > b) {
a = b;
return true;
}
return false;
}
// floor(num / den)
template <class T>
T div_floor(T num, T den) {
if (den < 0) num = -num, den = -den;
return num >= 0 ? num / den : (num + 1) / den - 1;
}
// ceil(num / den)
template <class T>
T div_ceil(T num, T den) {
if (den < 0) num = -num, den = -den;
return num <= 0 ? num / den : (num - 1) / den + 1;
}
} // namespace rklib
using namespace std;
using namespace rklib;
using lint = long long;
using ulint = unsigned long long;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vec<vec<T>>;
template <class T>
using vvvec = vec<vvec<T>>;
int main() {
int n, a, b, c;
cin >> n >> a >> b >> c;
vec<int> dp(n + 1, 0);
rep(i, n) {
if (i + 3 <= n) chmax(dp[i + 3], dp[i] + a);
if (i + 5 <= n) chmax(dp[i + 5], dp[i] + b);
if (i + 10 <= n) chmax(dp[i + 10], dp[i] + c);
}
rep(i, n) chmax(dp[i + 1], dp[i]);
cout << dp[n] << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0