Submission #789785

# Submission time Handle Problem Language Result Execution time Memory
789785 2023-07-22T03:39:54 Z Minindu206 Roller Coaster Railroad (IOI16_railroad) C++14
11 / 100
2000 ms 4172 KB
#include "railroad.h"
#include<bits/stdc++.h>
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    int n = s.size();
    long long ans = LLONG_MAX;
    vector<int> perm(s);
    iota(perm.begin(), perm.end(), 0);
    do
    {
        long long cur = 0LL;
        int st = t[perm[0]];
        // for(int i=0;i<n;i++)
        //     cout << perm[i] << " ";
        // cout << '\n';
        for(int i=1;i<n;i++)
        {
            int dis = t[perm[i - 1]] - s[perm[i]];
            cur += (dis > 0 ? dis : 0);
            // cout << (dis > 0 ? dis : 0) << " ";
        }
        // cout << '\n';
        ans = min(ans, cur);
    } while (next_permutation(perm.begin(), perm.end()));
    return ans;
}

Compilation message

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:12:13: warning: unused variable 'st' [-Wunused-variable]
   12 |         int st = t[perm[0]];
      |             ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 0 ms 212 KB n = 2
4 Correct 0 ms 212 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Correct 0 ms 212 KB n = 2
7 Correct 1 ms 212 KB n = 3
8 Correct 0 ms 212 KB n = 3
9 Correct 0 ms 212 KB n = 3
10 Correct 1 ms 212 KB n = 8
11 Correct 1 ms 212 KB n = 8
12 Correct 1 ms 304 KB n = 8
13 Correct 1 ms 212 KB n = 8
14 Correct 1 ms 212 KB n = 8
15 Correct 1 ms 212 KB n = 8
16 Correct 1 ms 212 KB n = 8
17 Correct 1 ms 212 KB n = 8
18 Correct 1 ms 212 KB n = 8
19 Correct 0 ms 212 KB n = 3
20 Correct 0 ms 212 KB n = 7
21 Correct 1 ms 256 KB n = 8
22 Correct 1 ms 212 KB n = 8
23 Correct 1 ms 212 KB n = 8
24 Correct 1 ms 300 KB n = 8
25 Correct 2 ms 212 KB n = 8
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 0 ms 212 KB n = 2
4 Correct 0 ms 212 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Correct 0 ms 212 KB n = 2
7 Correct 1 ms 212 KB n = 3
8 Correct 0 ms 212 KB n = 3
9 Correct 0 ms 212 KB n = 3
10 Correct 1 ms 212 KB n = 8
11 Correct 1 ms 212 KB n = 8
12 Correct 1 ms 304 KB n = 8
13 Correct 1 ms 212 KB n = 8
14 Correct 1 ms 212 KB n = 8
15 Correct 1 ms 212 KB n = 8
16 Correct 1 ms 212 KB n = 8
17 Correct 1 ms 212 KB n = 8
18 Correct 1 ms 212 KB n = 8
19 Correct 0 ms 212 KB n = 3
20 Correct 0 ms 212 KB n = 7
21 Correct 1 ms 256 KB n = 8
22 Correct 1 ms 212 KB n = 8
23 Correct 1 ms 212 KB n = 8
24 Correct 1 ms 300 KB n = 8
25 Correct 2 ms 212 KB n = 8
26 Correct 1 ms 212 KB n = 8
27 Correct 1 ms 212 KB n = 8
28 Correct 1 ms 300 KB n = 8
29 Execution timed out 2067 ms 212 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2064 ms 4172 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 0 ms 212 KB n = 2
4 Correct 0 ms 212 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Correct 0 ms 212 KB n = 2
7 Correct 1 ms 212 KB n = 3
8 Correct 0 ms 212 KB n = 3
9 Correct 0 ms 212 KB n = 3
10 Correct 1 ms 212 KB n = 8
11 Correct 1 ms 212 KB n = 8
12 Correct 1 ms 304 KB n = 8
13 Correct 1 ms 212 KB n = 8
14 Correct 1 ms 212 KB n = 8
15 Correct 1 ms 212 KB n = 8
16 Correct 1 ms 212 KB n = 8
17 Correct 1 ms 212 KB n = 8
18 Correct 1 ms 212 KB n = 8
19 Correct 0 ms 212 KB n = 3
20 Correct 0 ms 212 KB n = 7
21 Correct 1 ms 256 KB n = 8
22 Correct 1 ms 212 KB n = 8
23 Correct 1 ms 212 KB n = 8
24 Correct 1 ms 300 KB n = 8
25 Correct 2 ms 212 KB n = 8
26 Correct 1 ms 212 KB n = 8
27 Correct 1 ms 212 KB n = 8
28 Correct 1 ms 300 KB n = 8
29 Execution timed out 2067 ms 212 KB Time limit exceeded
30 Halted 0 ms 0 KB -