이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define st first
#define nd second
#define eb emplace_back
#define pb push_back
#define pp pop_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
void debug(){cerr<<"\n";}
template<typename H, typename... T>
void debug(H h, T... t){cerr<<h;if(sizeof...(t))cerr<<", ";debug(t...);};
#define deb(x...) cerr<<#x<<" = ";debug(x);
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N=1e3+5, INF=1e9+5;
int czy[N][N], da[N][N];
int main(){
//ios_base::sync_with_stdio(0);cin.tie(0);
int n, m;
cin>>n>>m;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
int x;
cin>>czy[i][j];
}
}
da[n][m+1]=1;
int q;
cin>>q;
while(q--){
int x, y;
cin>>x>>y;
czy[x][y]=1;
for(int i=n; i>0; i--){
for(int j=m; j>0; j--){
da[i][j]=(da[i+1][j]|da[i][j+1])&(!czy[i][j]);
}
}
if(da[1][1]){
cout<<1<<"\n";
}
else{
cout<<0<<"\n";
czy[x][y]=0;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
furniture.cpp: In function 'int main()':
furniture.cpp:31:8: warning: unused variable 'x' [-Wunused-variable]
31 | int x;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |