제출 #992692

#제출 시각아이디문제언어결과실행 시간메모리
992692yellowtoadDango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms348 KiB
#include <iostream> using namespace std; int n, m, dp[6010][3], sum, x, y, cnt; char c[3010][3010]; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> c[i][j]; for (int i = 1; i <= 6; i++) { x = i; y = 1; cnt = 0; while ((x >= 1) && (y <= m)) { ++cnt; dp[cnt][0] = max(dp[cnt-1][0],max(dp[cnt-1][1],dp[cnt-1][2])); if ((x <= n) && (c[x][y] == 'G')) { if ((c[x-1][y] == 'R') && (c[x+1][y] == 'W')) dp[cnt][1] = max(dp[cnt-1][0],dp[cnt-1][1])+1; else dp[cnt][1] = 0; if ((c[x][y-1] == 'R') && (c[x][y+1] == 'W')) dp[cnt][2] = max(dp[cnt-1][0],dp[cnt-1][2])+1; else dp[cnt][2] = 0; } else dp[cnt][1] = dp[cnt][2] = 0; x--; y++; } sum += max(dp[cnt][0],max(dp[cnt][1],dp[cnt][2])); } cout << sum << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...