結果

問題 No.452 横着者のビンゴゲーム
ユーザー tailstails
提出日時 2016-12-03 00:29:49
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 398 ms / 3,000 ms
コード長 1,064 bytes
コンパイル時間 1,048 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 16,248 KB
最終ジャッジ日時 2024-11-28 21:19:41
合計ジャッジ時間 10,405 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | n;m;b;d;z;
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int]
main.c:1:3: warning: data definition has no type or storage class
    1 | n;m;b;d;z;
      |   ^
main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘m’ [-Wimplicit-int]
main.c:1:5: warning: data definition has no type or storage class
    1 | n;m;b;d;z;
      |     ^
main.c:1:5: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int]
main.c:1:7: warning: data definition has no type or storage class
    1 | n;m;b;d;z;
      |       ^
main.c:1:7: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
main.c:1:9: warning: data definition has no type or storage class
    1 | n;m;b;d;z;
      |         ^
main.c:1:9: warning: type defaults to ‘int’ in declaration of ‘z’ [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
    2 | c[200][100][100];
      | ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int]
main.c:3:1: warning: data definition has no type or storage class
    3 | u[2000000];
      | ^
main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘u’ [-Wimplicit-int]
main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    4 | i(v){scanf("%d",&v);return v;}
      | ^
main.c: In function ‘i’:
main.c:4:1: warning: type of ‘v’ defaults to ‘int’ [-Wimplicit-int]
main.c:4:6: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    4 | i(v){scanf("%d",&v);return v;}
      |      ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | n;m;b;d;z;
main.c:4:6: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    4 | i(v){scanf("%d",&v);return v;

ソースコード

diff #

n;m;b;d;z;
c[200][100][100];
u[2000000];
i(v){scanf("%d",&v);return v;}

f(d,e,x,y){
	for(d=0;d<m;++d){
		if(d-z){
			for(y=0;y<n;++y){
				e=0;
				for(x=0;x<n;++x){
					e+=!u[c[d][y][x]];
				}
				if(b>e)b=e;
			}
			for(x=0;x<n;++x){
				e=0;
				for(y=0;y<n;++y){
					e+=!u[c[d][y][x]];
				}
				if(b>e)b=e;
			}
			{
				e=0;
				for(y=0;y<n;++y){
					e+=!u[c[d][y][y]];
				}
			}
			{
				if(b>e)b=e;
				e=0;
				for(y=0;y<n;++y){
					e+=!u[c[d][y][~y+n]];
				}
				if(b>e)b=e;
			}
		}
	}
}

main(x,y){
	b=n=i();m=i();
	for(z=0;z<m;++z){
		for(y=0;y<n;++y){
			for(x=0;x<n;++x){
				c[z][y][x]=i();
			}
		}
	}
	for(z=0;z<m;++z){
		for(y=0;y<n;++y){
			bzero(u,sizeof u);
			for(x=0;x<n;++x){
				u[c[z][y][x]]=1;
			}
			f(z);
		}
		for(x=0;x<n;++x){
			bzero(u,sizeof u);
			for(y=0;y<n;++y){
				u[c[z][y][x]]=1;
			}
			f(z);
		}
		{
			bzero(u,sizeof u);
			for(y=0;y<n;++y){
				u[c[z][y][y]]=1;
			}
			f(z);
		}
		{
			bzero(u,sizeof u);
			for(y=0;y<n;++y){
				u[c[z][y][~y+n]]=1;
			}
			f(z);
		}
	}
		
	printf("%d",n+b-1);
	return 0;
}
0