#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll plan_roller_coaster (vector<int> S, vector<int> T){
vector<ll> s, t;
for (int x : S) s.push_back(x);
for (int x : T) t.push_back(x);
ll n = s.size();
if (n == 1) return 0;
vector<ll> all;
for (ll i=0; i<n; i++)
all.push_back(i);
ll output = 2e18;
do{
ll val = 0;
for (ll i=1; i<n; i++){
val += max(0ll, (ll)(t[i - 1] - s[i]));
}
output = min(output, val);
} while(next_permutation(all.begin(), all.end()));
return output;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
n = 2 |
2 |
Correct |
0 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
348 KB |
n = 2 |
4 |
Correct |
0 ms |
348 KB |
n = 2 |
5 |
Correct |
0 ms |
348 KB |
n = 2 |
6 |
Correct |
0 ms |
348 KB |
n = 2 |
7 |
Incorrect |
0 ms |
348 KB |
answer is not correct: 79364658 instead of 0 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
n = 2 |
2 |
Correct |
0 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
348 KB |
n = 2 |
4 |
Correct |
0 ms |
348 KB |
n = 2 |
5 |
Correct |
0 ms |
348 KB |
n = 2 |
6 |
Correct |
0 ms |
348 KB |
n = 2 |
7 |
Incorrect |
0 ms |
348 KB |
answer is not correct: 79364658 instead of 0 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2059 ms |
9808 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
n = 2 |
2 |
Correct |
0 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
348 KB |
n = 2 |
4 |
Correct |
0 ms |
348 KB |
n = 2 |
5 |
Correct |
0 ms |
348 KB |
n = 2 |
6 |
Correct |
0 ms |
348 KB |
n = 2 |
7 |
Incorrect |
0 ms |
348 KB |
answer is not correct: 79364658 instead of 0 |
8 |
Halted |
0 ms |
0 KB |
- |