結果

問題 No.1149 色塗りゲーム
ユーザー simansiman
提出日時 2021-05-14 15:57:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 11,312 KB
実行使用メモリ 31,504 KB
平均クエリ数 19.82
最終ジャッジ日時 2023-09-24 10:33:36
合計ジャッジ時間 10,258 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
30,824 KB
testcase_01 AC 121 ms
30,736 KB
testcase_02 AC 120 ms
31,024 KB
testcase_03 AC 124 ms
31,104 KB
testcase_04 AC 120 ms
30,848 KB
testcase_05 AC 122 ms
31,272 KB
testcase_06 AC 123 ms
30,884 KB
testcase_07 AC 121 ms
31,468 KB
testcase_08 AC 121 ms
31,132 KB
testcase_09 AC 120 ms
31,024 KB
testcase_10 AC 120 ms
31,360 KB
testcase_11 AC 121 ms
30,516 KB
testcase_12 AC 122 ms
31,376 KB
testcase_13 AC 124 ms
30,632 KB
testcase_14 AC 126 ms
30,864 KB
testcase_15 AC 124 ms
30,712 KB
testcase_16 AC 125 ms
31,248 KB
testcase_17 AC 127 ms
30,808 KB
testcase_18 AC 125 ms
30,828 KB
testcase_19 AC 125 ms
31,392 KB
testcase_20 AC 124 ms
31,268 KB
testcase_21 AC 128 ms
31,068 KB
testcase_22 AC 129 ms
30,864 KB
testcase_23 AC 127 ms
31,152 KB
testcase_24 AC 127 ms
31,504 KB
testcase_25 AC 128 ms
31,112 KB
testcase_26 AC 125 ms
30,696 KB
testcase_27 AC 126 ms
31,148 KB
testcase_28 AC 128 ms
31,376 KB
testcase_29 AC 127 ms
30,680 KB
testcase_30 AC 168 ms
31,384 KB
testcase_31 AC 161 ms
31,260 KB
testcase_32 AC 161 ms
31,092 KB
testcase_33 AC 166 ms
30,876 KB
testcase_34 AC 168 ms
31,308 KB
testcase_35 AC 162 ms
30,860 KB
testcase_36 AC 170 ms
30,684 KB
testcase_37 AC 173 ms
30,872 KB
testcase_38 AC 168 ms
31,028 KB
testcase_39 AC 173 ms
30,696 KB
testcase_40 AC 179 ms
30,812 KB
testcase_41 AC 176 ms
31,264 KB
testcase_42 AC 175 ms
31,372 KB
testcase_43 AC 175 ms
31,048 KB
testcase_44 AC 185 ms
30,680 KB
testcase_45 AC 184 ms
31,072 KB
testcase_46 AC 185 ms
30,712 KB
testcase_47 AC 191 ms
31,284 KB
testcase_48 AC 192 ms
30,584 KB
testcase_49 AC 195 ms
30,596 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i

turn = 0

loop {
  if turn == 0
    case N
    when 1
      STDOUT.puts "1 1"
    when 2
      STDOUT.puts "2 1"
    else
      if N.even?
        STDOUT.puts "2 #{N / 2}"
      else
        STDOUT.puts "1 #{N / 2 + 1}"
      end
    end
  else
    k, x = gets.split.map(&:to_i)
    i = N - x + 1 - (k - 1)
    STDOUT.puts "%d %d" % [k, i]
  end

  STDOUT.flush
  t = gets.to_i
  break if t == 0 || t == 1
  turn += 1
}
0