Submission #1278384

#TimeUsernameProblemLanguageResultExecution timeMemory
1278384hoangtien69Dango Maker (JOI18_dango_maker)C++20
0 / 100
1 ms332 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 3005; int n, m; int dp[2][MAXN]; 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]); } res += cur; } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...