# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
979250 | Rafi22 | Island Hopping (JOI24_island) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "island.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int N, int L){
int n=N;
vector<vector<int>>is(n+1,vector<int>(n+1,0));
for(int i=1;i<=n;i++)
{
vector<int>V;
for(int j=1;j<n;j++)
{
int k=query(i,j);
if(k>i) break;
bool ok=1;
for(auto x:V) if(is[x][k]) ok=0;
if(!ok) break;
answer(i,k);
V.pb(k);
is[i][k]=1;
is[k][i]=1;
}
}
}