import java.util.*;
import java.io.*;
public class carnival
{
public static void main(String[] args) throws FileNotFoundException
{
// Scanner in = new Scanner(new File("carnival.in"));
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] result = new int[n + 1];
ArrayList<Integer> list = new ArrayList<>();
list.add(0);
list.add(1);
int total = 1;
result[1] = total;
for(int i = 2; i <= n; i++)
{
String s = "" + (total + 1);
for(int j = 1; j <= total; j++)
s += " " + list.get(j);
System.out.println(s + " " + i);
int current = in.nextInt();
if(current > total)
{
list.add(i);
total++;
result[i] = total;
}
else
{
int a = 1;
int b = total;
while(current != 1)
{
int mid = (a + b) / 2;
s = "" + (mid - a + 2);
for(int j = a; j <= mid; j++)
s += " " + list.get(j);
System.out.println(s + " " + i);
current = in.nextInt();
int colors = mid - a + 1;
if(current > colors)
a = mid + 1;
else
b = mid;
}
result[i] = a;
}
}
in.close();
System.out.print("0 ");
for(int i = 1; i <= n; i++)
{
// PrintWriter out = new PrintWriter(new File("carnival.out"));
System.out.print(result[i] + " ");
System.out.flush();
// out.println(result);
// out.close();
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
462 ms |
15708 KB |
Output is correct |
2 |
Correct |
492 ms |
15000 KB |
Output is correct |
3 |
Correct |
455 ms |
14804 KB |
Output is correct |
4 |
Correct |
422 ms |
14984 KB |
Output is correct |
5 |
Correct |
385 ms |
14684 KB |
Output is correct |
6 |
Correct |
339 ms |
14528 KB |
Output is correct |
7 |
Correct |
476 ms |
14888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
416 ms |
14520 KB |
Output is correct |
2 |
Correct |
505 ms |
14832 KB |
Output is correct |
3 |
Correct |
415 ms |
14548 KB |
Output is correct |
4 |
Correct |
476 ms |
15060 KB |
Output is correct |
5 |
Correct |
444 ms |
14512 KB |
Output is correct |
6 |
Correct |
419 ms |
14532 KB |
Output is correct |
7 |
Correct |
459 ms |
15036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
308 ms |
14596 KB |
Output is correct |
2 |
Correct |
427 ms |
14776 KB |
Output is correct |
3 |
Correct |
550 ms |
15248 KB |
Output is correct |
4 |
Correct |
462 ms |
15272 KB |
Output is correct |
5 |
Correct |
461 ms |
14920 KB |
Output is correct |
6 |
Correct |
466 ms |
14992 KB |
Output is correct |
7 |
Correct |
499 ms |
14812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
393 ms |
14548 KB |
Output is correct |
2 |
Correct |
421 ms |
14688 KB |
Output is correct |
3 |
Correct |
491 ms |
14904 KB |
Output is correct |
4 |
Correct |
463 ms |
14980 KB |
Output is correct |
5 |
Correct |
498 ms |
15272 KB |
Output is correct |
6 |
Correct |
489 ms |
14916 KB |
Output is correct |
7 |
Correct |
504 ms |
14912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
365 ms |
14548 KB |
Output is correct |
2 |
Correct |
489 ms |
15020 KB |
Output is correct |
3 |
Correct |
515 ms |
15288 KB |
Output is correct |
4 |
Correct |
518 ms |
15260 KB |
Output is correct |
5 |
Correct |
488 ms |
15000 KB |
Output is correct |
6 |
Correct |
460 ms |
14916 KB |
Output is correct |
7 |
Correct |
467 ms |
15248 KB |
Output is correct |