Submission #6109009
Source Code Expand
#include<iostream> #include<cmath> #include<algorithm> #include<vector> #include<functional> #include<string> #include<iomanip> #include<map> #include<utility> #include<string> template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; #define min_3(a, b, c) min(a, min(b, c)) #define max_3(a, b, c) max(a, max(b, c)) typedef long long ll; int main() { int h, w; cin >> h >> w; vector<string> s(h); for(int i = 0; i < h; i++){ for (int j = 0; j < w; j++) { cin >> s[i][j]; } } //上下左右 int vx[4] = {1,-1,0,0}; int vy[4] = {0,0,1,-1}; bool can_paint = true; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ if(s[i][j] == '#'){ bool found = false; for(int k = 0; k < 4; k++){ int nextx = j + vx[k], nexty = i + vy[k]; if(nextx >= 0 && nextx < w && nexty >= 0 && nexty < h && s[nexty][nextx] == '#'){ found = true; } } if(!found) can_paint = false; } } } cout << (can_paint ? "Yes":"No") << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Grid Repainting 2 |
User | wataru |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1426 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 1 ms | 256 KB |
in05.txt | WA | 1 ms | 256 KB |
in06.txt | AC | 1 ms | 256 KB |
in07.txt | WA | 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 | WA | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |