結果

問題 No.282 おもりと天秤(2)
ユーザー simansiman
提出日時 2022-01-13 04:34:12
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 329 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 11,508 KB
実行使用メモリ 32,104 KB
平均クエリ数 1056.46
最終ジャッジ日時 2023-08-10 00:53:23
合計ジャッジ時間 34,354 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
31,136 KB
testcase_01 AC 135 ms
31,416 KB
testcase_02 AC 115 ms
31,296 KB
testcase_03 AC 108 ms
30,988 KB
testcase_04 AC 109 ms
31,332 KB
testcase_05 AC 124 ms
31,072 KB
testcase_06 AC 140 ms
31,168 KB
testcase_07 AC 108 ms
31,232 KB
testcase_08 AC 143 ms
31,224 KB
testcase_09 AC 101 ms
31,048 KB
testcase_10 AC 1,336 ms
30,944 KB
testcase_11 RE -
testcase_12 AC 1,519 ms
31,072 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 368 ms
31,276 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 102 ms
31,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
omori = [*1..N]

def send_query(i, j)
  query = Array.new(2 * N, 0)
  query[0] = i
  query[1] = j
  STDOUT.puts("? #{query.join(' ')}")
  STDOUT.flush

  STDERR.puts("? #{query.join(' ')}")
  res = gets.chomp.split

  res[0] == '<' ? -1 : 1
end

omori.sort! { |i, j| send_query(i, j) }

puts "! #{omori.join(' ')}"
0