제출 #916533

#제출 시각아이디문제언어결과실행 시간메모리
916533vjudge1Dango Maker (JOI18_dango_maker)C++11
13 / 100
1 ms348 KiB
#include <iostream> using namespace std; int N, M, ans; char a[3010][3010]; int validG(int x, int y) { if (a[x-1][y] == 'R' && a[x][y] == 'G' && a[x+1][y] == 'W') return 1; if (a[x][y-1] == 'R' && a[x][y] == 'G' && a[x][y+1] == 'W') return 2; return 0; } bool overlap(int x, int y) { return (validG(x,y) + validG(x-1,y+1) == 3); } int main() { cin >> N >> M; for(int i=1; i<=N; i++) { for(int j=1; j<=M; j++) { cin >> a[i][j]; } } for(int i=1; i<=N; i++) { int x = i; int y = 1; while(x>=1 && y<=M) { if (validG(x,y) > 0) { ans++; if(overlap(x,y)) { x--; y++; } } x--; y++; } } for(int j=2; j<=M; j++) { int x = N; int y = j; while(x>=1 && y<=M) { if (validG(x,y) > 0) { ans++; if(overlap(x,y)) { x--; y++; } } x--; y++; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...