結果

問題 No.452 横着者のビンゴゲーム
ユーザー FF256grhyFF256grhy
提出日時 2016-12-03 00:28:13
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 2,030 bytes
コンパイル時間 1,788 ms
コンパイル使用メモリ 48,172 KB
実行使用メモリ 23,788 KB
最終ジャッジ日時 2023-08-19 06:55:58
合計ジャッジ時間 12,991 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,092 KB
testcase_01 AC 1 ms
4,972 KB
testcase_02 AC 2 ms
5,084 KB
testcase_03 AC 2 ms
5,080 KB
testcase_04 AC 2 ms
4,972 KB
testcase_05 AC 3 ms
5,140 KB
testcase_06 AC 2 ms
5,084 KB
testcase_07 AC 1 ms
5,060 KB
testcase_08 AC 2 ms
5,124 KB
testcase_09 AC 2 ms
5,036 KB
testcase_10 AC 2 ms
5,024 KB
testcase_11 AC 2 ms
5,096 KB
testcase_12 AC 2 ms
5,060 KB
testcase_13 WA -
testcase_14 AC 1,877 ms
5,380 KB
testcase_15 AC 1,848 ms
5,360 KB
testcase_16 AC 675 ms
5,416 KB
testcase_17 AC 11 ms
23,788 KB
testcase_18 AC 40 ms
5,256 KB
testcase_19 AC 14 ms
9,304 KB
testcase_20 AC 10 ms
15,460 KB
testcase_21 AC 196 ms
5,240 KB
testcase_22 AC 9 ms
17,460 KB
testcase_23 AC 459 ms
5,304 KB
testcase_24 AC 9 ms
23,588 KB
testcase_25 AC 6 ms
13,424 KB
testcase_26 AC 132 ms
5,356 KB
testcase_27 AC 47 ms
9,528 KB
testcase_28 AC 47 ms
5,260 KB
testcase_29 AC 17 ms
9,392 KB
testcase_30 AC 250 ms
5,280 KB
testcase_31 AC 14 ms
7,304 KB
testcase_32 AC 7 ms
9,344 KB
testcase_33 AC 33 ms
9,388 KB
testcase_34 AC 34 ms
7,372 KB
testcase_35 AC 17 ms
11,404 KB
testcase_36 AC 7 ms
15,412 KB
testcase_37 AC 7 ms
21,604 KB
testcase_38 AC 1,351 ms
5,408 KB
testcase_39 AC 666 ms
5,392 KB
testcase_40 AC 683 ms
5,392 KB
testcase_41 AC 676 ms
5,368 KB
testcase_42 AC 666 ms
5,332 KB
testcase_43 AC 671 ms
5,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cmath>

#include <algorithm>

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, m, c[200][100][100];
int d[200][202][100];

int main() {
	scanf("%d%d", &n, &m);
	inc(k, m) {
	inc(i, n) {
	inc(j, n) {
		scanf("%d", &c[k][i][j]);
	}
	}
	}
	
	inc(k, m) {
		inc(i, n) {
			inc(j, n) { d[k][i][j] = c[k][i][j]; }
		}
		inc(j, n) {
			inc(i, n) { d[k][n + j][i] = c[k][i][j]; }
		}
		inc(i, n) { d[k][2 * n][i] = c[k][i][i]; }
		inc(i, n) { d[k][2 * n + 1][i] = c[k][i][n - 1 - i]; }
	}
	
	inc(k, m) {
	inc(i, 2 * n + 1) {
		std::sort(d[k][i], d[k][i] + n);
	}
	}
	
	int ans = 2 * n;
	
	inc(k, m) {
	inc(l, k) {
		inc(kk, 2 * n + 1) {
		inc(ll, 2 * n + 1) {
			// TLE しそう
			int e = 0;
			inc(x, n) {
			inc(y, n) {
				if(d[k][kk][x] == d[l][ll][y]) { e++; }
			}
			}
			setmin(ans, 2 * n - e);
		}
		}
	}
	}
	
	printf("%d\n", ans - 1);
	
	return 0;
}
0