結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2015-04-06 00:44:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,593 bytes |
コンパイル時間 | 753 ms |
コンパイル使用メモリ | 78,480 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 13:34:07 |
合計ジャッジ時間 | 2,337 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 3 |
other | AC * 25 WA * 15 |
ソースコード
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <vector> #include <algorithm> #include <set> #include <queue> #include <map> #include <climits> using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define RREP(i,n) for(int i=(int)n-1; i>=0; i--) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i) #define ALL(c) (c).begin(), (c).end() typedef long long int ll; typedef pair<int, int> pii; typedef pair<int, pair<int, int> > pipii; typedef vector<int> vi; const int INF = 1e9; const int MOD = 1e9+7; int h, w; bool check(int x, int y, vector<vi> g){ REP(i, h){ REP(j, w){ if(g[i][j]){ int dx = i + x, dy = j + y; if(dx < 0 || dy < 0 || dx >= h || dy >= w) return false; if(!g[dx][dy]) return false; g[i][j] = g[dx][dy] = 0; } } } cout << x << ":" << y << endl; return true; } int main(void){ cin >> h >> w; vector<vi> g(h, vi(w, 0)); int f = 0; REP(i, h){ REP(j, w){ char c; cin >> c; if(c == '#') f = g[i][j] = 1; } } if(!f){ cout << "NO" << endl; return 0; } REP(i, 60){ for(int j = -60; j < 60; j++){ if(!i && !j) continue; if(check(i, j, g)){ cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }