백준 7568

Oak_Cassia·2022년 4월 7일
0

백준 7568

#include<iostream>
#include<vector>
struct Man
{
	int height;
	int weight;
	int lank=1;
	Man(int a, int b): height(a), weight(b){}
};

int main()
{
	std::vector<Man> result;
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++) //입력 받기
	{
		int a, b;
		std::cin >> a >> b;
		result.push_back(Man(a, b));
	}

	
	
	for (int i = 0; i<n;i++)
	{
		int lanIndex = i;				//하나의 객체와 전체 비교
		
		for (int j = 0; j < n; j++)		//전부다 작으면 lank++
		{
			if (result[j].height < result[lanIndex].height)
			{
				if (result[j].weight < result[lanIndex].weight)
				{
					result[j].lank++;				
				}
			}
		}
	}

	for (auto& i : result)		
		std::cout << i.lank << std::endl;
}
profile
rust로 뭐할까

0개의 댓글