#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){
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 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... |