結果

問題 No.421 しろくろチョコレート
ユーザー tailstails
提出日時 2016-09-10 00:12:04
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 745 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 21,888 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-16 18:57:54
合計ジャッジ時間 1,851 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 1 ms
5,248 KB
testcase_03 AC 1 ms
5,248 KB
testcase_04 AC 0 ms
5,248 KB
testcase_05 WA -
testcase_06 AC 0 ms
5,248 KB
testcase_07 WA -
testcase_08 AC 1 ms
5,248 KB
testcase_09 AC 0 ms
5,248 KB
testcase_10 AC 1 ms
5,248 KB
testcase_11 WA -
testcase_12 AC 1 ms
5,248 KB
testcase_13 AC 1 ms
5,248 KB
testcase_14 AC 1 ms
5,248 KB
testcase_15 AC 0 ms
5,248 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
5,248 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
5,248 KB
testcase_24 AC 1 ms
5,248 KB
testcase_25 AC 1 ms
5,248 KB
testcase_26 AC 0 ms
5,248 KB
testcase_27 AC 0 ms
5,248 KB
testcase_28 AC 0 ms
5,248 KB
testcase_29 AC 1 ms
5,248 KB
testcase_30 AC 1 ms
5,248 KB
testcase_31 AC 1 ms
5,248 KB
testcase_32 AC 1 ms
5,248 KB
testcase_33 AC 0 ms
5,248 KB
testcase_34 AC 0 ms
5,248 KB
testcase_35 AC 1 ms
5,248 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 0 ms
5,248 KB
testcase_40 AC 0 ms
5,248 KB
testcase_41 AC 1 ms
5,248 KB
testcase_42 AC 1 ms
5,248 KB
testcase_43 AC 1 ms
5,248 KB
testcase_44 AC 1 ms
5,248 KB
testcase_45 AC 0 ms
5,248 KB
testcase_46 AC 0 ms
5,248 KB
testcase_47 AC 1 ms
5,248 KB
testcase_48 AC 1 ms
5,248 KB
testcase_49 AC 1 ms
5,248 KB
testcase_50 AC 1 ms
5,248 KB
testcase_51 AC 1 ms
5,248 KB
testcase_52 WA -
testcase_53 AC 0 ms
5,248 KB
testcase_54 AC 1 ms
5,248 KB
testcase_55 AC 1 ms
5,248 KB
testcase_56 AC 0 ms
5,248 KB
testcase_57 AC 0 ms
5,248 KB
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 1 ms
5,248 KB
testcase_63 AC 0 ms
5,248 KB
testcase_64 AC 1 ms
5,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | a[52][52];
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
    2 | s;
      | ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘s’ [-Wimplicit-int]
main.c:4:1: warning: data definition has no type or storage class
    4 | o[2];p[2];
      | ^
main.c:4:1: warning: type defaults to ‘int’ in declaration of ‘o’ [-Wimplicit-int]
main.c:4:6: warning: data definition has no type or storage class
    4 | o[2];p[2];
      |      ^
main.c:4:6: warning: type defaults to ‘int’ in declaration of ‘p’ [-Wimplicit-int]
main.c:5:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    5 | f(y,x){
      | ^
main.c: In function ‘f’:
main.c:5:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:16:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   16 | main(m,n,x,y,c,q,t){
      | ^~~~
main.c: In function ‘main’:
main.c:16:1: warning: type of ‘m’ defaults to ‘int’ [-Wimplicit-int]
main.c:16:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
main.c:16:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c:16:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int]
main.c:16:1: warning: type of ‘c’ defaults to ‘int’ [-Wimplicit-int]
main.c:16:1: warning: type of ‘q’ defaults to ‘int’ [-Wimplicit-int]
main.c:16:1: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int]
main.c:17:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
   17 |         scanf("%d%d",&n,&m);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
   

ソースコード

diff #

a[52][52];
s;

o[2];p[2];
f(y,x){
	if(a[y][x]){
		a[y][x]=0;
		++o[y+x&1];
		f(y-1,x);
		f(y+1,x);
		f(y,x-1);
		f(y,x+1);
	}
}

main(m,n,x,y,c,q,t){
	scanf("%d%d",&n,&m);
	for(y=0;y<n;++y){
		for(x=0;x<m;++x){
			scanf(" %c",&a[y+1][x+1]);
			a[y+1][x+1]>>=6;
		}
	}
	do{
		q=0;
		for(y=0;y<n;++y){
			for(x=0;x<m;++x){
				if(a[y+1][x+1]){
					c=a[y+0][x+1]+a[y+2][x+1]+a[y+1][x+0]+a[y+1][x+2];
					if(c==1){
						q=1;s+=100;
						a[y+0][x+1]=a[y+2][x+1]=a[y+1][x+0]=a[y+1][x+2]=a[y+1][x+1]=0;
					}
				}
			}
		}
	}while(q);
	for(y=0;y<n;++y){
		for(x=0;x<m;++x){
			o[0]=o[1]=0;
			f(y+1,x+1);
			s+=100*(t=o[0]<o[1]?o[0]:o[1]);
			p[0]+=o[0]-t;p[1]+=o[1]-t;
		}
	}
	s+=8*(p[0]<p[1]?p[0]:p[1])+p[0]+p[1];
	printf("%d",s);
	return 0;
}
0