結果
| 問題 |
No.282 おもりと天秤(2)
|
| コンテスト | |
| ユーザー |
ぴろず
|
| 提出日時 | 2015-09-18 22:56:13 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 911 bytes |
| コンパイル時間 | 2,648 ms |
| コンパイル使用メモリ | 89,284 KB |
| 実行使用メモリ | 71,740 KB |
| 平均クエリ数 | 1.00 |
| 最終ジャッジ日時 | 2024-07-16 05:50:04 |
| 合計ジャッジ時間 | 10,601 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 24 |
ソースコード
package no282;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int[][] compare;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
compare = new int[n][n];
for(int i=0;i<n;i++) {
StringBuilder sb = new StringBuilder();
sb.append('?');
for(int j=0;j<n;j++) {
sb.append(" " + (i+1) + " " + (j+1));
}
System.out.println(sb.toString());
for(int j=0;j<n;j++) {
String c = sc.next();
if (c.equals("<")) {
compare[i][j] = -1;
}else if(c.equals(">")) {
compare[i][j] = 1;
}
}
}
Integer[] ans = new Integer[n];
for(int i=0;i<n;i++) {
ans[i] = i;
}
Arrays.sort(ans,(x,y)->compare[x][y]);
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());
}
}
ぴろず