제출 #1237235

#제출 시각아이디문제언어결과실행 시간메모리
1237235antromancapDango Maker (JOI18_dango_maker)C++20
100 / 100
104 ms9292 KiB
#include <bits/stdc++.h> using namespace std; template <class T> bool mini(T &x, const T &y) { return y < x ? x = y, 1 : 0; } template <class T> bool maxi(T &x, const T &y) { return y > x ? x = y, 1 : 0; } const int N = 3005; int n, m, dp[N][2]; char a[N][N]; bool okr(int i, int j) { return a[i][j] == 'R' && a[i][j + 1] == 'G' && a[i][j + 2] == 'W'; } bool okd(int i, int j) { return a[i][j] == 'R' && a[i + 1][j] == 'G' && a[i + 2][j] == 'W'; } // rgw // rgw // rgw // rgw int main() { ios::sync_with_stdio(0); cin.tie(0); scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1); int res = 0; for (int d = 2; d <= n + m; d++) { memset(dp, 0, sizeof dp); int ans = 0; for (int j = min(d - 1, m), i = d - j; j && i <= n; j--, i++) { maxi(dp[j][0], dp[j + 1][0]); maxi(dp[j][1], max(dp[j + 1][0], dp[j + 1][1])); maxi(dp[j][0], max(dp[j + 3][0], dp[j + 3][1])); maxi(dp[j][1], max(dp[j + 3][0], dp[j + 3][1])); dp[j][0] += okr(i, j); dp[j][1] += okd(i, j); maxi(ans, max(dp[j][0], dp[j][1])); } res += ans; } cout << res; }

컴파일 시 표준 에러 (stderr) 메시지

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("%d%d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~
dango_maker.cpp:24:43: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
      |                                      ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...