結果

問題 No.675 ドットちゃんたち
ユーザー yuruhiyayuruhiya
提出日時 2021-01-24 10:04:45
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 17,087 ms
コンパイル使用メモリ 255,892 KB
実行使用メモリ 27,484 KB
最終ジャッジ日時 2023-09-13 13:16:40
合計ジャッジ時間 18,882 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,452 KB
testcase_02 AC 3 ms
4,424 KB
testcase_03 AC 3 ms
4,408 KB
testcase_04 AC 2 ms
4,392 KB
testcase_05 AC 54 ms
21,520 KB
testcase_06 AC 70 ms
27,168 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

lib C
  fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64
end

class String
  def to_i64
    C.strtoll(self, nil, 10)
  end
end

n, px, py = read_line.split.map(&.to_i)
com = (1..n).map { read_line.split.map(&.to_i) }

x1, x2, y1, y2, s = 1, 0, 1, 0, false
ans = com.reverse.map do |a|
  case a[0]
  when 1
    x2 -= a[1]
  when 2
    y2 -= a[1]
  when 3
    y1 *= -1
    x1, y1 = y1, x1
    x2, y2 = y2, x2
    s = !s
  end
  x, y = px, py
  x = (x - x2) // x1
  y = (y - y2) // y1
  x, y = y, x if s
  {x, y}
end
puts ans.reverse.join('\n', &.join(' '))
0