제출 #1345444

#제출 시각아이디문제언어결과실행 시간메모리
1345444SpyrosAlivIsland Hopping (JOI24_island)C++20
0 / 100
0 ms412 KiB
#include "island.h"
#include <bits/stdc++.h>
using namespace std;

int n;
vector<bool> done;

void dfs(int node) {
  int nxt = query(node, 1);
  if (done[nxt]) {
    nxt = query(node, 2);
    if (done[nxt]) return;
  }
  answer(node, nxt);
  dfs(nxt);
}

void solve(int N, int L) {
  n = N;
  vector<int> ch = {query(1, 1), query(1, 2), query(1, 3)};
  done.assign(n+1, false);
  done[1] = true;
  for (auto nxt: ch) done[nxt] = true;
  for (auto nxt: ch) answer(1, nxt);
  for (auto nxt: ch) dfs(nxt);
}
#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...