結果

問題 No.452 横着者のビンゴゲーム
ユーザー YamyukiYamyuki
提出日時 2016-12-03 10:48:53
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,506 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 23,424 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 18:02:29
合計ジャッジ時間 1,907 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 0 ms
5,376 KB
testcase_14 AC 30 ms
5,376 KB
testcase_15 AC 26 ms
5,376 KB
testcase_16 AC 14 ms
5,376 KB
testcase_17 AC 5 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 4 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
5,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:35:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   35 |         scanf("%d %d",&n,&m);
      |         ^~~~~~~~~~~~~~~~~~~~
main.c:39:33: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   39 |                                 scanf("%ld",&c[i][j][k]);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<memory.h>
int n,max;
long c[200][100][100],f[100];
int bingo_check(int m){
	int i,j,k,min,yoko=0,tate=0,naname=0,naname2=0;
	long a[100][100];
	memcpy(a,c[m],sizeof(a));
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				if(f[k]==c[m][i][j]) {c[m][i][j]=0;break;}
			}
		}
	}
	min=0;
	for(i=0;i<n;i++){
		if(0==c[m][i][i]) naname++;
		if(0==c[m][n-i-1][i]) naname2++;
		yoko=0;
		tate=0;
		for(j=0;j<n;j++){
			if(0==c[m][i][j]) yoko++;
			if(0==c[m][j][i]) tate++;
		}
		min=(yoko>min)?yoko:min;
		min=(tate>min)?tate:min;
	}
	naname=(naname<naname2)?naname2:naname;
	min=(naname>min)?naname:min;
	return n-min-1;
}
int main(){
	int m,i,j,k,max,min;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				scanf("%ld",&c[i][j][k]);
			}
		}
	}
	max=10001;
	for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				f[k]=c[i][j][k];
			}
		}
		for(j=0;j<m;j++){
			if(i!=j){
				min=bingo_check(j);
				max=(min+n<max)?min+n:max;
			}
		}
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				f[k]=c[i][k][j];
			}
		}
		for(j=0;j<m;j++){
			if(i!=j){
				min=bingo_check(j);
				max=(min+n<max)?min+n:max;
			}
		}
		for(j=0;j<n;j++){
			f[j]=c[i][j][j];
		}
		for(j=0;j<m;j++){
			if(i!=j){
				min=bingo_check(j);
				max=(min+n<max)?min+n:max;
			}
		}
		for(j=0;j<n;j++){
			f[j]=c[i][n-j-1][j];
		}
		for(j=0;j<m;j++){
			if(i!=j){
				min=bingo_check(j);
				max=(min+n<max)?min+n:max;
			}
		}
	}
	printf("%d\n",max);
	return 0;
}
0