📍 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
사실 이걸 어케풀지?? 하다가 그냥 해본건데 맞았다 ㅎㅎ
'Algorithm > Boj' 카테고리의 다른 글
[JAVA | 백준] #5337 웰컴 🤗 (0) | 2024.08.06 |
---|---|
[JAVA | 백준] #9159 What is the air speed velocity... 🌬️ (0) | 2024.07.29 |
[JAVA | 백준] #31561 시계탑 ⏰ (0) | 2024.07.29 |
[JAVA | 백준] #18821 홀수와 짝수의 대결 (0) | 2024.07.16 |
[JAVA | 백준] #14710 고장난 시계 😑⏰ (1) | 2024.07.16 |