Submission #709504

#TimeUsernameProblemLanguageResultExecution timeMemory
709504Spade1Dango Maker (JOI18_dango_maker)C++14
100 / 100
217 ms18200 KiB
#include<bits/stdc++.h> //#include "grader.h" #define pii pair<int, int> #define pll pair<long long, long long> #define ll long long #define ld long double #define st first #define nd second #define pb push_back #define INF INT_MAX using namespace std; const int N = 3e3 + 10; int dp[N][3]; char c[N][N]; void solve() { int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) cin >> c[i][j]; vector<pii> v; int ans = 0; for (int i = 1; i <= n; ++i) v.pb({i, 1}); for (int j = 2; j <= m; ++j) v.pb({n, j}); for (auto [x, y] : v) { memset(dp, 0, sizeof(dp)); int cur = 0; for (; x >= 1 && y <= m; --x, ++y) { dp[y][0] = dp[y-1][0]; if (y >= 3 && c[x][y] == 'W' && c[x][y-1] == 'G' && c[x][y-2] == 'R') { dp[y][1] = max(dp[y][1], max(dp[y-1][1], dp[y-2][1])+1); dp[y][1] = max(dp[y][1], dp[y-3][0]+1); } if (x >= 3 && c[x][y] == 'W' && c[x-1][y] == 'G' && c[x-2][y] == 'R') { dp[y][2] = max(dp[y][2], dp[y-1][0]+1); } dp[y][0] = max(dp[y][0], max(dp[y][1], dp[y][2])); cur = max(cur, dp[y][0]); } ans += cur; } cout << ans << '\n'; } int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int t = 1; // cin >> t; while (t--) { solve(); } return 0; }

Compilation message (stderr)

dango_maker.cpp: In function 'void solve()':
dango_maker.cpp:24:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   24 |     for (auto [x, y] : v) {
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...