結果

問題 No.452 横着者のビンゴゲーム
ユーザー kotamanegikotamanegi
提出日時 2017-01-04 23:59:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,478 bytes
コンパイル時間 1,235 ms
コンパイル使用メモリ 98,108 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 17:47:38
合計ジャッジ時間 2,549 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 27 ms
5,376 KB
testcase_15 AC 26 ms
5,376 KB
testcase_16 AC 22 ms
5,376 KB
testcase_17 AC 17 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 13 ms
5,376 KB
testcase_21 WA -
testcase_22 AC 13 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 9 ms
5,376 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 20 ms
5,376 KB
testcase_36 AC 8 ms
5,376 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

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();++i) {
			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