# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
100361 | MatesV13 | Konj (COCI19_konj) | C++11 | 74 ms | 9208 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, d, x, y;
int U=1000, D, L=1000 ,R;
char konj[305][305]; bool v[305][305];
void dfs(int x, int y){
v[x][y]=1;
U = min(U,x);
D = max(D,x);
L = min(L,y);
R = max(R,y);
if (x-1>=0 and !v[x-1][y] and konj[x-1][y]=='#') dfs(x-1,y);
if (y-1>=0 and !v[x][y-1] and konj[x][y-1]=='#') dfs(x,y-1);
if (!v[x+1][y] and konj[x+1][y]=='#') dfs(x+1,y);
if (!v[x][y+1] and konj[x][y+1]=='#') dfs(x,y+1);
return;
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
for (int i=0;i<=301;i++){
for (int j=0;j<=301;j++){
konj[i][j]='.';
}
}
cin >> n;
for (int i=0;i<n;i++){
cin >> a >> b >> c >> d;
for (int i=min(a,c);i<=max(a,c);i++){
for (int j=min(b,d);j<=max(b,d);j++){
konj[j][i]='#';
}
}
}
cin >> x >> y;
dfs(x,y);
for (int i=D;i>=U;i--){
for (int j=L;j<=R;j++){
cout << konj[i][j];
}
cout << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |