結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
polyomino_24
|
| 提出日時 | 2020-09-06 14:49:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,215 bytes |
| コンパイル時間 | 1,524 ms |
| コンパイル使用メモリ | 129,056 KB |
| 最終ジャッジ日時 | 2025-01-14 07:46:54 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 38 WA * 2 |
ソースコード
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
os << '(' << a.first << ',' << a.second << ')';
return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
for (auto x : v) os << x << ' ';
return os;
}
void debug() {
cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
cerr << a;
if (sizeof...(b)) cerr << ", ";
debug(b...);
}
int main(){
int h, w;
cin >> h >> w;
vector<string>s(h);
rep(i,h)cin >> s[i];
for(int i = - h; i <= h; i++){
for(int j = - w; j <= w; j++){
vector<vector<bool>> used(h, vector<bool>(w));
bool f = true;
rep(x, h){
rep(y, w){
if(used[x][y])continue;
used[x][y] = true;
if(s[x][y] == '#'){
int xx = x + i;
int yy = y + j;
if(xx < 0 or xx >= h or yy < 0 or yy >= w){
f = false;
continue;
}
if(used[xx][yy])f = false;
used[xx][yy] = true;
if(s[xx][yy] != '#'){
f = false;
}
}
}
}
if(f){
show(i, j);
puts("YES");
return 0;
}
}
}
puts("NO");
return 0;
}
polyomino_24