結果

問題 No.355 数当てゲーム(2)
ユーザー uwiuwi
提出日時 2016-04-01 22:28:33
言語 Java19
(openjdk 21)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 1,630 bytes
コンパイル時間 3,732 ms
コンパイル使用メモリ 77,992 KB
実行使用メモリ 73,464 KB
平均クエリ数 28.12
最終ジャッジ日時 2023-09-23 09:07:29
合計ジャッジ時間 16,822 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
72,628 KB
testcase_01 AC 173 ms
72,400 KB
testcase_02 AC 190 ms
72,888 KB
testcase_03 AC 175 ms
72,984 KB
testcase_04 AC 193 ms
72,684 KB
testcase_05 AC 182 ms
72,816 KB
testcase_06 AC 187 ms
70,972 KB
testcase_07 AC 184 ms
70,576 KB
testcase_08 AC 185 ms
73,036 KB
testcase_09 AC 169 ms
72,580 KB
testcase_10 AC 174 ms
70,268 KB
testcase_11 AC 184 ms
72,460 KB
testcase_12 AC 185 ms
73,128 KB
testcase_13 AC 183 ms
72,916 KB
testcase_14 AC 178 ms
72,504 KB
testcase_15 AC 173 ms
73,004 KB
testcase_16 AC 178 ms
73,232 KB
testcase_17 AC 201 ms
73,464 KB
testcase_18 AC 190 ms
72,780 KB
testcase_19 AC 186 ms
72,744 KB
testcase_20 AC 200 ms
72,540 KB
testcase_21 AC 174 ms
72,388 KB
testcase_22 AC 185 ms
72,784 KB
testcase_23 AC 183 ms
72,632 KB
testcase_24 AC 171 ms
72,740 KB
testcase_25 AC 181 ms
72,748 KB
testcase_26 AC 177 ms
72,624 KB
testcase_27 AC 165 ms
72,832 KB
testcase_28 AC 187 ms
72,808 KB
testcase_29 AC 196 ms
72,788 KB
testcase_30 AC 183 ms
72,620 KB
testcase_31 AC 172 ms
72,296 KB
testcase_32 AC 189 ms
73,144 KB
testcase_33 AC 191 ms
72,880 KB
testcase_34 AC 174 ms
72,300 KB
testcase_35 AC 167 ms
72,276 KB
testcase_36 AC 188 ms
72,920 KB
testcase_37 AC 202 ms
72,620 KB
testcase_38 AC 183 ms
73,160 KB
testcase_39 AC 185 ms
71,332 KB
testcase_40 AC 189 ms
73,000 KB
testcase_41 AC 187 ms
72,996 KB
testcase_42 AC 183 ms
73,016 KB
testcase_43 AC 181 ms
72,988 KB
testcase_44 AC 181 ms
72,936 KB
testcase_45 AC 164 ms
73,096 KB
testcase_46 AC 190 ms
72,644 KB
testcase_47 AC 166 ms
72,596 KB
testcase_48 AC 183 ms
73,400 KB
testcase_49 AC 189 ms
73,008 KB
testcase_50 AC 191 ms
73,196 KB
testcase_51 AC 193 ms
72,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class Q701 {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static void solve()
	{
		Random gen = new Random();
		int[] none = null;
		int nno = 0;
		outer:
		while(true){
			int[] a = new int[4];
			for(int i = 0;i < 4;i++)a[i] = gen.nextInt(10);
			for(int i = 0;i < 4;i++){
				for(int j= i+1;j < 4;j++){
					if(a[i] == a[j])continue outer;
				}
			}
			out.println(a[0] + " " + a[1] + " " + a[2] + " " + a[3]);
			out.flush();
			int x = ni(), y = ni();
			if(x + y == 0){
				none = a;
				for(int i = 0;i < 4;i++){
					nno |= 1<<a[i];
				}
				break;
			}
		}
		
		int[] ret = new int[4];
		for(int i = 0;i < 4;i++){
			for(int j = 0;j < 10;j++){
				if(nno<<~j<0)continue;
				int[] b = Arrays.copyOf(none, 4);
				b[i] = j;
				out.println(b[0] + " " + b[1] + " " + b[2] + " " + b[3]);
				out.flush();
				int x = ni(), y = ni();
				if(x == 1){
					ret[i] = j;
					nno |= 1<<j;
					break;
				}
			}
		}
		
		out.println(ret[0] + " " + ret[1] + " " + ret[2] + " " + ret[3]);
		out.flush();
	}
	
	public static void main(String[] args) throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);
		
		solve();
		out.flush();
	}
	
	static int ni() { return Integer.parseInt(in.next()); }
	static long nl() { return Long.parseLong(in.next()); }
	static double nd() { return Double.parseDouble(in.next()); }
	static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}
0