結果

問題 No.452 横着者のビンゴゲーム
ユーザー kotatsugamekotatsugame
提出日時 2020-03-04 14:27:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 311 ms / 3,000 ms
コード長 1,067 bytes
コンパイル時間 808 ms
コンパイル使用メモリ 67,364 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 01:37:41
合計ジャッジ時間 4,113 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
using namespace std;
int N,M;
int A[200][100][100];
int ex[40404];
int tm;
bool ise(int a)
{
	if(ex[a]<tm)
	{
		ex[a]=tm;
		return true;
	}
	else return false;
}
bool f(int K)
{
	tm=0;
	for(int i=0;i<40404;i++)ex[i]=0;
	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++)
		{
			tm++;
			int cnt=0;
			if(I<N)for(int k=0;k<N;k++)cnt+=ise(A[i][I][k]);
			else if(I<2*N)for(int k=0;k<N;k++)cnt+=ise(A[i][k][I-N]);
			else if(I==2*N)for(int k=0;k<N;k++)cnt+=ise(A[i][k][k]);
			else for(int k=0;k<N;k++)cnt+=ise(A[i][N-k-1][k]);
			if(J<N)for(int k=0;k<N;k++)cnt+=ise(A[j][J][k]);
			else if(J<2*N)for(int k=0;k<N;k++)cnt+=ise(A[j][k][J-N]);
			else if(J==2*N)for(int k=0;k<N;k++)cnt+=ise(A[j][k][k]);
			else for(int k=0;k<N;k++)cnt+=ise(A[j][N-k-1][k]);
			if(cnt<=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