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;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
134 ms |
12140 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
136 ms |
11732 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
138 ms |
12096 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
130 ms |
11796 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
146 ms |
12024 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |