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;
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 |
---|
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... |