結果
問題 | No.179 塗り分け |
ユーザー |
👑 |
提出日時 | 2022-09-21 13:16:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 989 bytes |
コンパイル時間 | 1,169 ms |
コンパイル使用メモリ | 85,048 KB |
最終ジャッジ日時 | 2025-02-07 13:18:40 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 29 WA * 11 |
ソースコード
#include <iostream> #include <vector> #include <set> #include <map> using namespace std; int main(){ int h,w;cin>>h>>w; vector<vector<char>> A(h,vector<char>(w)); int c = 0; for(int i = 0; h > i; i++){ for(int j = 0; w > j; j++){ cin>>A[i][j]; if(A[i][j] == '#')c++; } } if(c%2){ cout << "NO" << endl; return 0; } int C = 0; set<pair<int,int>> X[2*h*w]; for(int i = 0; h > i; i++){ for(int j = 0; w > j; j++){ for(int k = i; h > k; k++){ for(int l = j; w > l; l++){ //cout << (i-k)*w+(j-l)+h*w << endl; if(i==k && j==l)continue; if(A[i][j] == '#' && A[k][l] == '#'){ //cout << i-k << " " << j-l << endl; X[(i-k)*w+(j-l)+h*w].insert({i,j}); X[(i-k)*w+(j-l)+h*w].insert({k,l}); } } } } } for(int i = 0; 2*h*w > i; i++){ if(X[i].size() == c){ cout << "YES" << endl; return 0; } } cout << "NO" << endl; }