#include <bits/stdc++.h>
using namespace std;
int n;
using pii = pair<int,int>;
vector<pii> rot = {{1,0},{0,1},{0,-1},{-1,0}};
char mat[400][400];
void draw_point(int a,int b,int c,int d){
for(int x = min(a,c);x<=max(a,c);x++){
mat[x][b] = '@';
}
for(int y = min(b,d);y<=max(b,d);y++){
mat[a][y] = '@';
}
}
int mixp = 1e9;
int miyp = 1e9;
int maxp = -1e9;
int mayp = -1e9;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
memset(mat,'.',sizeof(mat));
for(int i=0;i<n;i++){
int a,b,c,d;
cin >> a >> b >> c >> d;
b = 305 - b;
d = 305 - d;
draw_point(a,b,c,d);
}
int x,y;
cin >> x >> y;
y = 305 - y;
queue<pii> coda;
coda.push({x,y});
do{
auto cima = coda.front();
coda.pop();
if(cima.first < 0 || cima.second < 0) continue;
if(mat[cima.first][cima.second] != '@') continue;
mat[cima.first][cima.second] = '#';
mixp = min(mixp,cima.first);
maxp = max(maxp,cima.first);
miyp = min(miyp,cima.second);
mayp = max(mayp,cima.second);
for(auto el : rot){
coda.push({el.first + cima.first, el.second + cima.second});
}
}while(!coda.empty());
for(int i=miyp;i<=mayp;i++){
for(int j=mixp;j<=maxp;j++){
cout<<mat[j][i];
}cout<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
53 ms |
504 KB |
Output is correct |
4 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
9 |
Correct |
2 ms |
512 KB |
Output is correct |
10 |
Correct |
3 ms |
512 KB |
Output is correct |