TIL day 50

2025. 2. 28. 15:02·TIL

1. 코딩테스트


오늘은 유니온 파인드 관련 문제를 하나 더 풀어보았습니다.

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

더보기
#include <iostream>
using namespace std;

int n, m;
int Parent[202];
int Rank[202];
int Ans[202];

int Find(int a)
{
	if (Parent[a] == a)
		return a;
	Parent[a] = Find(Parent[a]);

	return Parent[a];
}

void Union(int a, int b)
{
	int rootA = Find(a);
	int rootB = Find(b);

	if (rootA != rootB)
	{
		//B랭크가 더 크면
		if (Rank[rootA] < Rank[rootB])
		{
			//B쪽으로 붙이기
			Parent[rootA] = rootB;
		}
		else if (Rank[rootA] > Rank[rootB])
		{
			Parent[rootB] = rootA;
		}
		else
		{
			Parent[rootA] = rootB;
			Rank[rootB]++;
		}
	}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n;
	cin >> m;

	for (int i = 1; i <= n; ++i)
	{
		Parent[i] = i;
		Rank[i] = 0;
	}

	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			int k;
			cin >> k;

			if (k == 1)
			{				
				Union(i, j);
			}
		}
	}
	int temp = -1;
	string ans = "YES";

	for (int i = 0; i < m; ++i)
	{
		int num;
		cin >> num;
		
		//처음
		if (temp == -1)
			temp = Find(num);

		if(temp != Find(num))
		{
			ans = "NO";
			break;
		}
	}
	cout << ans;	
}
  • 유니온 파인드 알고리즘을 몰랐는데, 한번 접하고 나니 재미있어서 계속 문제를 풀게 되는 것 같습니다.
  • 이 문제도 특별히 어려운 부분은 없습니다.

 

 

2. 언리얼


새벽에 이전에 정리하려고 했던 주제중 하나인 TSubclassOf 와 StaticClass에 대한 내용을 정리해 보았습니다.

https://gbleem.tistory.com/106

 

Unreal Engine - TSubclassOf & StaticClass

완벽한 정보는 아닐 수 있다. 개발하면서 겪은 시행착오를 통해 얻은 내용을 정리한 글이다. 1. TSubclassOf주로 이 타입으로 선언하는 변수는 BP를 불러올 때 사용한다. 예를 들어, UI를 만들 때 BP

gbleem.tistory.com

 

 

오늘은 aim offset 관련 구현과 줌인 효과를 주로 구현할 것입니다.

'TIL' 카테고리의 다른 글

TIL day 52  (0) 2025.03.05
TIL day 51  (0) 2025.03.05
TIL day 49  (0) 2025.02.27
TIL day 48  (0) 2025.02.26
TIL day 47  (0) 2025.02.26
'TIL' 카테고리의 다른 글
  • TIL day 52
  • TIL day 51
  • TIL day 49
  • TIL day 48
gbleem
gbleem
gbleem 님의 블로그 입니다.
  • gbleem
    gbleem 님의 블로그
    gbleem
  • 전체
    오늘
    어제
    • 분류 전체보기 (184)
      • Unreal Engine (73)
      • C++ (19)
      • 알고리즘(코딩테스트) (27)
      • TIL (60)
      • CS (4)
      • 툴 (1)
  • 블로그 메뉴

    • 홈
    • 카테고리
  • 링크

    • 과제용 깃허브
    • 깃허브
    • velog
  • 공지사항

  • 인기 글

  • 태그

    additive animation
    C++
    const
    cin함수
    템플릿
    motion matching
    상속
    gamestate
    매크로 지정자
    BFS
    DP
    blend pose
    map을 vector로 복사
    싱글턴
    applydamage
    addonscreendebugmessage
    character animation
    enhanced input system
    Vector
    actor 클래스
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
gbleem
TIL day 50
상단으로

티스토리툴바