-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC.kt
37 lines (32 loc) · 884 Bytes
/
C.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
36
37
fun main() {
val input = System.`in`.bufferedReader()
val output = StringBuilder()
val t = input.readLine()!!.toInt()
repeat(t) {
var n = input.readLine()!!.toInt()
var ans = -1
for(i in 0..6) {
var a = mutableListOf<Int>(); var b = mutableListOf<Int>()
for(v in 1..n) {
if((v and (1 shl i)) != 0) {
a.add(v)
} else {
b.add(v)
}
}
if(a.isEmpty() || b.isEmpty()) {
break
}
print("${a.size} ${b.size}")
for(i in a) {
print(" $i")
}
for(i in b) {
print(" $i")
}
println()
ans = maxOf(ans, input.readLine()!!.toInt())
}
println("-1 $ans")
}
}