| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 331785 | daniel920712 | Dango Maker (JOI18_dango_maker) | C++14 | 865 ms | 238956 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
char all[3005][3005];
bool have[3005][3005][5]={0};
int DP[3005][3005][5]={0};
int ans=0,a,b,N,M;
int F(int x,int y,int z)
{
if(x>=N||y<0) return 0;
if(have[x][y][z]) return DP[x][y][z];
have[x][y][z]=1;
DP[x][y][z]=F(x+1,y-1,min(z+1,3));
if(y+2<M&&z==3&&all[x][y]=='R'&&all[x][y+1]=='G'&&all[x][y+2]=='W') DP[x][y][z]=max(DP[x][y][z],F(x+1,y-1,min(z+1,3))+1);
if(x+2<N&&all[x][y]=='R'&&all[x+1][y]=='G'&&all[x+2][y]=='W') DP[x][y][z]=max(DP[x][y][z],F(x+1,y-1,1)+1);
return DP[x][y][z];
}
int main()
{
int i,j;
scanf("%d %d",&N,&M);
for(i=0;i<N;i++) scanf("%s",all[i]);
for(i=0;i<M;i++) ans+=F(0,i,3);
for(i=1;i<N;i++) ans+=F(i,M-1,3);
printf("%d\n",ans);
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... | ||||
