結果

問題 No.452 横着者のビンゴゲーム
ユーザー nebukuro09nebukuro09
提出日時 2016-12-03 01:16:30
言語 D
(dmd 2.106.1)
結果
TLE  
実行時間 -
コード長 1,024 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 106,876 KB
実行使用メモリ 17,248 KB
最終ジャッジ日時 2023-09-02 23:15:45
合計ジャッジ時間 5,621 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 19 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 19 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 8 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;
import std.numeric;
import std.bigint;


int N, M;

int count_diff(ref int[] A, ref int[] B) {
  bool[int] d;
  foreach (a; A) d[a] = true;
  foreach (b; B) d[b] = true;
  return d.keys.length.to!int;
}

void main() {
  auto input = readln.split.map!(to!int);
  N = input[0];
  M = input[1];
  auto B = new int[][][](M, 2*N+2, N);

  foreach (i; 0..M) {
    auto C = iota(N).map!(_ => readln.split.map!(to!int).array).array;
    foreach (j; 0..N) B[i][j] = C[j];
    foreach (j; N..2*N) foreach (k; 0..N) B[i][j][k] = C[k][j-N];
    foreach (j; 0..N) B[i][2*N][j] = C[j][j];
    foreach (j; 0..N) B[i][2*N+1][j] = C[j][N-j-1];
  }

  int ans = int.max;
  foreach (i; 0..M)
    foreach (j; i+1..M)
      foreach (a; 0..N*2+2)
        foreach (b; 0..N*2+2)
          ans = min(ans, count_diff(B[i][a], B[j][b]));

  writeln(ans-1);

}
0