IT/알고리즘
[백준] 덩치
남갯
2024. 10. 23. 21:00
SMALL
https://www.acmicpc.net/problem/7568
class Person(val weight: Int, val height: Int)
fun main() = with(Scanner(System.`in`)) {
val count = nextInt()
val items = mutableListOf<Person>()
val results = Array<Int>(count) { 1 }
for (i in 0 until count) {
val weight = nextInt()
val height = nextInt()
items.add(Person(weight = weight, height = height))
}
for (i in 0 until items.size) {
var result = 0
for (j in 0 until items.size) {
if (items[i].weight < items[j].weight && items[i].height < items[j].height) {
result += 1
}
}
results[i] = result + 1
}
println(results.joinToString(" "))
}
LIST