結果

問題 No.452 横着者のビンゴゲーム
ユーザー startcppstartcpp
提出日時 2017-01-01 23:10:05
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,172 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 76,612 KB
実行使用メモリ 8,104 KB
最終ジャッジ日時 2023-08-22 09:44:03
合計ジャッジ時間 24,522 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 11 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 13 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 6 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2,986 ms
4,380 KB
testcase_15 AC 2,870 ms
4,380 KB
testcase_16 AC 1,574 ms
4,376 KB
testcase_17 AC 117 ms
7,940 KB
testcase_18 AC 442 ms
4,380 KB
testcase_19 AC 255 ms
4,380 KB
testcase_20 AC 154 ms
5,692 KB
testcase_21 AC 1,107 ms
4,376 KB
testcase_22 AC 112 ms
7,984 KB
testcase_23 AC 2,064 ms
4,376 KB
testcase_24 AC 82 ms
7,700 KB
testcase_25 AC 48 ms
5,720 KB
testcase_26 AC 1,211 ms
4,376 KB
testcase_27 AC 762 ms
4,376 KB
testcase_28 AC 499 ms
4,376 KB
testcase_29 AC 278 ms
4,376 KB
testcase_30 AC 1,441 ms
4,376 KB
testcase_31 AC 198 ms
4,376 KB
testcase_32 AC 110 ms
4,380 KB
testcase_33 AC 551 ms
4,376 KB
testcase_34 AC 491 ms
4,380 KB
testcase_35 AC 320 ms
6,048 KB
testcase_36 AC 62 ms
5,672 KB
testcase_37 AC 60 ms
7,692 KB
testcase_38 TLE -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

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