結果

問題 No.452 横着者のビンゴゲーム
ユーザー kotamanegikotamanegi
提出日時 2017-01-05 00:06:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,894 ms / 3,000 ms
コード長 1,513 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 99,620 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 17:50:29
合計ジャッジ時間 28,855 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 10 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 3 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2,678 ms
5,376 KB
testcase_15 AC 2,521 ms
5,376 KB
testcase_16 AC 1,429 ms
5,376 KB
testcase_17 AC 86 ms
5,376 KB
testcase_18 AC 279 ms
5,376 KB
testcase_19 AC 177 ms
5,376 KB
testcase_20 AC 120 ms
5,376 KB
testcase_21 AC 671 ms
5,376 KB
testcase_22 AC 90 ms
5,376 KB
testcase_23 AC 1,359 ms
5,376 KB
testcase_24 AC 68 ms
5,376 KB
testcase_25 AC 40 ms
5,376 KB
testcase_26 AC 751 ms
5,376 KB
testcase_27 AC 502 ms
5,376 KB
testcase_28 AC 330 ms
5,376 KB
testcase_29 AC 187 ms
5,376 KB
testcase_30 AC 882 ms
5,376 KB
testcase_31 AC 131 ms
5,376 KB
testcase_32 AC 83 ms
5,376 KB
testcase_33 AC 358 ms
5,376 KB
testcase_34 AC 327 ms
5,376 KB
testcase_35 AC 230 ms
5,376 KB
testcase_36 AC 50 ms
5,376 KB
testcase_37 AC 47 ms
5,376 KB
testcase_38 AC 2,894 ms
5,376 KB
testcase_39 AC 1,962 ms
5,376 KB
testcase_40 AC 1,985 ms
5,376 KB
testcase_41 AC 1,983 ms
5,376 KB
testcase_42 AC 1,956 ms
5,376 KB
testcase_43 AC 1,954 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 100000000000000
vector<vector<int>> neko[300];
int main() {
	iostream::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	for (int i = 0;i < m;++i) {
		vector<int> tate[110],yoko[110],w,te;
		for (int q = 0;q < n;++q) {
			for (int j = 0;j < n;++j) {
				int a;
				cin >> a;
				tate[q].push_back(a);
				yoko[j].push_back(a);
				if (q == j) w.push_back(a);
				if ((n - q - 1) == j) te.push_back(a);
			}
		}
		for (int q = 0;q < n;++q) {
			neko[i].push_back(tate[q]);
			neko[i].push_back(yoko[q]);
		}
		neko[i].push_back(w);
		neko[i].push_back(te);
	}
	int ans = 100000;
	for (int i = 0;i < m;++i) {
		for (int q = 0;q < neko[i].size();++q) {
			for (int j = i + 1;j < m;++j) {
				for (int t = 0;t < neko[j].size();++t) {
					set<int> aa;
					REP(p, neko[i][q].size()) {
						aa.insert(neko[i][q][p]);
					}
					REP(p, neko[j][t].size()) {
						aa.insert(neko[j][t][p]);
					}
					ans = min(ans, (int)aa.size());
				}
			}
		}
	}
	cout << ans-1 << endl;
	return 0;
}
0