結果

問題 No.452 横着者のビンゴゲーム
ユーザー kotatsugamekotatsugame
提出日時 2020-03-04 14:22:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,031 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 78,752 KB
実行使用メモリ 10,396 KB
最終ジャッジ日時 2024-04-22 01:37:36
合計ジャッジ時間 5,787 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,272 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 7 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 7 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 3 ms
6,944 KB
testcase_08 AC 5 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 3 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N,M;
int A[200][100][100];
bool f(int K)
{
	for(int i=0;i<M;i++)for(int j=i+1;j<M;j++)
	{
		for(int I=0;I<2*N+2;I++)for(int J=0;J<2*N+2;J++)
		{
			vector<int>a;
			if(I<N)for(int k=0;k<N;k++)a.push_back(A[i][I][k]);
			else if(I<2*N)for(int k=0;k<N;k++)a.push_back(A[i][k][I-N]);
			else if(I==2*N)for(int k=0;k<N;k++)a.push_back(A[i][k][k]);
			else for(int k=0;k<N;k++)a.push_back(A[i][N-k-1][k]);
			if(J<N)for(int k=0;k<N;k++)a.push_back(A[j][J][k]);
			else if(J<2*N)for(int k=0;k<N;k++)a.push_back(A[j][k][J-N]);
			else if(J==2*N)for(int k=0;k<N;k++)a.push_back(A[j][k][k]);
			else for(int k=0;k<N;k++)a.push_back(A[j][N-k-1][k]);
			sort(a.begin(),a.end());
			if(unique(a.begin(),a.end())-a.begin()<=K)return true;
		}
	}
	return false;
}
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)for(int j=0;j<N;j++)for(int k=0;k<N;k++)cin>>A[i][j][k];
	int L=N-1,R=2*N;
	while(R-L>1)
	{
		if(f((L+R)/2))R=(L+R)/2;
		else L=(L+R)/2;
	}
	cout<<L<<endl;
}
0