結果

問題 No.282 おもりと天秤(2)
ユーザー ぴろずぴろず
提出日時 2015-09-18 23:04:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 3,806 ms
コンパイル使用メモリ 87,904 KB
実行使用メモリ 59,144 KB
平均クエリ数 33.50
最終ジャッジ日時 2023-09-23 05:56:36
合計ジャッジ時間 15,657 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 172 ms
56,108 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package no282;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Integer[] ans = new Integer[n];
		for(int i=0;i<n;i++) {
			ans[i] = i;
		}
		Arrays.sort(ans,(x,y)->{
			StringBuilder sb = new StringBuilder();
			sb.append("? " + (x+1) + " " + (y+1));
			for(int i=0;i<n-1;i++) {
				sb.append(" 0 0");
			}
			System.out.println(sb.toString());
			char c = sc.next().charAt(0);
			if (c == '<') {
				return -1;
			}else if(c == '>') {
				return 1;
			}
			return 0;
		});
		StringBuilder sb= new StringBuilder();
		sb.append('!');
		for(int i=0;i<n;i++) {
			sb.append(' ');
			sb.append(ans[i] + 1);
		}
		System.out.println(sb.toString());
	}

}
0