# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
390137 | KoD | Space Pirate (JOI14_space_pirate) | C++17 | 1771 ms | 106200 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
template <class T>
using Vec = std::vector<T>;
using ll = long long;
constexpr ll INF = std::numeric_limits<ll>::max();
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
ll K;
std::cin >> N >> K;
Vec<int> A(N);
for (auto &x: A) {
std::cin >> x;
x -= 1;
}
if (N <= 3000) {
Vec<Vec<int>> goes(N);
Vec<Vec<ll>> ord(N, Vec<ll>(N, INF));
for (int u = 0; u < N; ++u) {
goes[u].reserve(N);
ord[u][u] = 0;
goes[u].push_back(u);
while (ord[u][A[goes[u].back()]] == INF) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |