이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |