# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
778411 | vjudge1 | Roller Coaster Railroad (IOI16_railroad) | C++17 | 38 ms | 8880 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#include "railroad.h"
const int N = 4e5+37;
long long int mp[(1<<16)][16];
void f(){
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
}
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
if(s.size()>16) return 0;
int n=s.size();
vector<int> b[n+1];
for(int i=0; i<(1<<n); i++){
for(int j=0; j<n; j++){
mp[i][j] = 2e18;
}
}
for(int i=1; i<(1<<n); i++){
int f=0, p=0;
for(int j=0; j<n; j++){
if(i&(1<<j)) p++, f=j;
}
if(p==1) mp[i][f] = 0;
else b[p-1].push_back(i);
}
long long ans=2e18;
for(int i=1; i<n+1; i++){
for(auto l: b[i]){
for(int sil=0; sil<n; sil++){
if(l&(1<<sil)){
for(int x=0; x<n; x++){
mp[l][sil] = min(mp[l][sil], mp[l^(1<<sil)][x]+(max(0, t[x]-s[sil])));
}
}
if(b[i].size()==1){
ans=min(ans, mp[l][sil]);
}
}
}
}
return ans;
}/*
int main() {
f();
int n;
assert(1 == scanf("%d", &n));
std::vector<int> s(n), t(n);
for (int i = 0; i < n; ++i)
assert(2 == scanf("%d%d", &s[i], &t[i]));
long long ans = plan_roller_coaster(s, t);
printf("%lld\n", ans);
return 0;
}*/
컴파일 시 표준 에러 (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... |