結果

問題 No.282 おもりと天秤(2)
ユーザー simansiman
提出日時 2022-01-13 04:29:51
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 291 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 31,492 KB
平均クエリ数 117.79
最終ジャッジ日時 2023-08-10 00:47:30
合計ジャッジ時間 14,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
30,600 KB
testcase_01 AC 124 ms
30,928 KB
testcase_02 AC 107 ms
31,132 KB
testcase_03 AC 104 ms
31,272 KB
testcase_04 AC 104 ms
31,396 KB
testcase_05 AC 112 ms
31,492 KB
testcase_06 AC 135 ms
31,128 KB
testcase_07 AC 105 ms
30,972 KB
testcase_08 AC 136 ms
30,924 KB
testcase_09 AC 98 ms
30,932 KB
testcase_10 AC 2,752 ms
31,112 KB
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

  res = gets.chomp.split

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

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

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