| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1237241 | antromancap | Power Plant (JOI20_power) | C++20 | 0 ms | 320 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], max(dp[j + 1][0], dp[j + 3][1]));
maxi(dp[j][1], max(dp[j + 1][0], dp[j + 1][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) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
