제출 #1278387

#제출 시각아이디문제언어결과실행 시간메모리
1278387hoangtien69Dango Maker (JOI18_dango_maker)C++20
13 / 100
2 ms580 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 3005; int n, m; int dp[MAXN][2]; char a[MAXN][MAXN]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; } } int res = 0; for (int peal = 1; peal <= n + m; peal++) { memset(dp, 0, sizeof dp); int cur = 0; for (int j = min(m, peal - 1), i = peal - j; j >= 1 and i <= n; j--, i++) { dp[j][0] = max(dp[j + 1][0], dp[j + 3][1] + (a[i][j] == 'R' and a[i][j + 1] == 'G' and a[i][j + 2] == 'W')); dp[j][1] = max(dp[j + 1][1], dp[j + 1][0] + (a[i][j] == 'R' and a[i + 1][j] == 'G' and a[i + 2][j] == 'W')); cur = max({dp[j][0], dp[j][1], cur}); } res += cur; } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...