結果

問題 No.282 おもりと天秤(2)
ユーザー uwiuwi
提出日時 2015-09-19 02:08:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,731 bytes
コンパイル時間 6,376 ms
コンパイル使用メモリ 81,092 KB
実行使用メモリ 82,136 KB
平均クエリ数 115.33
最終ジャッジ日時 2023-09-23 06:20:28
合計ジャッジ時間 24,020 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
71,076 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 162 ms
72,100 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-1;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+1]);
				}
				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