답안 #512985

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
512985 2022-01-16T20:46:45 Z williamli 사육제 (CEOI14_carnival) Java 11
100 / 100
300 ms 13524 KB
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class carnival {
	static BufferedReader br;
	static int n;
	public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
		n = Integer.parseInt(br.readLine());
		int[] ans = new int[n + 1], start = new int[n + 1];
		ans[1] = 1;
		start[1] = 1;
		int numg = 1, prev = 1;
		StringBuilder initq = new StringBuilder("1");
		for(int i = 2;i <= n;i++){
			initq.append(" ").append(i);
			System.out.println(i + " " + initq);
			int feed = Integer.parseInt(br.readLine());
			if(feed != prev){
				numg++;
				ans[i] = numg;
				start[numg] = i;
				prev = feed;
				continue;
			}
			int a = 1, b = numg;
			while(a != b){
				int mid = (a + b)/2;
				String q = "";
				for(int j = a;j <= mid;j++) q += " " + start[j];
				q += " " + i;
				System.out.println((mid - a + 2) + q);
				int feedback = Integer.parseInt(br.readLine());
				if(feedback == mid - a + 2) a = mid + 1;
				else b = mid;
			}
			ans[i] = a;
			prev = feed;
		}
		String print = "";
		for(int i = 0;i <= n;i++) print += ans[i] + " ";
		System.out.println(print);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 270 ms 13524 KB Output is correct
2 Correct 300 ms 13212 KB Output is correct
3 Correct 254 ms 13256 KB Output is correct
4 Correct 222 ms 13072 KB Output is correct
5 Correct 262 ms 13240 KB Output is correct
6 Correct 233 ms 12980 KB Output is correct
7 Correct 262 ms 13308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 259 ms 13148 KB Output is correct
2 Correct 283 ms 13120 KB Output is correct
3 Correct 246 ms 13276 KB Output is correct
4 Correct 231 ms 13204 KB Output is correct
5 Correct 275 ms 13044 KB Output is correct
6 Correct 259 ms 13044 KB Output is correct
7 Correct 295 ms 13176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 11596 KB Output is correct
2 Correct 267 ms 13232 KB Output is correct
3 Correct 288 ms 13308 KB Output is correct
4 Correct 229 ms 12992 KB Output is correct
5 Correct 292 ms 13132 KB Output is correct
6 Correct 288 ms 13304 KB Output is correct
7 Correct 286 ms 13224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 270 ms 13136 KB Output is correct
2 Correct 252 ms 13180 KB Output is correct
3 Correct 256 ms 13152 KB Output is correct
4 Correct 246 ms 13096 KB Output is correct
5 Correct 275 ms 13124 KB Output is correct
6 Correct 270 ms 13084 KB Output is correct
7 Correct 291 ms 13340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 246 ms 13372 KB Output is correct
2 Correct 291 ms 13088 KB Output is correct
3 Correct 267 ms 13040 KB Output is correct
4 Correct 298 ms 13128 KB Output is correct
5 Correct 258 ms 13108 KB Output is correct
6 Correct 253 ms 13356 KB Output is correct
7 Correct 242 ms 13096 KB Output is correct