#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("");
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
18556 KB |
Output is correct |
2 |
Correct |
0 ms |
18556 KB |
Output is correct |
3 |
Correct |
3 ms |
18556 KB |
Output is correct |
4 |
Correct |
3 ms |
18556 KB |
Output is correct |
5 |
Correct |
20 ms |
18556 KB |
Output is correct |
6 |
Correct |
17 ms |
18556 KB |
Output is correct |
7 |
Correct |
12 ms |
18556 KB |
Output is correct |
8 |
Correct |
84 ms |
18556 KB |
Output is correct |
9 |
Correct |
69 ms |
18556 KB |
Output is correct |
10 |
Correct |
193 ms |
18556 KB |
Output is correct |
11 |
Correct |
155 ms |
18556 KB |
Output is correct |
12 |
Correct |
159 ms |
18556 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
18556 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
18556 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5000 ms |
18552 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
18556 KB |
Output is correct |
2 |
Correct |
0 ms |
18556 KB |
Output is correct |
3 |
Correct |
0 ms |
18556 KB |
Output is correct |
4 |
Correct |
0 ms |
18556 KB |
Output is correct |
5 |
Incorrect |
288 ms |
18556 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |