結果
| 問題 | No.3634 Made to order |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-08-21 23:09:20 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,613 bytes |
| 記録 | |
| コンパイル時間 | 4,628 ms |
| コンパイル使用メモリ | 392,200 KB |
| 実行使用メモリ | 663,296 KB |
| 最終ジャッジ日時 | 2026-08-21 23:09:53 |
| 合計ジャッジ時間 | 29,228 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サブタスク $1$ | 20 % | AC * 8 |
| サブタスク $2$ | 10 % | AC * 19 WA * 2 |
| サブタスク $3$ | 70 % | AC * 25 WA * 1 |
| 合計 | 3 * 20% = 60 点 |
ソースコード
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define pass (void)0
#define INF (1<<30)-1
#define INFLL (1LL<<60)-1
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define repr2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define YesNo(cond) cout << ((cond) ? "Yes\n" : "No\n")
#define YESNO(cond) cout << ((cond) ? "YES\n" : "NO\n")
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
template <typename T> void print(const T& value) { cout << value << "\n"; }
template <typename T> void print(const vector<T>& vec) { for (auto& v : vec) cout << v << " "; cout << "\n"; }
template <typename T> void input(vector<T>& vec) { for (auto& v : vec) cin >> v; };
template <typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using vm = vector<mint>;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(10);
ll N, D;
cin >> N >> D;
vector<tuple<ll, ll, ll>> ABC(N);
rep (i, N) {
ll A, B, C;
cin >> A >> B >> C;
ABC[i] = {A, B, C};
}
vector<vvl> dp(101, vvl(101, vl(1<<N, INFLL)));
rep (i, N) {
auto [A, B, C] = ABC[i];
dp[min(B, 100LL)][min(C, 100LL)][1<<i] = A+B+C;
}
rep (bit, 1<<N) {
rep (i, 101) {
rep (j, 101) {
if (dp[i][j][bit] == INFLL) continue;
ll now = dp[i][j][bit];
rep (k, N) {
if ((1<<k) & bit) continue;
auto [A, B, C] = ABC[k];
ll a = now-j-i+A;
ll b = max(now-j, a)+B;
ll c = max(now, b)+C;
chmin(dp[min(b-a, 100LL)][min(c-b, 100LL)][bit|(1<<k)], c);
}
}
}
}
bool OK = false;
rep (i, 101) {
rep (j, 101) {
if (dp[i][j].back() <= D) {
OK = true;
}
}
}
if (OK) {
print("Yes");
} else {
print("No");
}
}
detteiuu