제출 #982109

#제출 시각아이디문제언어결과실행 시간메모리
982109someoneIsland Hopping (JOI24_island)C++17
57 / 100
7 ms1484 KiB
#include "island.h" #include <iostream> using namespace std; const int M = 342; int par[M], n; bool adj[M][M], reported[M][M], found[M]; int F(int i) { if(par[i] == i) return i; return par[i] = F(par[i]); } void U(int a, int b) { par[F(a)] = F(b); } void add(int x, int y) { U(x, y); adj[x][y] = adj[y][x] = true; if(!reported[x][y]) { answer(x, y); reported[x][y] = reported[y][x] = true; } } void solve(int n, int l) { for(int i = 1; i <= n; i++) par[i] = i; for(int i = 2; i <= n; i++) { int k = 1, nxt = query(i, k); while(k < n && nxt < i && F(i) != F(nxt)) { add(i, nxt); k++; nxt = query(i, k); } } }
#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...