import java.io.*;
import java.util.*;
public class carnival {
public static Scanner fin = new Scanner(System.in);
public static void main(String[] args) {
int n = fin.nextInt();
int previousTotal = 0;
int previousNum = 0;
int[] nums = new int[n];
for (int i=0; i<n; i++) {
String s = (i+1)+"";
for (int j=0; j<=i; j++) {
s += " "+(j+1);
}
System.out.println(s);
int numCostumes = fin.nextInt();
if (numCostumes == previousTotal) {
int low = 0;
int high = i-1;
while (low < high) {
int mid = (low+high)/2;
if (works(low+1, mid+1, i+1)) {
high = mid;
}
else {
low = mid+1;
}
}
nums[i] = nums[low];
}
else {
nums[i] = ++previousNum;
}
previousTotal = numCostumes;
}
String s = "0";
for (int i=0; i<n; i++) {
s += " "+nums[i];
}
System.out.println(s);
fin.close();
}
public static boolean works(int low, int mid, int num) {
String s = (mid-low+1)+"";
for (int j=low; j<=mid; j++) {
s += " "+j;
}
System.out.println(s);
int a = fin.nextInt();
s += " "+num;
System.out.println(s);
int b = fin.nextInt();
if (a == b) {
return true;
}
return false;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
141 ms |
12368 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
128 ms |
11752 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
151 ms |
11768 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
127 ms |
12384 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
136 ms |
12028 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |