제출 #1129783

#제출 시각아이디문제언어결과실행 시간메모리
1129783origabaiIsland Hopping (JOI24_island)C++20
65 / 100
4 ms472 KiB
#include "island.h" #include<bits/stdc++.h> using namespace std; void solve(int N, int L) { bool nei[N+1][N+1]; for (int i=0;i<=N;i++){ for (int j=0;j<=N;j++){ nei[i][j]=0; } } bool finished[N+1] = {0}; for (int i=N;i>0;i--){ if (finished[i]) continue; vector<int> curr_neis; int j = 1; bool flag = true; while (flag && j < N){ int v = query(i,j); for (int x : curr_neis){ if (nei[x][v]){ flag = false; break; } } if (!flag) break; if (!finished[v]){ for (int k=1,x=i+1;x!=i;k++){ x = query(v,k); nei[x][v] = nei[v][x] = 1; } finished[v] = 1; } curr_neis.push_back(v); j++; } finished[i] = 1; } for (int i=1;i<=N;i++){ for (int j=i+1;j<=N;j++){ if (nei[i][j]) answer(i,j); } } }
#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...