제출 #276468

#제출 시각아이디문제언어결과실행 시간메모리
276468arayiRoller Coaster Railroad (IOI16_railroad)C++17
34 / 100
80 ms10616 KiB
#include "railroad.h" #include <bits/stdc++.h> #define lli long long int using namespace std; const int N = 1e5 + 30; int n; lli dp[20][N], mn = 1e11; long long plan_roller_coaster(vector<int> s, vector<int> t) { n = s.size(); for (int x = 0; x < (1 << n); x++) { for (int i = 0; i < n; i++) { if((1 << i) & x) { if(x - (1 << i) == 0) continue; dp[i][x] = 1e11; for (int j = 0; j < n; j++) { if(i == j) continue; if((1 << j) & x) dp[i][x] = min(max(0, t[i] - s[j]) + dp[j][x - (1 << i)], dp[i][x]); } } } } for (int i = 0; i < n; i++) { mn = min(dp[i][(1 << n) - 1], mn); } return mn; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...