Submission #307622

# Submission time Handle Problem Language Result Execution time Memory
307622 2020-09-28T20:33:20 Z Celloboy Carnival (CEOI14_carnival) Java 11
100 / 100
429 ms 21756 KB
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 208 ms 14756 KB Output is correct
2 Correct 332 ms 19336 KB Output is correct
3 Correct 322 ms 19248 KB Output is correct
4 Correct 226 ms 15928 KB Output is correct
5 Correct 201 ms 15784 KB Output is correct
6 Correct 219 ms 14480 KB Output is correct
7 Correct 330 ms 19420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 272 ms 17964 KB Output is correct
2 Correct 369 ms 19936 KB Output is correct
3 Correct 241 ms 16436 KB Output is correct
4 Correct 254 ms 17296 KB Output is correct
5 Correct 227 ms 16812 KB Output is correct
6 Correct 176 ms 13308 KB Output is correct
7 Correct 252 ms 16980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 167 ms 12816 KB Output is correct
2 Correct 266 ms 17584 KB Output is correct
3 Correct 429 ms 19648 KB Output is correct
4 Correct 240 ms 17136 KB Output is correct
5 Correct 269 ms 16732 KB Output is correct
6 Correct 231 ms 16428 KB Output is correct
7 Correct 372 ms 19264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 284 ms 16688 KB Output is correct
2 Correct 289 ms 20160 KB Output is correct
3 Correct 359 ms 19764 KB Output is correct
4 Correct 261 ms 18580 KB Output is correct
5 Correct 176 ms 13716 KB Output is correct
6 Correct 207 ms 15804 KB Output is correct
7 Correct 326 ms 17260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 248 ms 14928 KB Output is correct
2 Correct 344 ms 19204 KB Output is correct
3 Correct 391 ms 19504 KB Output is correct
4 Correct 403 ms 19548 KB Output is correct
5 Correct 289 ms 17036 KB Output is correct
6 Correct 210 ms 15248 KB Output is correct
7 Correct 325 ms 21756 KB Output is correct