Submission #1222341

#TimeUsernameProblemLanguageResultExecution timeMemory
1222341viduxRoller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2093 ms3400 KiB
#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; }

Compilation message (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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...