Submission #3418562
Source Code Expand
#include <bits/stdc++.h> #define INF 100100100 #define MOD 1000000007 using namespace std; using ll = long long; using ull = unsigned long long ; #define FOR(i,n) for(ll i=0;i<n;i++) struct edge{ll to,cost;}; int x[4] = {1,-1,0,0}; int y[4] = {0,0,1,-1}; int main(int argc, char const* argv[]){ ios::sync_with_stdio(false); cin.tie(0); int H,W; cin >> H >> W; vector<string>s(H); FOR(i,H)cin >> s[i]; bool flag; FOR(i,H){ FOR(j,W){ flag = true; FOR(k,4){ if(s[i][j] == '.'){ flag = false; break; } else if(j+x[k]<W && j+x[k]>=0 && i+y[k]<H && i+y[k]>=0){ if(s[i+y[k]][j+x[k]] == '#')flag = false; } } if(flag){ cout << "No" << endl; return 0; } } } cout << "Yes" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Grid Repainting 2 |
User | reg7777 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 948 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | AC | 1 ms | 256 KB |
in02.txt | AC | 1 ms | 256 KB |
in03.txt | AC | 1 ms | 256 KB |
in04.txt | AC | 2 ms | 256 KB |
in05.txt | AC | 1 ms | 256 KB |
in06.txt | AC | 1 ms | 256 KB |
in07.txt | AC | 1 ms | 256 KB |
in08.txt | AC | 1 ms | 256 KB |
in09.txt | AC | 1 ms | 256 KB |
in10.txt | AC | 1 ms | 256 KB |
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |