結果

問題 No.179 塗り分け
ユーザー makecirmakecir
提出日時 2017-06-03 17:01:29
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 911 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 29,376 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-26 17:11:52
合計ジャッジ時間 1,606 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 0 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 0 ms
4,384 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 0 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 0 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 0 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 1 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 1 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 1 ms
4,380 KB
testcase_34 WA -
testcase_35 AC 1 ms
4,384 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 0 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 0 ms
4,376 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 0 ms
4,380 KB
testcase_42 AC 0 ms
4,380 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 0 ms
4,376 KB
testcase_45 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

typedef struct{
	char map[50][50];
}Map;

int h,w;
int check(Map m,int x,int y){
	int i,j;
	Map t;
	t=m;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(t.map[i][j]=='#'){
				if(t.map[i+y][j+x]=='#'){
					t.map[i][j]='.';
					t.map[i+y][j+x]='.';
				}
				else{
					return -1;
				}
			}
		}
	}
	return 0;
}
	
int main(){
	int i,j,ip,jp,fl;
	Map master;
	scanf("%d %d",&h,&w);
	getchar();
	for(i=0;i<h;i++){
		scanf("%s",master.map[i]);
		if(i!=h-1){
			getchar();
		}
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(master.map[i][j]=='#'){
				for(ip=i;ip<h;ip++){
					for(jp=0;jp<w;jp++){
                        if(jp==0&&ip==i){
                            jp=j+1;
					    }
						if(master.map[ip][jp]=='#'){
							fl=check(master,jp-j,ip-i);
							if(fl==0){
								return 0;
							}
						}
					}
				}
				printf("NO");
				return 0;
			}
		}
	}
	printf("NO");
	return 0;
} 
0