# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
720614 | 2023-04-08T16:03:09 Z | n1k | Roller Coaster Railroad (IOI16_railroad) | C++17 | 229 ms | 16708 KB |
#include <bits/stdc++.h> #define ll long long #define vt vector #define pb push_back #define ar array #define all(x) (x).begin(), (x).end() #define sz(x) (x).size() using namespace std; /* 1. simplify 2. add new elements 3. brute force solution 4. optimize 5. start implementing */ // --- templates --- // --- code --- #include "railroad.h" long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); set<ar<int, 2>> a; for(int i = 0; i < n; i++){ a.insert({t[i], s[i]}); } /* pick largest exit speed search for largest exit <= entry speed */ //auto [exit, entry] = *(--a.end()); auto arr = *(--a.end()); int exit = arr[0], entry = arr[1]; a.erase(--a.end()); while (sz(a)){ auto it = a.lower_bound({entry + 1}); if(it == a.begin()){ return 1; } it--; arr = *it; exit = arr[0], entry = arr[1]; a.erase(it); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 1 ms | 212 KB | n = 2 |
3 | Correct | 1 ms | 212 KB | n = 2 |
4 | Correct | 0 ms | 212 KB | n = 2 |
5 | Correct | 1 ms | 304 KB | n = 2 |
6 | Incorrect | 1 ms | 296 KB | answer is not correct: 1 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 1 ms | 212 KB | n = 2 |
3 | Correct | 1 ms | 212 KB | n = 2 |
4 | Correct | 0 ms | 212 KB | n = 2 |
5 | Correct | 1 ms | 304 KB | n = 2 |
6 | Incorrect | 1 ms | 296 KB | answer is not correct: 1 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 138 ms | 16656 KB | n = 199999 |
2 | Correct | 229 ms | 16708 KB | n = 199991 |
3 | Correct | 148 ms | 16648 KB | n = 199993 |
4 | Correct | 133 ms | 12360 KB | n = 152076 |
5 | Correct | 71 ms | 7816 KB | n = 93249 |
6 | Correct | 146 ms | 15436 KB | n = 199910 |
7 | Correct | 148 ms | 15980 KB | n = 199999 |
8 | Incorrect | 158 ms | 15552 KB | answer is not correct: 1 instead of 0 |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 1 ms | 212 KB | n = 2 |
3 | Correct | 1 ms | 212 KB | n = 2 |
4 | Correct | 0 ms | 212 KB | n = 2 |
5 | Correct | 1 ms | 304 KB | n = 2 |
6 | Incorrect | 1 ms | 296 KB | answer is not correct: 1 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |