結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2017-06-03 16:53:47 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 847 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 29,696 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-03 04:01:42 |
合計ジャッジ時間 | 1,395 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 33 WA * 7 |
ソースコード
#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=j+1;jp<w;jp++){ if(master.map[ip][jp]=='#'){ fl=check(master,jp-j,ip-i); if(fl==0){ printf("YES"); return 0; } } } } printf("NO"); return 0; } } } printf("NO"); return 0; }