#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,tes,t,tp,pas,Ffx[50009];
vector <vector <int> > L,P,Lbo;
void dfs(int q, int w){
if(q<1||q>a||w<1||w>b) return;
if(L[q][w]>e) return;
if(Lbo[q][w]==t) return;
Lbo[q][w]=t;
if(Ffx[P[q][w]]!=t){
pas++;
Ffx[P[q][w]]=t;
}
dfs(q-1,w);
dfs(q+1,w);
dfs(q,w-1);
dfs(q,w+1);
}
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>b>>tes;
L.resize(a+2);P.resize(a+2);
for(i=0; i<a+2; i++){
L[i].resize(b+2);P[i].resize(b+2);
}
Lbo=L;
for(i=1; i<=a; i++){
for(j=1; j<=b; j++){
cin>>L[i][j];
}
}
for(i=1; i<=a; i++){
for(j=1; j<=b; j++){
cin>>P[i][j];
}
}
if(tes<=10){
for(t=1; t<=tes; t++){
cin>>tp;
if(tp==1){
cin>>c>>d>>e;swap(c,d);
P[c][d]=e;
continue;
}
if(tp==2){
cin>>c>>d>>e;pas=0;swap(c,d);
dfs(c,d);
cout<<pas<<"\n";
continue;
}
}
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
4820 KB |
Output is correct |
2 |
Correct |
12 ms |
4532 KB |
Output is correct |
3 |
Correct |
16 ms |
4648 KB |
Output is correct |
4 |
Correct |
21 ms |
6456 KB |
Output is correct |
5 |
Correct |
18 ms |
7184 KB |
Output is correct |
6 |
Correct |
21 ms |
7180 KB |
Output is correct |
7 |
Correct |
14 ms |
3156 KB |
Output is correct |
8 |
Correct |
14 ms |
3032 KB |
Output is correct |
9 |
Correct |
12 ms |
2900 KB |
Output is correct |
10 |
Correct |
14 ms |
3280 KB |
Output is correct |
11 |
Correct |
15 ms |
3028 KB |
Output is correct |
12 |
Correct |
14 ms |
2904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
2780 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |