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 <cstdio>
char str[705][705][28];
int m, n;
int cgrowth[705][705];
int sessgrowth[705][705];
void fill_growth(){
for(int i=2; i<=m; i++){
for(int j=2; j<=m; j++){
int que = sessgrowth[i][j-1] * 9 + sessgrowth[i-1][j-1] * 3 + sessgrowth[i-1][j];
if(str[i][j][que] == 'L'){
sessgrowth[i][j] = sessgrowth[i][j-1];
}
else if(str[i][j][que] == 'D'){
sessgrowth[i][j] = sessgrowth[i-1][j-1];
}
else{
sessgrowth[i][j] = sessgrowth[i-1][j];
}
}
}
}
int main(){
scanf("%d %d",&m,&n);
for(int i=1; i<=m; i++){
for(int j=1; j<=m; j++){
cgrowth[i][j] = 1;
}
}
for(int i=2; i<=m; i++){
for(int j=2; j<=m; j++){
scanf("%s",str[i][j]);
}
}
for(int i=0; i<n; i++){
int a, b, c;
scanf("%d %d %d",&a,&b,&c);
int pt = m;
for(int i=m; i; i--){
if(a) sessgrowth[i][0] = 0, a--;
else if(b) sessgrowth[i][1] = 1, b--;
else sessgrowth[i][1] = 2, c--;
}
for(int i=2; i<=m; i++){
if(a) sessgrowth[1][i] = 0, a--;
else if(b) sessgrowth[1][i] = 1, b--;
else sessgrowth[1][i] = 2, c--;
}
fill_growth();
for(int i=1; i<=m; i++){
for(int j=1; j<=m; j++){
cgrowth[i][j] += sessgrowth[i][j];
}
}
}
for(int i=1; i<=m; i++){
for(int j=1; j<=m; j++){
printf("%d ",cgrowth[i][j]);
}
puts("");
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |