#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);
ll ans = 1e18;
auto rec = [&](auto rec, int mask, ll inSp, ll cur) -> void {
if (mask == (1<<n)-1) {
ans = min(ans, cur);
return;
}
for (int b = 0; b < n; b++) if (mask != (mask | (1<<b))) {
ll ncur = cur + max(0ll, inSp-s[b]);
rec(rec, mask | (1<<b), t[b], ncur);
}
};
rec(rec, 0, 1, 0);
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... |