結果

問題 No.452 横着者のビンゴゲーム
ユーザー kotamanegikotamanegi
提出日時 2017-01-05 00:06:00
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,478 bytes
コンパイル時間 983 ms
コンパイル使用メモリ 98,268 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-09 17:49:20
合計ジャッジ時間 28,873 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 7 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 4 ms
5,376 KB
testcase_09 AC 2 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 2 ms
5,376 KB
testcase_14 AC 2,740 ms
6,944 KB
testcase_15 AC 2,645 ms
5,376 KB
testcase_16 AC 1,508 ms
5,376 KB
testcase_17 AC 93 ms
5,376 KB
testcase_18 AC 298 ms
5,376 KB
testcase_19 AC 183 ms
5,376 KB
testcase_20 AC 121 ms
5,376 KB
testcase_21 AC 756 ms
5,376 KB
testcase_22 AC 90 ms
5,376 KB
testcase_23 AC 1,252 ms
5,376 KB
testcase_24 AC 67 ms
5,376 KB
testcase_25 AC 44 ms
5,376 KB
testcase_26 AC 781 ms
5,376 KB
testcase_27 AC 519 ms
5,376 KB
testcase_28 AC 320 ms
5,376 KB
testcase_29 AC 186 ms
5,376 KB
testcase_30 AC 869 ms
5,376 KB
testcase_31 AC 135 ms
5,376 KB
testcase_32 AC 88 ms
5,376 KB
testcase_33 AC 371 ms
5,376 KB
testcase_34 AC 316 ms
5,376 KB
testcase_35 AC 241 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,000 ms
5,376 KB
testcase_40 AC 2,004 ms
5,376 KB
testcase_41 AC 2,006 ms
5,376 KB
testcase_42 AC 2,012 ms
5,376 KB
testcase_43 AC 2,007 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() {
	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