Submission #3017539


Source Code Expand

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int h, w;
  char k;
  cin >> h >> w;
  bool a[h+2][w+2];
  bool flag = true;
  for(int i = 0; i+1 <= h; i++)
    for(int j = 0; j+1 <= w; j++)
      a[i][j] = false;
  for(int i = 1; i <= h; i++){
    for(int j = 1; j <= w; j++){
      cin >> k;
      if(k == '#') a[i][j] = true;
    }
  }
  for(int i = 1; i <= h; i++){
    for(int j = 1; j <= w; j++){
      if(a[i][j] && !(a[i-1][j] || a[i+1][j] || a[i][j-1] || a[i][j+1]))
        flag = false;
    }
  }
  cout << flag?"Yes":"No" << endl;
  return 0;
}

Submission Info

Submission Time
Task C - Grid Repainting 2
User k111111
Language C++14 (GCC 5.4.1)
Score 0
Code Size 610 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:30: error: invalid operands of types ‘const char [3]’ and ‘<unresolved overloaded function type>’ to binary ‘operator<<’
   cout << flag?"Yes":"No" << endl;
                              ^