結果

問題 No.452 横着者のビンゴゲーム
ユーザー FF256grhyFF256grhy
提出日時 2016-12-03 00:33:20
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,010 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 43,824 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-06 14:10:01
合計ジャッジ時間 18,873 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 0 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,077 ms
5,376 KB
testcase_17 AC 8 ms
5,376 KB
testcase_18 AC 64 ms
5,376 KB
testcase_19 AC 17 ms
5,376 KB
testcase_20 AC 9 ms
5,376 KB
testcase_21 AC 258 ms
5,376 KB
testcase_22 AC 8 ms
5,376 KB
testcase_23 AC 733 ms
5,376 KB
testcase_24 AC 6 ms
5,376 KB
testcase_25 AC 4 ms
5,376 KB
testcase_26 AC 213 ms
5,376 KB
testcase_27 AC 68 ms
5,376 KB
testcase_28 AC 74 ms
5,376 KB
testcase_29 AC 22 ms
5,376 KB
testcase_30 AC 352 ms
5,376 KB
testcase_31 AC 19 ms
5,376 KB
testcase_32 AC 7 ms
5,376 KB
testcase_33 AC 49 ms
5,376 KB
testcase_34 AC 51 ms
5,376 KB
testcase_35 AC 22 ms
5,376 KB
testcase_36 AC 5 ms
5,376 KB
testcase_37 AC 4 ms
5,376 KB
testcase_38 AC 2,353 ms
5,376 KB
testcase_39 AC 1,069 ms
5,376 KB
testcase_40 AC 1,065 ms
5,376 KB
testcase_41 AC 1,071 ms
5,376 KB
testcase_42 AC 1,070 ms
5,376 KB
testcase_43 AC 1,070 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:36:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |         scanf("%d%d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~
main.cpp:40:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   40 |                 scanf("%d", &c[k][i][j]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

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 + 2) {
		std::sort(d[k][i], d[k][i] + n);
	}
	}
	
	int ans = 2 * n;
	
	inc(k, m) {
	inc(l, k) {
		inc(kk, 2 * n + 2) {
		inc(ll, 2 * n + 2) {
			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