結果

問題 No.1974 2x2 Flipper
ユーザー magurofIymagurofIy
提出日時 2022-06-11 10:24:31
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 11,908 KB
実行使用メモリ 30,124 KB
最終ジャッジ日時 2023-10-21 17:51:32
合計ジャッジ時間 11,042 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
16,088 KB
testcase_01 AC 133 ms
18,312 KB
testcase_02 AC 94 ms
16,088 KB
testcase_03 AC 360 ms
26,368 KB
testcase_04 AC 210 ms
20,420 KB
testcase_05 WA -
testcase_06 AC 284 ms
23,512 KB
testcase_07 AC 213 ms
21,792 KB
testcase_08 AC 111 ms
17,584 KB
testcase_09 AC 288 ms
23,112 KB
testcase_10 WA -
testcase_11 AC 242 ms
21,816 KB
testcase_12 AC 363 ms
25,676 KB
testcase_13 AC 252 ms
23,172 KB
testcase_14 AC 185 ms
19,672 KB
testcase_15 AC 410 ms
26,992 KB
testcase_16 WA -
testcase_17 AC 315 ms
25,220 KB
testcase_18 AC 111 ms
16,968 KB
testcase_19 AC 115 ms
17,688 KB
testcase_20 AC 207 ms
20,092 KB
testcase_21 AC 501 ms
30,124 KB
testcase_22 AC 499 ms
30,104 KB
testcase_23 AC 498 ms
29,816 KB
testcase_24 WA -
testcase_25 AC 85 ms
16,084 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

H, W = gets.split.map(&:to_i)

grid = Array.new(H) { [0] * W }

(H / 2 * 2).times do |i|
  (W / 2 * 2).times do |j|
    grid[i][j] = 1
  end
end
if H == 1 or W == 1
  puts 0
elsif H.even? or W.even?
  puts (H / 2 * 2) * (W / 2 * 2)
else
  puts (H / 2 * 2) * (W / 2 * 2) + 2
  (H - 2 ... H).each do |i|
    (W - 2 ... W).each do |j|
      grid[i][j] ^= 1
    end
  end
end

puts grid.map { |row| row * " " }
0