Submission #1059949

#TimeUsernameProblemLanguageResultExecution timeMemory
1059949Alihan_8Island Hopping (JOI24_island)C++17
65 / 100
9 ms684 KiB
#include "island.h" #include "bits/stdc++.h" using namespace std; #define pb push_back #define all(x) x.begin(), x.end() #define ln '\n' void solve(int n, int _L){ vector <int> p, q(n + 1); for ( int i = 0; i + 1 < n; i++ ){ int x = query(1, i + 1); p.pb(x); q[x] = i; } vector <int> fa(n + 1); reverse(all(p)); for ( auto &u: p ){ if ( fa[u] ) continue; int v = -1, k = 0; while ( q[v = query(u, ++k)] > q[u] ){ fa[v] = u; } fa[u] = v; } for ( int i = 2; i <= n; i++ ){ answer(i, fa[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...