#include "island.h"
#include <bits/stdc++.h>
using namespace std;
int Q(int v, int k) {
static map<pair<int, int>, int> mp;
if (mp.count({v, k}))
return mp[{v, k}];
return mp[{v, k}] = query(v, k);
}
void solve(int N, int L) {
vector<int> order;
for (int k = 1; k < N; k++)
order.push_back(Q(1, k));
vector p(N + 1, -1);
p[1] = 1;
for (int v : order) {
for (int k = 1; p[v] == -1; k++) {
int u = Q(v, k);
if (p[u] == -1) p[u] = v;
else p[v] = u;
}
}
for (int i = 2; i <= N; i++)
answer(i, p[i]);
}
# | 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... |
# | 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... |