# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
391162 | keta_tsimakuridze | Furniture (JOI20_furniture) | C++14 | 2301 ms | 36732 KiB |
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>
#define f first
#define int long long
#define s second
using namespace std;
const int N=1005,mod=1e9+7;
int t,d2[N][N],d1[N][N],p[N][N],n,m,cnt[2*N];
queue<pair<int,int> > q;
char c[N][N];
bool ok(int x,int y){
if(min(x,y)<1 || x>n || y>m) return 0;
return 1;
}
void dfs1(int x,int y){
if(d1[x][y] || c[x][y]=='1') return;
d1[x][y]=1;
if(ok(x+1,y)) dfs1(x+1,y);
if(ok(x,y+1)) dfs1(x,y+1);
}
void dfs2(int x,int y){
if(d2[x][y] || c[x][y]=='1') return;
d2[x][y]=1;
if(ok(x-1,y)) dfs2(x-1,y);
if(ok(x,y-1)) dfs2(x,y-1);
}
void update1(int x,int y){
if(ok(x+1,y) && p[x+1][y] && !p[x+1][y-1]) q.push({x+1,y});
if(ok(x,y+1) && p[x][y+1] && !p[x-1][y+1]) q.push({x,y+1});
while(q.size()){
x=q.front().f;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |