제출 #588980

#제출 시각아이디문제언어결과실행 시간메모리
588980SwanDango Maker (JOI18_dango_maker)C++14
0 / 100
1 ms340 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
//#define int long long
#define INP freopen("palpath.in","r",stdin)
#define OUTP freopen("palpath.out","w",stdout)

using namespace std;

int n, m;
const int maxn = 3005;

char arr[maxn][maxn];
int r[maxn][maxn];
int d[maxn][maxn];
bool check[maxn][maxn];
int cnt;
vector<vector<int> > v;

// RGW

int main(){
   ios_base::sync_with_stdio(0);
   cin >> n >> m;
   v.resize(n * m);
   for(int i = 0; i < n;i++) {
      for(int j = 0; j < m;j++) {
         r[i][j] = -1;
         d[i][j] = -1;
         cin >> arr[i][j];
      }
   }
   int ans = 0;
   for(int i = 0; i < n;i++) {
      for(int j = 0; j < m; j++) {
         if (j + 2 < m) {
            if ((arr[i][j] == 'R') && (arr[i][j + 1] == 'G') && (arr[i][j + 2] == 'W') && !check[i][j] && !check[i][j + 1] && !check[i][j + 2]) {
               ans++;
               check[i][j] = 1;
               check[i][j + 1] = 1;
               check[i][j + 2] = 1;
            }
         }
         if (i + 2 < n) {
            if ((arr[i][j] == 'R') && (arr[i + 1][j] == 'G') && (arr[i + 2][j] == 'W') && !check[i][j] && !check[i + 1][j] && !check[i + 2][j]) {
               ans++;
               check[i][j] = 1;
               check[i + 1][j] = 1;
               check[i + 1][j] = 1;
            }
         }
      }
   }
   cout << ans;
   return 0;
}

/* 
1
3
1 3 6
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...