結果

問題 No.452 横着者のビンゴゲーム
ユーザー startcppstartcpp
提出日時 2017-01-01 22:50:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,240 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 68,716 KB
実行使用メモリ 7,876 KB
最終ジャッジ日時 2023-08-22 09:42:58
合計ジャッジ時間 20,998 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1,378 ms
4,376 KB
testcase_15 AC 1,337 ms
4,376 KB
testcase_16 AC 741 ms
4,380 KB
testcase_17 AC 37 ms
7,812 KB
testcase_18 WA -
testcase_19 AC 106 ms
4,380 KB
testcase_20 AC 62 ms
5,636 KB
testcase_21 AC 528 ms
4,376 KB
testcase_22 AC 41 ms
7,652 KB
testcase_23 AC 991 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 19 ms
5,796 KB
testcase_26 AC 567 ms
4,380 KB
testcase_27 AC 339 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 683 ms
4,376 KB
testcase_31 AC 89 ms
4,376 KB
testcase_32 AC 44 ms
4,376 KB
testcase_33 AC 244 ms
4,376 KB
testcase_34 WA -
testcase_35 AC 130 ms
5,684 KB
testcase_36 AC 24 ms
5,736 KB
testcase_37 AC 21 ms
7,876 KB
testcase_38 AC 2,412 ms
4,376 KB
testcase_39 AC 1,562 ms
4,376 KB
testcase_40 AC 1,566 ms
4,376 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <set>
#define rep(i, n) for (i = 0; i < n; i++)
using namespace std;

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

int f(int a, int b) {
	int i, j, k;
	set<int> dict;
	int ret = 114514;
	
	rep(i, n) { rep(j, n) { dict.clear(); rep(k, n) { dict.insert(c[a][i][k]); dict.insert(c[b][j][k]); } ret = min(ret, (int)dict.size()); } }
	rep(i, n) { rep(j, n) { dict.clear(); rep(k, n) { dict.insert(c[a][k][i]); dict.insert(c[b][k][j]); } ret = min(ret, (int)dict.size()); } }
	dict.clear(); rep(k, n) { dict.insert(c[a][k][k]); dict.insert(c[b][k][k]); } ret = min(ret, (int)dict.size());
	dict.clear(); rep(k, n) { dict.insert(c[a][k][k]); dict.insert(c[b][k][n - 1 - k]); } ret = min(ret, (int)dict.size());
	dict.clear(); rep(k, n) { dict.insert(c[a][k][n - 1 - k]); dict.insert(c[b][k][k]); } ret = min(ret, (int)dict.size());
	dict.clear(); rep(k, n) { dict.insert(c[a][k][n - 1 - k]); dict.insert(c[b][k][n - 1 - k]); } ret = min(ret, (int)dict.size());
	return ret;
}

int main() {
	int i, j, k;
	
	cin >> n >> m;
	rep(i, m) rep(j, n) rep(k, n) cin >> c[i][j][k];
	
	int ans = 114514;
	for (i = 0; i < m; i++) for (j = i + 1; j < m; j++) ans = min(ans, f(i, j) - 1);
	cout << ans << endl;
	return 0;
}
0