백준 7568

CJB_ny·2022년 11월 3일
0

백준

목록 보기
2/104
post-thumbnail

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

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct INFO
{
	unsigned int _weight;
	unsigned int _height;
};

int main()
{
	int count = 0;
	int level = 1;

	std::vector<INFO> vecInfo = {};

	std::cin >> count;
	
	for (int i = 0; i < count; ++i)
	{
		INFO info = {};
		std::cin >> info._weight >> info._height;
		vecInfo.emplace_back(info);
	}

	for (int i = 0; i < vecInfo.size(); ++i)
	{	
		for (int j = 0; j < vecInfo.size(); ++j)
		{
			if (i == j)
				continue;

			if (vecInfo[i]._height < vecInfo[j]._height && vecInfo[i]._weight < vecInfo[j]._weight)
				++level;
		}
		std::cout << level << ' ';
		level = 1;
	}
	
	return 0;
}

후기

pair라는 것을 알았다면은 구조체를 사용안해도 되었을 거 같다.

profile
https://cjbworld.tistory.com/ <- 이사중

0개의 댓글