import java.util.*;
public class carnival
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
List<Integer> unique = new ArrayList<>();
List<Integer> all = new ArrayList<>();
List<Integer> notUnique = new ArrayList<>();
List<Integer> costumeNums = new ArrayList<>();
int N = sc.nextInt();
for(int i = 0; i < N; i++)
{
unique.add(i + 1);
all.add(i + 1);
System.out.print(unique.size() + " ");
for(int j = 0; j < unique.size(); j++)
{
System.out.print(unique.get(j) + " ");
}
System.out.println();
System.out.flush();
int numUnique = sc.nextInt();
if(numUnique != unique.size())
{
unique.remove(unique.size() - 1);
notUnique.add(i + 1);
}
}
for(int i = 0; i < N; i++)
{
costumeNums.add(0);
}
for(int i = 0; i < unique.size(); i++)
{
costumeNums.set(unique.get(i) - 1, i + 1);
}
for(int i = 0; i < notUnique.size(); i++)
{
int top = unique.size() - 1;
int bottom = 0;
int idx = 0;
while(top >= bottom)
{
idx = (top + bottom)/2;
List<Integer> checkList = unique.subList(bottom, idx + 1);
System.out.print((checkList.size() + 1) + " ");
for(int j = 0; j < checkList.size(); j++)
{
System.out.print(checkList.get(j) + " ");
}
System.out.println(notUnique.get(i));
System.out.flush();
int numUnique = sc.nextInt();
if(numUnique != checkList.size() + 1)
{
if(checkList.size() == 1)
{
costumeNums.set(notUnique.get(i) - 1, costumeNums.get(checkList.get(0) - 1));
break;
}
top = idx;
}
else
{
bottom = idx + 1;
if(checkList.size() == 1)
{
top = bottom + 2;
}
}
}
}
System.out.print(0 + " ");
for(int i = 0; i < N; i++)
{
System.out.print(costumeNums.get(i) + " ");
}
System.out.flush();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
311 ms |
13464 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
208 ms |
12916 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
231 ms |
12964 KB |
Output is correct |
2 |
Runtime error |
279 ms |
13024 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
210 ms |
12956 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
232 ms |
13088 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |