알고리즘/백준
[백준] 7568번 덩치
혬혬
2019. 12. 31. 17:05
728x90
전체탐색으로 풀면 된다.
#include<stdio.h>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
int main(void) {
freopen("inp.inp", "r", stdin);
freopen("out.out", "w", stdout);
int n = 0;
scanf("%d", &n);
int list[55][2] = { 0 };
for (int i = 0; i < n; i++) {
scanf("%d %d", &list[i][0], &list[i][1]);
}
for (int i = 0; i < n; i++) {
int count = 1;
for (int j = 0; j < n; j++) {
if (i == j)
continue;
if (list[i][0] < list[j][0] && list[i][1] < list[j][1])
count++;
}
printf("%d ", count);
}
return 0;
}
https://www.acmicpc.net/problem/7568
728x90