# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
757089 | qwertyqwerty | Dango Maker (JOI18_dango_maker) | C++17 | 3 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// stars only shine in darkness
#include <bits/stdc++.h>
// date:12-06-2023 21:32:47
using namespace std;
#define retardlord ios_base::sync_with_stdio(NULL), cin.tie(NULL);
#define task freopen("dangomaker.inp", "r", stdin), freopen("dangomaker.out", "w", stdout);
const int N = 3e3 + 1;
int n, m;
char a[N][N];
int f[3], f1[3];
//--------------------------------------------------------------------------------------------------
void nhap()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
cin >> a[i][j];
}
//--------------------------------------------------------------------------------------------------
void xuly()
{
int ans = 0;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
if (a[i][j] == 'G')
{
f1[0] = f1[1] = f1[2] = -1e7;
f1[0] = max({f[0], f[1], f[2]});
if (j - 1 >= 1 && j + 1 <= m && a[i][j - 1] == 'R' && a[i][j + 1] == 'W')
f1[1] = max(f[0], f[1]) + 1;
if (i - 1 >= 1 && i + 1 <= n && a[i - 1][j] == 'R' && a[i + 1][j] == 'W')
f1[2] = max(f[0], f[2]) + 1;
f[0] = f1[0], f[1] = f1[1], f[2] = f1[2];
}
else
{
f[0] = max({f[0], f[1], f[2]});
f[1] = f[2] = -1e7;
}
}
}
ans += max({f[0], f[1], f[2]});
cout << ans;
}
//--------------------------------------------------------------------------------------------------
signed main()
{
retardlord;
#ifndef ONLINE_JUDGE
task;
#endif
nhap();
xuly();
return 0;
}
//--------------------------------------------------------------------------------------------------
컴파일 시 표준 에러 (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... |