結果

問題 No.452 横着者のビンゴゲーム
ユーザー t8m8⛄️t8m8⛄️
提出日時 2016-12-03 16:20:23
言語 Nim
(2.0.2)
結果
AC  
実行時間 2,985 ms / 3,000 ms
コード長 2,948 bytes
コンパイル時間 4,091 ms
コンパイル使用メモリ 69,228 KB
実行使用メモリ 7,736 KB
最終ジャッジ日時 2023-09-12 08:06:52
合計ジャッジ時間 27,533 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,528 KB
testcase_03 AC 6 ms
5,028 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 8 ms
5,032 KB
testcase_06 AC 3 ms
4,668 KB
testcase_07 AC 4 ms
5,192 KB
testcase_08 AC 5 ms
5,048 KB
testcase_09 AC 3 ms
4,736 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 5 ms
4,992 KB
testcase_12 AC 4 ms
5,188 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2,985 ms
7,736 KB
testcase_15 AC 2,899 ms
7,736 KB
testcase_16 AC 1,558 ms
6,172 KB
testcase_17 AC 157 ms
5,076 KB
testcase_18 AC 125 ms
5,092 KB
testcase_19 AC 113 ms
5,064 KB
testcase_20 AC 115 ms
5,212 KB
testcase_21 AC 330 ms
5,168 KB
testcase_22 AC 114 ms
5,068 KB
testcase_23 AC 887 ms
6,228 KB
testcase_24 AC 105 ms
5,072 KB
testcase_25 AC 51 ms
5,048 KB
testcase_26 AC 341 ms
5,220 KB
testcase_27 AC 256 ms
5,188 KB
testcase_28 AC 140 ms
5,252 KB
testcase_29 AC 104 ms
5,064 KB
testcase_30 AC 425 ms
5,116 KB
testcase_31 AC 68 ms
5,160 KB
testcase_32 AC 64 ms
5,044 KB
testcase_33 AC 190 ms
5,096 KB
testcase_34 AC 152 ms
5,180 KB
testcase_35 AC 160 ms
5,228 KB
testcase_36 AC 64 ms
5,012 KB
testcase_37 AC 77 ms
5,060 KB
testcase_38 AC 1,847 ms
6,324 KB
testcase_39 AC 1,580 ms
6,320 KB
testcase_40 AC 1,575 ms
6,240 KB
testcase_41 AC 1,566 ms
6,240 KB
testcase_42 AC 1,562 ms
6,228 KB
testcase_43 AC 1,558 ms
6,220 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(15, 11) Warning: Deprecated since v0.20, use 'initHashSet'; initSet is deprecated [Deprecated]

ソースコード

diff #

import strutils, sequtils, sets

when isMainModule:
  var
    tmp = stdin.readLine.split.map(parseInt)
    (n, m) = (tmp[0], tmp[1])
    a = newSeqWith(m, newSeqWith(n, newSeq[int](n)))

  for i in 0..m-1:
    for j in 0..n-1:
      a[i][j] = stdin.readLine.split.map(parseInt)

  var
    min = 1 shl 30
    cnt = initSet[int]()

  for i in 0..m-1:
    for j in i+1..m-1:
      # yoko * yoko
      for li in 0..n-1:
        for lj in 0..n-1:
          cnt.init
          for ci in 0..n-1:
            cnt.incl(a[i][li][ci])
          for cj in 0..n-1:
            cnt.incl(a[j][lj][cj])
          min = min(min, cnt.len)

      # tate * tate
      for ci in 0..n-1:
        for cj in 0..n-1:
          cnt.init
          for li in 0..n-1:
            cnt.incl(a[i][li][ci])
          for lj in 0..n-1:
            cnt.incl(a[j][lj][cj])
          min = min(min, cnt.len)

      # yoko * tate
      for li in 0..n-1:
        for cj in 0..n-1:
          cnt.init
          for ci in 0..n-1:
            cnt.incl(a[i][li][ci])
          for lj in 0..n-1:
            cnt.incl(a[j][lj][cj])
          min = min(min, cnt.len)

      # tate * yoko
      for ci in 0..n-1:
        for lj in 0..n-1:
          cnt.init
          for li in 0..n-1:
            cnt.incl(a[i][li][ci])
          for cj in 0..n-1:
            cnt.incl(a[j][lj][cj])
          min = min(min, cnt.len)

      # naname * naname
      for si in 0..1:
        for sj in 0..1:
          cnt.init
          for k in 0..n-1:
            if si == 0: cnt.incl(a[i][k][k])
            else: cnt.incl(a[i][k][n-k-1])
          for k in 0..n-1:
            if sj == 0: cnt.incl(a[j][k][k])
            else: cnt.incl(a[j][k][n-k-1])
          min = min(min, cnt.len)

      # yoko * naname
      for li in 0..n-1:
        for sj in 0..1:
          cnt.init
          for ci in 0..n-1:
            cnt.incl(a[i][li][ci])
          for k in 0..n-1:
            if sj == 0: cnt.incl(a[j][k][k])
            else: cnt.incl(a[j][k][n-k-1])
          min = min(min, cnt.len)

      # naname * yoko
      for si in 0..1:
        for lj in 0..n-1:
          cnt.init
          for k in 0..n-1:
            if si == 0: cnt.incl(a[i][k][k])
            else: cnt.incl(a[i][k][n-k-1])
          for cj in 0..n-1:
            cnt.incl(a[j][lj][cj])
          min = min(min, cnt.len)

      # tate * naname
      for ci in 0..n-1:
        for sj in 0..1:
          cnt.init
          for li in 0..n-1:
            cnt.incl(a[i][li][ci])
          for k in 0..n-1:
            if sj == 0: cnt.incl(a[j][k][k])
            else: cnt.incl(a[j][k][n-k-1])
          min = min(min, cnt.len)

      # naname * tate
      for si in 0..1:
        for cj in 0..n-1:
          cnt.init
          for k in 0..n-1:
            if si == 0: cnt.incl(a[i][k][k])
            else: cnt.incl(a[i][k][n-k-1])
          for lj in 0..n-1:
            cnt.incl(a[j][lj][cj])
          min = min(min, cnt.len)

  echo min - 1
0