AtCoder Beginner Contest 096

Submission #6109124

Source codeソースコード

#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 == false) can_paint = false;
            }
        }
    }

    cout << (can_paint ? "Yes":"No") << endl;
}

Submission

Task問題 C - Grid Repainting 2
User nameユーザ名 wa
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1434 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 0 / 300 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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
in06.txt AC 1 ms 256 KB
in07.txt WA
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
sample_03.txt AC 1 ms 256 KB