結果

問題 No.1399 すごろくで世界旅行 (構築)
ユーザー simansiman
提出日時 2022-06-17 01:02:18
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 297 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 24,960 KB
最終ジャッジ日時 2024-04-16 14:56:24
合計ジャッジ時間 25,441 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 91 ms
12,160 KB
testcase_02 AC 88 ms
12,160 KB
testcase_03 AC 89 ms
12,160 KB
testcase_04 AC 89 ms
12,160 KB
testcase_05 AC 90 ms
12,160 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 91 ms
12,160 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 92 ms
12,160 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 589 ms
24,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

V, D = gets.split.map(&:to_i)

ans = Array.new(V) { Array.new(V, 0) }
V.times do |i|
  ans[i][i] = 1
  ans[i][(i + 1) % V] = 1

  cur = i
  d = D

  (V - 1).times do |j|
    cur = (cur + 1) % V
    d -= 1

    if d < 0
      ans[i][cur] = 1
      d = D - 1
    end
  end
end

puts ans.map(&:join)
0