답안 #329384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
329384 2020-11-21T00:27:09 Z Swab 사육제 (CEOI14_carnival) Java 11
0 / 100
174 ms 12624 KB
import java.util.Scanner;

class Main {

	public static int[] top;
	public static Scanner scanner;
	public static void main(String[] args) {
		
		//scanner = new Scanner(System.in);
		//int n = scanner.nextInt();
		//top = new int[n];
		//int[] ans = new int[n];
		//int c = 0;
		//int count = 1;
		/*for(int i=0; i<n; i++) {
			System.out.print((i+1)+" ");
			for(int j=0; j<=i; j++) {
				System.out.print((j+1)+" ");
			}
			System.out.println();
			
			int tc = scanner.nextInt();
			
			if(tc>c) {
				c = tc;
				ans[i] = count;
				count++;
				top[tc-1] = i+1;
			}
			else {
				
				int a = 0;
				int b = c;
				
				while(a!=b) {
					int mid = (a+b/2);
					boolean num = works(mid, i);
					if(num) {
						b = mid;
					}
					else {
						a = mid+1;
					}
					//System.out.println(mid+" "+num+" "+i);
				}
				//System.out.println(a+" a");
				ans[i] = ans[a];
				//System.out.println(ans[a]);
			}
			
		}
		/*System.out.print(0+" ");
		for(int i=0; i<n; i++) {
			System.out.print(ans[i]+" ");
		}
		System.out.flush();
		
		for(int i=0; i<n; i++) {
			System.out.println(1);
		}*/
	}
	
	public static boolean works(int mid, int num) {
		System.out.print(mid+1+" ");
		for(int i=0; i<=mid; i++) {
			System.out.print((i+1)+" ");
		}
		System.out.println((num+1) + " ");
		
		int c = scanner.nextInt();
		
		return c==(mid+1);
		
	}

}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 163 ms 12376 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 162 ms 12424 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 166 ms 12340 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 163 ms 12376 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 174 ms 12624 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -