# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1145788 | fatman87878 | Furniture (JOI20_furniture) | C++20 | 1 ms | 1604 KiB |
#include<bits/stdc++.h>
using namespace std;
#define IOS cin.tie(nullptr)->sync_with_stdio(0),cin.exceptions(cin.failbit);
#define lb(x) (x)&-(x)
#define all(x) (x).begin(),(x).end()
#define ll long long
constexpr int maxN=1e3+5;
int n,m,Q,cnt[maxN+maxN],c[maxN][maxN],in[maxN][maxN],out[maxN][maxN];
queue<pair<int,int>> q;
inline bool chk(int x,int y){
if(x>n||x<1||y>m||y<1||c[x][y])return 0;
return 1;
}
inline void push(){
for(int x,y;!q.empty();){
tie(x,y) = q.front(),q.pop();
cnt[x+y]--;
c[x][y] = 1;
if(chk(x-1,y)&&!(--out[x-1][y]))q.emplace(x-1,y);
if(chk(x,y-1)&&!(--out[x][y-1]))q.emplace(x,y-1);
if(chk(x+1,y)&&!(--in[x+1][y]))q.emplace(x+1,y);
if(chk(x,y+1)&&!(--in[x][y+1]))q.emplace(x,y+1);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |