Submission #1129764

#TimeUsernameProblemLanguageResultExecution timeMemory
1129764not_amirIsland Hopping (JOI24_island)C++20
100 / 100
4 ms452 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...