import java.io.*;
import java.util.*;
public class carnival
{
static Reader sc=new Reader();
static PrintWriter out=new PrintWriter((System.out));
public static void main(String args[])throws IOException
{
int n=sc.nextInt();
ArrayList<Integer> locFirstVisit = new ArrayList<Integer>();
int totalNew[] = new int[n+1];
int arr[] = new int[n+1];
int currCostNum = 0;
for(int i = 1; i <= n; i++) {
System.out.print(i+" ");
for(int j = 1; j <= i; j++) {
System.out.print(j + " ");
}
System.out.flush();
int k = sc.nextInt();
totalNew[i] = k;
if(k > totalNew[i-1]) {
currCostNum++;
arr[i] = currCostNum;
locFirstVisit.add(i);
}else {
for(int j = 0; j < locFirstVisit.size(); j++) {
System.out.println("2 " + locFirstVisit.get(j) + " " + i);
int t = sc.nextInt();
if(t == 1) {
arr[i] = j+1;
break;
}
}
}
}
System.out.print(0 + " ");
for(int i = 1; i <= n; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
}
static class Reader
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
public String next()
{
while(!st.hasMoreTokens())
{
try
{
st=new StringTokenizer(br.readLine());
}
catch(Exception e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
public int nextInt()
{
return Integer.parseInt(next());
}
public long nextLong()
{
return Long.parseLong(next());
}
public double nextDouble()
{
return Double.parseDouble(next());
}
public String nextLine()
{
try
{
return br.readLine();
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
public boolean hasNext()
{
String next=null;
try
{
next=br.readLine();
}
catch(Exception e)
{
}
if(next==null)
{
return false;
}
st=new StringTokenizer(next);
return true;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
255 ms |
15948 KB |
Output is correct |
2 |
Correct |
368 ms |
18796 KB |
Output is correct |
3 |
Correct |
334 ms |
20244 KB |
Output is correct |
4 |
Correct |
235 ms |
17516 KB |
Output is correct |
5 |
Correct |
211 ms |
15444 KB |
Output is correct |
6 |
Correct |
187 ms |
14900 KB |
Output is correct |
7 |
Correct |
320 ms |
16812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
279 ms |
18660 KB |
Output is correct |
2 |
Correct |
381 ms |
19636 KB |
Output is correct |
3 |
Correct |
324 ms |
19164 KB |
Output is correct |
4 |
Correct |
248 ms |
18664 KB |
Output is correct |
5 |
Correct |
246 ms |
16644 KB |
Output is correct |
6 |
Correct |
202 ms |
16268 KB |
Output is correct |
7 |
Correct |
292 ms |
16176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
205 ms |
14592 KB |
Output is correct |
2 |
Correct |
227 ms |
14740 KB |
Output is correct |
3 |
Correct |
416 ms |
20220 KB |
Output is correct |
4 |
Correct |
222 ms |
15736 KB |
Output is correct |
5 |
Correct |
257 ms |
14780 KB |
Output is correct |
6 |
Correct |
230 ms |
16048 KB |
Output is correct |
7 |
Correct |
373 ms |
19472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
243 ms |
17272 KB |
Output is correct |
2 |
Correct |
314 ms |
19600 KB |
Output is correct |
3 |
Correct |
353 ms |
17908 KB |
Output is correct |
4 |
Correct |
276 ms |
18112 KB |
Output is correct |
5 |
Correct |
243 ms |
17952 KB |
Output is correct |
6 |
Correct |
333 ms |
16432 KB |
Output is correct |
7 |
Correct |
370 ms |
18288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
227 ms |
16228 KB |
Output is correct |
2 |
Correct |
273 ms |
15864 KB |
Output is correct |
3 |
Correct |
372 ms |
18168 KB |
Output is correct |
4 |
Correct |
375 ms |
18008 KB |
Output is correct |
5 |
Correct |
290 ms |
17564 KB |
Output is correct |
6 |
Correct |
200 ms |
14860 KB |
Output is correct |
7 |
Correct |
267 ms |
16864 KB |
Output is correct |