-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP18868.kt
35 lines (34 loc) · 965 Bytes
/
P18868.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.*
fun main() {
val list: MutableList<String> = ArrayList()
val (m, n) = readLine()!!.split(" ").map { it.toInt() }
repeat(m) {
val input = readLine()!!.trim().split(" ").map { it.toInt() }
val compare = StringBuilder()
for (i in 0 until n - 1) {
for (j in i + 1 until n) {
compare.append(when {
input[i] > input[j] -> {
">"
}
input[i] == input[j] -> {
"="
}
input[i] < input[j] -> {
"<"
}
else -> ""
})
}
}
list.add(compare.toString())
}
var count = 0
for (i in 0 until m - 1) {
for (j in i + 1 until m) {
if (list[i] != list[j]) continue
count++
}
}
println(count)
}