結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-23 22:00:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 3,000 ms |
| コード長 | 1,278 bytes |
| コンパイル時間 | 2,312 ms |
| コンパイル使用メモリ | 199,220 KB |
| 最終ジャッジ日時 | 2025-01-09 09:53:55 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
lint h,w;std::cin>>h>>w;
std::vector<std::vector<lint>>a(h,std::vector<lint>(w));
bool found=false;
for(lint i=0;i<h;i++){
for(lint j=0;j<w;j++){
char c;std::cin>>c;
a.at(i).at(j)=c=='#';
found|=a.at(i).at(j);
}
}
if(!found){
std::cout<<"NO"<<'\n';
return 0;
}
for(lint q=0;q<2;q++){
for(lint di=0;di<h;di++){
for(lint dj=0;dj<w;dj++){
if(!di&&!dj)continue;
auto b=a;
for(lint i=0;i<h;i++){
for(lint j=0;j<w;j++){
if(!b.at(i).at(j))continue;
lint ni=i+di,nj=j+dj;
if(h<=ni||w<=nj||!std::exchange(b.at(ni).at(nj),false)){
goto Impossible;
}
}
}
std::cout<<"YES"<<'\n';
return 0;
Impossible:;
}
}
for(auto&&b:a)std::reverse(b.begin(),b.end());
}
std::cout<<"NO"<<'\n';
}
ngtkana