結果

問題 No.452 横着者のビンゴゲーム
ユーザー startcppstartcpp
提出日時 2017-01-01 23:10:05
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,172 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 75,116 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 15:20:13
合計ジャッジ時間 24,423 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 8 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 11 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2,606 ms
5,376 KB
testcase_15 AC 2,615 ms
5,376 KB
testcase_16 AC 1,371 ms
5,376 KB
testcase_17 AC 98 ms
5,376 KB
testcase_18 AC 342 ms
5,376 KB
testcase_19 AC 211 ms
5,376 KB
testcase_20 AC 131 ms
5,376 KB
testcase_21 AC 852 ms
5,376 KB
testcase_22 AC 102 ms
5,376 KB
testcase_23 AC 1,545 ms
5,376 KB
testcase_24 AC 71 ms
5,376 KB
testcase_25 AC 42 ms
5,376 KB
testcase_26 AC 970 ms
5,376 KB
testcase_27 AC 621 ms
5,376 KB
testcase_28 AC 401 ms
5,376 KB
testcase_29 AC 240 ms
5,376 KB
testcase_30 AC 1,089 ms
5,376 KB
testcase_31 AC 161 ms
5,376 KB
testcase_32 AC 89 ms
5,376 KB
testcase_33 AC 446 ms
5,376 KB
testcase_34 AC 395 ms
5,376 KB
testcase_35 AC 266 ms
5,376 KB
testcase_36 AC 54 ms
5,376 KB
testcase_37 AC 51 ms
5,376 KB
testcase_38 TLE -
testcase_39 AC 2,731 ms
5,376 KB
testcase_40 AC 2,590 ms
5,376 KB
testcase_41 AC 2,587 ms
5,376 KB
testcase_42 AC 2,675 ms
5,376 KB
testcase_43 AC 2,625 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#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;
	vector<vector<int>> as; as.resize(2 * n + 2); rep(i, 2 * n + 2) as[i].resize(n);
	vector<vector<int>> bs; bs.resize(2 * n + 2); rep(i, 2 * n + 2) bs[i].resize(n);
	
	rep(i, n) rep(j, n) as[i][j] = c[a][i][j];
	rep(i, n) rep(j, n) as[n + i][j] = c[a][j][i];
	rep(i, n) as[2 * n][i] = c[a][i][i];
	rep(i, n) as[2 * n + 1][i] = c[a][i][n - 1 - i];
	
	rep(i, n) rep(j, n) bs[i][j] = c[b][i][j];
	rep(i, n) rep(j, n) bs[n + i][j] = c[b][j][i];
	rep(i, n) bs[2 * n][i] = c[b][i][i];
	rep(i, n) bs[2 * n + 1][i] = c[b][i][n - 1 - i];
	
	int ret = 114514;
	rep(i, 2 * n + 2) {
		rep(j, 2 * n + 2) {
			set<int> dict;
			rep(k, n) { dict.insert(as[i][k]); dict.insert(bs[j][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