Submission #916529

#TimeUsernameProblemLanguageResultExecution timeMemory
916529vjudge1Dango 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 false; } bool overlap(int x, int y) { if (validG(x,y) + validG(x-1,y+1) == 3) return true; } 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)) { 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)) { ans++; if(overlap(x,y)) { x--; y++; } } x--; y++; } } cout << ans << endl; }

Compilation message (stderr)

dango_maker.cpp: In function 'bool overlap(int, int)':
dango_maker.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...