結果
| 問題 |
No.179 塗り分け
|
| ユーザー |
sugim48
|
| 提出日時 | 2015-04-05 23:40:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,402 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 90,312 KB |
| 実行使用メモリ | 16,832 KB |
| 最終ジャッジ日時 | 2024-10-02 13:15:43 |
| 合計ジャッジ時間 | 9,069 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 -- * 5 |
| other | -- * 40 |
コンパイルメッセージ
main.cpp: In function ‘bool check(std::vector<std::__cxx11::basic_string<char> >&)’:
main.cpp:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
49 | }
| ^
ソースコード
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v, w; };
ll MOD = 1000000009;
ll _MOD = 1000000009;
double EPS = 1e-10;
bool check(vector<string>& S) {
int H = S.size(), W = S[0].length();
for (int dy = 0; dy < H; dy++)
for (int dx = 0; dx < W; dx++) {
if (dx == 0 && dy == 0) continue;
vector<string> s = S;
bool ok = true;
for (int y = 0; y < H; y++)
for (int x = 0; x < W; x++) {
if (s[y][x] == '.') continue;
if (x + dx >= W || y + dy >= H || s[y + dy][x + dx] == '#')
ok = false;
s[y][x] = '.';
}
}
}
int main() {
int H, W; cin >> H >> W;
vector<string> S(H);
for (int y = 0; y < H; y++)
cin >> S[y];
if (check(S)) {
cout << "YES" << endl;
return 0;
}
for (int y = 0; y < H; y++)
reverse(S[y].begin(), S[y].end());
if (check(S)) {
cout << "YES" << endl;
return 0;
}
cout << "NO" << endl;
}
sugim48