# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
915053 | 2024-01-23T08:58:49 Z | vjudge1 | Roller Coaster Railroad (IOI16_railroad) | C++17 | 53 ms | 8392 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 = (int)s.size(); vector<int> good, bad; for (int i = 0; i < n; i++) { if (s[i] >= t[i]) { good.push_back(i); } else { bad.push_back(i); } } sort(good.begin(), good.end(), [&](int i, int j) { return s[i] == s[j] ? t[i] < t[j] : s[i] < s[j]; }); sort(bad.begin(), bad.end(), [&](int i, int j) { return t[i] == t[j] ? s[i] < s[j] : t[i] < t[j]; }); int j = 0; int last_t = 1; for (int i = 0; i < good.size(); i++) { while (j < bad.size() && last_t <= s[bad[j]] && t[bad[j]] <= s[good[i]]) { last_t = t[bad[j]]; j++; } last_t = t[good[i]]; } while (j < bad.size() && last_t <= s[bad[j]]) { last_t = t[bad[j]]; j++; } return j == bad.size() ? 0 : 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | n = 2 |
2 | Correct | 0 ms | 344 KB | n = 2 |
3 | Correct | 1 ms | 348 KB | n = 2 |
4 | Correct | 0 ms | 348 KB | n = 2 |
5 | Correct | 0 ms | 348 KB | n = 2 |
6 | Incorrect | 1 ms | 348 KB | answer is not correct: 1 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | n = 2 |
2 | Correct | 0 ms | 344 KB | n = 2 |
3 | Correct | 1 ms | 348 KB | n = 2 |
4 | Correct | 0 ms | 348 KB | n = 2 |
5 | Correct | 0 ms | 348 KB | n = 2 |
6 | Incorrect | 1 ms | 348 KB | answer is not correct: 1 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 4692 KB | n = 199999 |
2 | Correct | 52 ms | 4492 KB | n = 199991 |
3 | Correct | 53 ms | 8392 KB | n = 199993 |
4 | Incorrect | 39 ms | 6096 KB | answer is not correct: 1 instead of 0 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | n = 2 |
2 | Correct | 0 ms | 344 KB | n = 2 |
3 | Correct | 1 ms | 348 KB | n = 2 |
4 | Correct | 0 ms | 348 KB | n = 2 |
5 | Correct | 0 ms | 348 KB | n = 2 |
6 | Incorrect | 1 ms | 348 KB | answer is not correct: 1 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |