結果

問題 No.282 おもりと天秤(2)
ユーザー uwiuwi
提出日時 2015-09-19 02:19:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 2,186 ms / 5,000 ms
コード長 1,727 bytes
コンパイル時間 9,092 ms
コンパイル使用メモリ 80,908 KB
実行使用メモリ 84,760 KB
平均クエリ数 158.21
最終ジャッジ日時 2023-09-23 21:40:35
合計ジャッジ時間 27,596 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
71,724 KB
testcase_01 AC 185 ms
69,232 KB
testcase_02 AC 182 ms
70,324 KB
testcase_03 AC 172 ms
69,292 KB
testcase_04 AC 169 ms
69,728 KB
testcase_05 AC 171 ms
70,932 KB
testcase_06 AC 182 ms
72,212 KB
testcase_07 AC 171 ms
70,164 KB
testcase_08 AC 181 ms
72,248 KB
testcase_09 AC 151 ms
70,484 KB
testcase_10 AC 662 ms
77,112 KB
testcase_11 AC 1,972 ms
81,664 KB
testcase_12 AC 732 ms
74,464 KB
testcase_13 AC 1,049 ms
75,860 KB
testcase_14 AC 1,658 ms
82,244 KB
testcase_15 AC 2,007 ms
82,092 KB
testcase_16 AC 266 ms
74,104 KB
testcase_17 AC 972 ms
75,556 KB
testcase_18 AC 1,499 ms
80,988 KB
testcase_19 AC 1,581 ms
77,580 KB
testcase_20 AC 2,164 ms
83,796 KB
testcase_21 AC 2,186 ms
83,616 KB
testcase_22 AC 2,157 ms
84,760 KB
testcase_23 AC 133 ms
54,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package contest;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Q721 {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static void solve()
	{
		int n = ni();
		in.nextLine();
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = i+1;
		for(int i = 0;i < n;i++){
			if(i % 2 == 0){
				out.print("?");
				for(int j = 0;j < n/2*2;j++){
					out.print(" " + a[j]);
				}
				for(int j = n/2*2;j < 2*n;j++){
					out.print(" " + 0);
				}
				out.println();
				out.flush();
				
				char[] s = in.nextLine().trim().toCharArray();
				for(int j = 0;j < n/2;j++){
					if(s[2*j] == '>'){
						int d = a[2*j]; a[2*j] = a[2*j+1]; a[2*j+1] = d;
					}
				}
			}else{
				out.print("?");
				for(int j = 1;j < 1+(n-1)/2*2;j++){
					out.print(" " + a[j]);
				}
				for(int j = (n-1)/2*2;j < 2*n;j++){
					out.print(" " + 0);
				}
				out.println();
				out.flush();
				
				char[] s = in.nextLine().trim().toCharArray();
				for(int j = 0;j < (n-1)/2;j++){
					if(s[2*j] == '>'){
						int d = a[2*j+1]; a[2*j+1] = a[2*j+2]; a[2*j+2] = d;
					}
				}
			}
		}
		out.print("!");
		for(int j = 0;j < n;j++){
			out.print(" " + a[j]);
		}
		out.println();
		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