| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 57833 | robert | Roller Coaster Railroad (IOI16_railroad) | C++14 | 163 ms | 25172 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
vector<int> s, t;
long long m[20][100100];
long long solve(long long p, long long sel){
if(sel==((1<<(s.size()-1))-1))
return 0;
if(m[p][sel]!=-1)
return m[p][sel];
long long ret = 1e15;
for(long long x=0ll; x<s.size()-1; x++){
if(((1ll<<x)&sel)==0ll){
//not selected
ret = min(ret, solve(x, sel|(1<<x))+((s[x]<t[p])?(t[p]-s[x]):0ll));
}
}
return m[p][sel] = ret;
}
long long plan_roller_coaster(vector<int> s_c, vector<int> t_c){
s = s_c;
t = t_c;
s.push_back(1);
t.push_back(1);
memset(m, -1, sizeof(m));
if(s_c.size()>100)
return 0;
return solve(t.size()-1, 0);
}
/*
int main(){
vector<int> s_c = {1, 4, 5, 6}, t_c = {7, 3, 8, 6};
cout << plan_roller_coaster(s_c, t_c) << endl;
}*/
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
