結果

問題 No.934 Explosive energy drink
ユーザー ks2mks2m
提出日時 2019-11-29 22:14:52
言語 Java19
(openjdk 21)
結果
AC  
実行時間 709 ms / 2,000 ms
コード長 840 bytes
コンパイル時間 5,025 ms
コンパイル使用メモリ 78,664 KB
実行使用メモリ 77,176 KB
平均クエリ数 709.58
最終ジャッジ日時 2023-09-23 18:40:03
合計ジャッジ時間 15,500 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
71,368 KB
testcase_01 AC 709 ms
77,116 KB
testcase_02 AC 163 ms
71,696 KB
testcase_03 AC 512 ms
76,932 KB
testcase_04 AC 684 ms
63,132 KB
testcase_05 AC 165 ms
71,832 KB
testcase_06 AC 146 ms
56,116 KB
testcase_07 AC 148 ms
55,456 KB
testcase_08 AC 148 ms
56,036 KB
testcase_09 AC 152 ms
55,624 KB
testcase_10 AC 154 ms
56,224 KB
testcase_11 AC 160 ms
55,436 KB
testcase_12 AC 172 ms
55,420 KB
testcase_13 AC 208 ms
55,536 KB
testcase_14 AC 212 ms
55,900 KB
testcase_15 AC 412 ms
61,340 KB
testcase_16 AC 266 ms
57,300 KB
testcase_17 AC 345 ms
74,944 KB
testcase_18 AC 339 ms
59,404 KB
testcase_19 AC 463 ms
61,876 KB
testcase_20 AC 558 ms
62,032 KB
testcase_21 AC 612 ms
62,648 KB
testcase_22 AC 709 ms
62,940 KB
testcase_23 AC 706 ms
77,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		boolean[] b = new boolean[n];
		int k = 0;
		for (int i = 0; i < n; i++) {
			System.out.println("? " + (n - 1));
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < n; j++) {
				if (i != j) {
					sb.append(j + 1).append(' ');
				}
			}
			sb.deleteCharAt(sb.length() - 1);
			System.out.println(sb.toString());

			int ans = sc.nextInt();
			if (ans == 0) {
				k++;
				b[i] = true;
			}
		}
		sc.close();

		System.out.println("! " + k);
		StringBuilder sb = new StringBuilder();
		for (int j = 0; j < n; j++) {
			if (b[j]) {
				sb.append(j + 1).append(' ');
			}
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
}
0