Submission #1203779

#TimeUsernameProblemLanguageResultExecution timeMemory
1203779LucaIlieIsland Hopping (JOI24_island)C++20
65 / 100
3 ms412 KiB
#include "island.h"
#include <bits/stdc++.h>

const int MAX_N = 300;
int depth[MAX_N + 1];
bool isCand[MAX_N + 1];

using namespace std;

void solve(int n, int l) {
    int root = 1;

    depth[root] = 0;
    queue<int> cand;
    cand.push(root);
    isCand[root] = true;
    for (int i = 1; i <= n - 1; i++) {
        int v = query(root, i);
        int j = 1;
        int p = query(v, j);
        while (!isCand[p]) {
            j++;
            p = query(v, j);
        }

        answer(p, v);
        depth[v] = depth[p] + 1;
        cand.push(v);
        isCand[v] = true;
        while (depth[cand.front()] + 1 < depth[v]) {
            isCand[cand.front()] = false;
            cand.pop();
        }
    }
}
#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...