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 "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);
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 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... |