| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 103051 | tincamatei | Dango Maker (JOI18_dango_maker) | C++14 | 237 ms | 88704 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3000;
int dp[2][1+MAX_N+1][1+MAX_N+1];
char matr[1+MAX_N+1][1+MAX_N+1];
char getch(FILE *fin) {
char ch = fgetc(fin);
while(!isalpha(ch))
ch = fgetc(fin);
return ch;
}
int main() {
#ifdef HOME
FILE *fin = fopen("input.in", "r");
FILE *fout = fopen("output.out", "w");
#else
FILE *fin = stdin;
FILE *fout = stdout;
#endif
int n, m;
fscanf(fin, "%d%d", &n, &m);
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= m; ++j)
matr[i][j] = getch(fin);
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= m; ++j) {
dp[0][i][j] = max(dp[0][i - 1][j + 1], dp[1][i - 1][j + 1]);
dp[1][i][j] = dp[0][i][j];
if(matr[i][j] == 'G' && matr[i][j - 1] == 'R' && matr[i][j + 1] == 'W')
dp[0][i][j] = max(dp[0][i][j], dp[0][i - 1][j + 1] + 1);
if(matr[i][j] == 'G' && matr[i - 1][j] == 'R' && matr[i + 1][j] == 'W')
dp[1][i][j] = max(dp[1][i][j], dp[1][i - 1][j + 1] + 1);
}
int rez = 0;
for(int i = 1; i <= n; ++i)
rez = rez + max(dp[0][i][1], dp[1][i][1]);
for(int i = 2; i <= m; ++i)
rez = rez + max(dp[0][n][i], dp[1][n][i]);
fprintf(fout, "%d", rez);
fclose(fin);
fclose(fout);
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... | ||||
