Submission #999017

# Submission time Handle Problem Language Result Execution time Memory
999017 2024-06-15T05:05:43 Z 변재우(#10896) Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
38 ms 10588 KB
#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

const int N=16;
int n, ans=INT_MAX, s[N], t[N], d[1<<N][N];
bool chk[1<<N][N];

int f(int mask, int curr) {
    if(mask==(1<<n)-1) return 0;
    if(chk[mask][curr]) return d[mask][curr];
    chk[mask][curr]=true, d[mask][curr]=INT_MAX;
    for(int i=0; i<n; i++) if(!(mask&(1<<i))) {
        d[mask][curr]=min(d[mask][curr], f(mask|(1<<i), i)+max(0, t[curr]-s[i]));
    }
    return d[mask][curr];
}

ll plan_roller_coaster(vector<int> s_, vector<int> t_) {
    n=s_.size();
    for(int i=0; i<n; i++) s[i]=s_[i], t[i]=t_[i];
    for(int i=0; i<n; i++) ans=min(ans, f(1<<i, i));
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB n = 2
2 Correct 0 ms 2396 KB n = 2
3 Correct 1 ms 2652 KB n = 2
4 Correct 0 ms 2396 KB n = 2
5 Correct 1 ms 2396 KB n = 2
6 Correct 1 ms 2392 KB n = 2
7 Correct 1 ms 2392 KB n = 3
8 Correct 1 ms 2496 KB n = 3
9 Correct 0 ms 2396 KB n = 3
10 Correct 1 ms 2396 KB n = 8
11 Correct 0 ms 2396 KB n = 8
12 Incorrect 1 ms 2396 KB answer is not correct: -1568493664 instead of 2726473632
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB n = 2
2 Correct 0 ms 2396 KB n = 2
3 Correct 1 ms 2652 KB n = 2
4 Correct 0 ms 2396 KB n = 2
5 Correct 1 ms 2396 KB n = 2
6 Correct 1 ms 2392 KB n = 2
7 Correct 1 ms 2392 KB n = 3
8 Correct 1 ms 2496 KB n = 3
9 Correct 0 ms 2396 KB n = 3
10 Correct 1 ms 2396 KB n = 8
11 Correct 0 ms 2396 KB n = 8
12 Incorrect 1 ms 2396 KB answer is not correct: -1568493664 instead of 2726473632
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 10588 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB n = 2
2 Correct 0 ms 2396 KB n = 2
3 Correct 1 ms 2652 KB n = 2
4 Correct 0 ms 2396 KB n = 2
5 Correct 1 ms 2396 KB n = 2
6 Correct 1 ms 2392 KB n = 2
7 Correct 1 ms 2392 KB n = 3
8 Correct 1 ms 2496 KB n = 3
9 Correct 0 ms 2396 KB n = 3
10 Correct 1 ms 2396 KB n = 8
11 Correct 0 ms 2396 KB n = 8
12 Incorrect 1 ms 2396 KB answer is not correct: -1568493664 instead of 2726473632
13 Halted 0 ms 0 KB -