# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
827583 | 2023-08-16T14:59:51 Z | caganyanmaz | Roller Coaster Railroad (IOI16_railroad) | C++14 | 76 ms | 11716 KB |
#include <bits/stdc++.h> #define mp(x...) array<int, 2>({x}) #define pb push_back #define int int64_t #include "railroad.h" using namespace std; #ifdef DEBUGGING #include "../debug.h" #else #define debug(x...) void(42) #endif long long plan_roller_coaster(vector<int32_t> s, vector<int32_t> t) { int n = s.size(); vector<array<int, 2>> vals; for (int i = 0; i < n; i++) { vals.pb({s[i], +1}); vals.pb({t[i], -1}); } sort(vals.begin(), vals.end()); int pf = vals[0][1] - 1; int res = 0; for (int i = 1; i < vals.size(); i++) { if (pf > 0) res += pf * (vals[i][0] - vals[i-1][0]); debug(pf, vals[i-1][0], vals[i][0], res); pf += vals[i][1]; } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 296 KB | n = 3 |
9 | Correct | 0 ms | 212 KB | n = 3 |
10 | Correct | 1 ms | 212 KB | n = 8 |
11 | Incorrect | 1 ms | 304 KB | answer is not correct: 187084041 instead of 189002015 |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 296 KB | n = 3 |
9 | Correct | 0 ms | 212 KB | n = 3 |
10 | Correct | 1 ms | 212 KB | n = 8 |
11 | Incorrect | 1 ms | 304 KB | answer is not correct: 187084041 instead of 189002015 |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 74 ms | 11700 KB | n = 199999 |
2 | Correct | 76 ms | 11704 KB | n = 199991 |
3 | Correct | 74 ms | 11716 KB | n = 199993 |
4 | Correct | 55 ms | 10956 KB | n = 152076 |
5 | Correct | 34 ms | 6024 KB | n = 93249 |
6 | Correct | 71 ms | 11704 KB | n = 199910 |
7 | Correct | 70 ms | 11708 KB | n = 199999 |
8 | Correct | 68 ms | 11688 KB | n = 199997 |
9 | Correct | 69 ms | 11228 KB | n = 171294 |
10 | Correct | 51 ms | 10860 KB | n = 140872 |
11 | Incorrect | 69 ms | 11684 KB | answer is not correct: 0 instead of 1 |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 296 KB | n = 3 |
9 | Correct | 0 ms | 212 KB | n = 3 |
10 | Correct | 1 ms | 212 KB | n = 8 |
11 | Incorrect | 1 ms | 304 KB | answer is not correct: 187084041 instead of 189002015 |
12 | Halted | 0 ms | 0 KB | - |