# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
66854 | yusufake | Dango Maker (JOI18_dango_maker) | C++98 | 1393 ms | 198408 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N = 3e3 + 3;
int M[N][N][2][2],H[N][N],m,n,i,j,ans;
char A[N][N];
int f(int x, int y, int a, int b){
if(A[x][y] != 'G') return 0;
H[x][y] = 1;
int &r = M[x][y][a][b];
if(r != -1) return r;
if(a && A[x][y-1] == 'R') r = max(r , f(x+1,y-1,A[x+1][y]=='W',0)+1);
if(b && A[x+1][y] == 'W') r = max(r , f(x+1,y-1,0,A[x][y-1]=='R')+1);
return r = max(r , f(x+1,y-1,A[x+1][y]=='W',A[x][y-1]=='R'));
}
int main(){
scanf("%d%d",&m,&n);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
Compilation message (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... |