Submission #423365

# Submission time Handle Problem Language Result Execution time Memory
423365 2021-06-11T03:20:02 Z DanerZein Furniture (JOI20_furniture) C++14
5 / 100
1779 ms 596 KB
```#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
int ma[110][110];
int X[3]={0,1};
int Y[3]={1,0};
int n,m;
bool vis[110][110];
bool floyd(int x,int y){
memset(vis,0,sizeof vis);
vis[0][0]=1;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(vis[i][j]){
for(int k=0;k<2;k++){
int xi=i+X[k];
int yi=j+Y[k];
if(xi<n && yi<m && !ma[xi][yi]) vis[xi][yi]=1;
}
}
}
}
return vis[n-1][m-1];
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin>>n>>m;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>ma[i][j];
int q;
cin>>q;
for(int i=0;i<q;i++){
int a,b;
cin>>a>>b;
a--; b--;
ma[a][b]=1;
if(floyd(0,0)) cout<<"1\n";
else{
cout<<"0\n";
ma[a][b]=0;
}
}
}
```

# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 36 ms 332 KB Output is correct
3 Correct 87 ms 384 KB Output is correct
4 Correct 162 ms 424 KB Output is correct
5 Correct 177 ms 556 KB Output is correct
6 Correct 261 ms 444 KB Output is correct
7 Correct 144 ms 452 KB Output is correct
8 Correct 167 ms 460 KB Output is correct
9 Correct 256 ms 448 KB Output is correct

# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 36 ms 332 KB Output is correct
3 Correct 87 ms 384 KB Output is correct
4 Correct 162 ms 424 KB Output is correct
5 Correct 177 ms 556 KB Output is correct
6 Correct 261 ms 444 KB Output is correct
7 Correct 144 ms 452 KB Output is correct
8 Correct 167 ms 460 KB Output is correct
9 Correct 256 ms 448 KB Output is correct
10 Incorrect 1779 ms 596 KB Output isn't correct
11 Halted 0 ms 0 KB -