📍 Làszlò Babai

https://www.acmicpc.net/problem/13450

 

 

 

그래프 동형이면 "yes", 아니면 "no"를 출력하면 되는 문제이다.

여기서 m은 그래프 간선 수를 뜻하는데, m이 같으면 그래프 동형이다.

 

 

 

✨ 전체코드 ✨

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();

        int T = Integer.parseInt(sc.readLine());
        for(int test_case=0; test_case<T; test_case++){
            int m1 = Integer.parseInt(sc.readLine());
            for(int i=0; i<m1; i++) sc.readLine();
            int m2 = Integer.parseInt(sc.readLine());
            for(int j=0; j<m2; j++) sc.readLine();

            String answer = (m1 == m2 ? "yes" : "no");
            sb.append(answer).append('\n');

        } System.out.println(sb);
    }
}

 

 

 

🌀 성능

  • 메모리 : 14,040 KB
  • 시간 : 124 ms

 

 

 


사실 이걸 어케풀지?? 하다가 그냥 해본건데 맞았다 ㅎㅎ