結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2015-04-05 23:47:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 27 ms / 3,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 663 ms |
コンパイル使用メモリ | 62,216 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 14:24:42 |
合計ジャッジ時間 | 1,888 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 40 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <cstdio> using namespace std; int main(){ int h,w; cin>>h>>w; vector<string>m0(h); for(int i=0;i<h;i++)cin>>m0[i]; for(int dx=0;dx<w;dx++)for(int dy=-h;dy<h;dy++)if(dx||dy){ vector<string>m=m0; bool f=false; for(int x=0;x<w;x++)for(int y=0;y<h;y++){ if(m[y][x]=='#'){ f=true; if(x+dx<0||w<=x+dx || y+dy<0||h<=y+dy || m[y+dy][x+dx]=='.')goto FAIL; m[y][x]=m[y+dy][x+dx]='.'; } } if(f){ puts("YES"); return 0; } FAIL:; } puts("NO"); }