結果

問題 No.5002 stick xor
ユーザー letrangerjpletrangerjp
提出日時 2018-05-26 01:44:12
言語 Ruby
(3.3.0)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 830 bytes
コンパイル時間 1,839 ms
実行使用メモリ 4,440 KB
スコア 283
最終ジャッジ日時 2018-05-26 01:44:17
ジャッジサーバーID
(参考情報)
judge7 /
純コード判定しない問題か言語
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
4,428 KB
testcase_01 AC 27 ms
4,432 KB
testcase_02 AC 26 ms
4,436 KB
testcase_03 AC 27 ms
4,412 KB
testcase_04 AC 19 ms
4,432 KB
testcase_05 AC 24 ms
4,408 KB
testcase_06 AC 30 ms
4,440 KB
testcase_07 AC 20 ms
4,424 KB
testcase_08 AC 19 ms
4,436 KB
testcase_09 AC 18 ms
4,432 KB
testcase_10 AC 18 ms
4,428 KB
testcase_11 AC 18 ms
4,436 KB
testcase_12 AC 19 ms
4,440 KB
testcase_13 AC 18 ms
4,412 KB
testcase_14 AC 19 ms
4,432 KB
testcase_15 AC 18 ms
4,432 KB
testcase_16 AC 20 ms
4,440 KB
testcase_17 AC 18 ms
4,412 KB
testcase_18 AC 22 ms
4,432 KB
testcase_19 AC 19 ms
4,428 KB
testcase_20 AC 20 ms
4,440 KB
testcase_21 AC 18 ms
4,432 KB
testcase_22 AC 18 ms
4,408 KB
testcase_23 AC 18 ms
4,428 KB
testcase_24 AC 19 ms
4,424 KB
testcase_25 AC 19 ms
4,436 KB
testcase_26 AC 20 ms
4,428 KB
testcase_27 AC 18 ms
4,424 KB
testcase_28 AC 18 ms
4,428 KB
testcase_29 AC 18 ms
4,408 KB
testcase_30 AC 19 ms
4,428 KB
testcase_31 AC 19 ms
4,408 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map &:to_i
L = gets.split.map &:to_i
board = $<.map{|s|
  s.chomp.chars
}
rows = board.map{|a|
  (a*"").to_i 2
}
cols = board.transpose.map{|a|
  (a*"").to_i 2
}

def count_white(a)
  a.map{|b|
    ("%b"%b).count ?0
  }.sum
end
FirstScore = count_white(rows)
def calc_score(a)
  count_white(a) - FirstScore
end

L.each{|l|
  n = 1
  (l - 1).times{ n = (n << 1) | 1  }
  start = rand(1..N-l+1)
  n << (N - start)
  horizonalp = rand(2) > 0
  idx = rand(N)
  m = 1 << (N - idx - 1)
  if horizonalp
    rows[idx] ^= n
    cols.map!{|a| a ^= m }
  else
    cols[idx] ^= n
    rows.map!{|a| a ^= m }
  end

  a = b = c = d = 0
  if horizonalp
    a = c = idx + 1
    b = start
    d = start + l - 1
  else
    b = d = idx + 1
    a = start
    c = start + l - 1
  end
  puts [a, b, c, d] * " "
}
# p calc_score(rows)
0