結果

問題 No.452 横着者のビンゴゲーム
ユーザー startcppstartcpp
提出日時 2017-01-01 22:50:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,240 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 70,428 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 15:19:08
合計ジャッジ時間 17,058 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 5 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1,277 ms
5,376 KB
testcase_15 AC 1,236 ms
5,376 KB
testcase_16 AC 669 ms
5,376 KB
testcase_17 AC 32 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 92 ms
5,376 KB
testcase_20 AC 53 ms
5,376 KB
testcase_21 AC 417 ms
5,376 KB
testcase_22 AC 38 ms
5,376 KB
testcase_23 AC 781 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 18 ms
5,376 KB
testcase_26 AC 460 ms
5,376 KB
testcase_27 AC 285 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 543 ms
5,376 KB
testcase_31 AC 76 ms
5,376 KB
testcase_32 AC 40 ms
5,376 KB
testcase_33 AC 214 ms
5,376 KB
testcase_34 WA -
testcase_35 AC 116 ms
5,376 KB
testcase_36 AC 22 ms
5,376 KB
testcase_37 AC 17 ms
5,376 KB
testcase_38 AC 1,861 ms
5,376 KB
testcase_39 AC 1,231 ms
5,376 KB
testcase_40 AC 1,268 ms
5,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