제출 #1289598

#제출 시각아이디문제언어결과실행 시간메모리
1289598ctfoxDango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms584 KiB
#include <bits/stdc++.h>

typedef enum{
    RED,
    GREEN,
    WHITE
} colors;

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    int n, m;
    std::cin >> n >> m;
    
    colors r[n][m];
    bool r_b[5][5] = {{false,false,false,false},{false,false,false,false},{false,false,false,false},{false,false,false,false}};
    
    std::string k;
    
    for(int i = 0; i < n; i++){
        std::cin >> k;
        for(int y = 0; y < m; y++){
            switch(k[y]){
                case 'R':
                    r[i][y] = RED;
                    break;
                case 'G':
                    r[i][y] = GREEN;
                    break;
                case 'W':
                    r[i][y] = WHITE;
                    break;
            } 
            
        }
        k.clear();
    }
    
    int count = 0;
    
    for(int h = 0; h < m; h++){
        for(int o = 0; o < n; o++){
            if(r[o][h] == RED && o + 2 < n && r[o + 1][h] == GREEN && r[o + 2][h] == WHITE && r_b[o][h] == false && r_b[o + 1][h] == false && r_b[o + 2][h] == false) {
                count++;
                r_b[o][h] = true;
                r_b[o + 1][h] = true;
                r_b[o + 2][h] = true;
            }
        }
    }

    for(int h = 0; h < n; h++){
        for(int o = 0; o < m; o++){
            if(r[h][o] == RED && o + 2 < m && r[h][o + 1] == GREEN && r[h][o + 2] == WHITE && r_b[h][o] == false && r_b[h][o + 1] == false && r_b[h][o + 2] == false){
                count++;
                r_b[h][o] = true;
                r_b[h][o + 1] = true;
                r_b[h][o + 2] = true;
            }
        }
    }
    
    std::cout << count << '\n';

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...