#include "railroad.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define ALL(x) (x.begin()), (x.end())
#define DEBUG(x) cerr << #x << ": " << x << endl;
#define DEBUG_ARR(x) cerr << #x << ": "; for (auto &y : x) cout << y << " "; cout << endl;
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = SZ(s);
vvl dp(n, vl(1<<n, 1e18));
for (int i = 0; i < n; i++) dp[i][1<<i] = 0;
for (int mask = 1; mask < (1<<n); mask++) {
for (int b = 0; b < n; b++) if (mask&(1<<b)) {
int pr = mask&~(1<<b);
for (int pb = 0; pb < n; pb++) if (pr&(1<<pb)) {
dp[b][mask] = min(dp[b][mask], dp[pb][pr] + (ll)max(0, t[pb]-s[b]));
}
}
}
ll ans = 1e18;
for (int i = 0; i < n; i++) ans = min(ans, dp[i][(1<<n)-1]);
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
railroad.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
railroad_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |