Submission #5443423


Source Code Expand

#include<iostream>

using namespace std;

int H,W;
int main () {
    cin >> H >> W;
    for(int i=1; i<=H; i++)
        for(int j=1; j<=W; j++)
            cin >> tb[i][j];

    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            if( tb[i][j] == '#') {
                bool flag = false;
                for(int k=0; k<4; k++) {
                    int nx = j + dx[k];
                    int ny = i + dy[k];
                    if( tb[ny][nx] == '#' ) flag = true;
                }
                if(!flag) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:20: error: ‘tb’ was not declared in this scope
             cin >> tb[i][j];
                    ^
./Main.cpp:14:17: error: ‘tb’ was not declared in this scope
             if( tb[i][j] == '#') {
                 ^
./Main.cpp:17:34: error: ‘dx’ was not declared in this scope
                     int nx = j + dx[k];
                                  ^
./Main.cpp:18:34: error: ‘dy’ was not declared in this scope
                     int ny = i + dy[k];
                                  ^