제출 #1196486

#제출 시각아이디문제언어결과실행 시간메모리
1196486prideliqueeeIsland Hopping (JOI24_island)C++20
100 / 100
2 ms412 KiB
#include<bits/stdc++.h>
#include "island.h"
using namespace std;
int p[310];
int root(int u)
{
    if(p[u]==u)
    return u;
    return p[u]=root(p[u]);
}
void solve(int N, int L) 
{
    for(int i=1;i<=N;i++)
    p[i]=i;
    for(int i=1;i<N;i++)
    {
        int u=query(1,i);
        if(root(u)==root(1))
        continue;
        int now=1;
        while(1)
        {
            int v=query(u,now);
            p[root(u)]=root(v);
            answer(v,u);
            now++;
            if(root(1)==root(u))
            break;
        }
    }
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…