結果
問題 |
No.179 塗り分け
|
ユーザー |
![]() |
提出日時 | 2015-04-05 23:39:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 846 bytes |
コンパイル時間 | 554 ms |
コンパイル使用メモリ | 64,052 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-02 13:15:22 |
合計ジャッジ時間 | 1,607 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 32 WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%d%d",&H,&W); | ~~~~~^~~~~~~~~~~~~~ main.cpp:29:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 29 | for(int i=0;i<H;i++)scanf("%s",fld[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<cstdio> #include<map> using namespace std; char fld[50][51]; int H,W; bool used[50][50]; bool check(int dy,int dx){ fill_n(*used,2500,false); for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if(fld[i][j]=='.'||used[i][j])continue; int ty=i+dy,tx=j+dx; if(ty>=H||tx>=W)return false; if(fld[ty][tx]=='.')return false; used[ty][tx]=true; } } return true; } int main(){ scanf("%d%d",&H,&W); for(int i=0;i<H;i++)scanf("%s",fld[i]); for(int i=0;i<H-1;i++){ for(int j=0;j<W-1;j++){ if(!i&&!j)continue; if(check(i,j)){ puts("YES"); return 0; } } } puts("NO"); return 0; }