結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2018-03-03 15:34:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,266 bytes |
コンパイル時間 | 1,266 ms |
コンパイル使用メモリ | 78,960 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 13:25:42 |
合計ジャッジ時間 | 2,046 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 3 |
other | AC * 23 WA * 17 |
ソースコード
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<stack> #include<queue> #include<vector> #include<algorithm> #include<string> #include<iostream> #include<set> #include<map> #include<bitset> using namespace std; typedef long long ll; #define i_7 1000000007 #define i_5 1000000005 ll mod(ll a){ ll c=a%i_7; if(c>=0)return c; else return c+i_7; } typedef pair<int,int> i_i; typedef pair<ll,ll> l_l; #define inf 100000000/*10^8*/ #define rep(i,l,r) for(int i=l;i<=r;i++) const double EPS=1E-8; //////////////////////////////////////// int h,w; char p[55][55+1]; bool flag=false; void solve(int x,int y){ char m[55][55]; rep(i,0,h-1)rep(j,0,w-1)m[i][j]=p[i][j]; rep(i,0,h-1)rep(j,0,w-1){ if(m[i][j]=='#'){ m[i][j]='.'; if(i+x>=h||j+y>=w)return; if(m[i+x][j+y]=='.')return; m[i+x][j+y]='.'; } } bool flg=true; rep(i,0,h-1)rep(j,0,w-1)if(m[i][j]!='.')flg=false; if(flg){ cout<<"YES"; printf(" %d %d ",x,y); flag=true; } } int main(){ cin>>h>>w; rep(i,0,h-1)cin>>p[i]; rep(i,0,h-1){ rep(j,0,w-1){ if(!flag)solve(i,j); } } if(!flag)cout<<"NO"; return 0; }