結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2015-08-28 21:15:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,149 bytes |
コンパイル時間 | 596 ms |
コンパイル使用メモリ | 81,440 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-02 14:44:11 |
合計ジャッジ時間 | 1,878 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 34 WA * 6 |
ソースコード
#include <iostream> #include <cmath> #include <climits> #include <string> #include <vector> #include <queue> #include <stack> #include <functional> #include <algorithm> #include <sstream> #include <map> #include <set> #include <utility> #define endl '\n' #define ALL(a) (a).begin(),(a).end() #define SZ(a) int((a).size()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) using namespace std; char fi[50][50]; typedef pair<int,int> P; typedef long long int LL; int main() { ios::sync_with_stdio(false); cin.tie(0); int H,W; cin>>H>>W; REP(i,H) REP(j,W) cin>>fi[i][j]; string ans="NO"; REP(dh,H){ REP(dw,W){ if(dh==0&&dw==0) continue; int ed[50][50]; REP(i,H) fill(ed[i],ed[i]+W,false); int f=true; REP(i,H){ REP(j,W){ if((!ed[i][j])&&fi[i][j]=='#'){ if(!(0<=i+dh&&i+dh<H&&0<=j+dw&&j+dw<W&&fi[i+dh][j+dw]=='#')){ f=false; break; }else{ ed[i+dh][j+dw]=true; } } } } if(f){ ans="YES"; break; } } } cout<<ans<<endl; return 0; }