#include <bits/stdc++.h>
using namespace std;
int const maxn = 310;
char saida[maxn][maxn];
using ii = pair<int, int>;
int lx = 400, rx = 0, ly = 400, ry = 0;
vector<ii> v[maxn][maxn];
char vis[maxn][maxn];
char s[maxn][maxn];
void dfs(int x, int y) {
if (vis[x][y]) return;
lx = min(lx, x);
ly = min(ly, y);
rx = max(rx, x);
ry = max(ry, y);
vis[x][y] = 1;
for (ii uu : v[x][y]) {
int a = uu.first, b = uu.second;
if (a == x) {
if (b > y) {
for (int i = y; i <= b; i++)
s[a][i] = '#';
}
else {
for (int i = b; i <= y; i++)
s[a][i] = '#';
}
} else {
if (a > x) {
for (int i = x; i <= a; i++)
s[i][y] = '#';
}
else {
for (int i = a; i <= x; i++)
s[i][y] = '#';
}
}
dfs(a, b);
}
}
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
memset(s, '.', sizeof(s));
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int x, y, a, b;
cin >> x >> y >> a >> b;
v[x][y].push_back(ii{a, b});
v[a][b].push_back(ii{x, y});
}
int x, y;
cin >> x >> y;
dfs(x, y);
for (int j = ry; j >= ly; j--) {
for (int i = lx; i <= rx; i++) {
cout << s[i][j] <<" ";
}
cout << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
2688 KB |
Output isn't correct |
2 |
Incorrect |
4 ms |
2688 KB |
Output isn't correct |
3 |
Incorrect |
156 ms |
17324 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
2688 KB |
Output isn't correct |
5 |
Incorrect |
5 ms |
2688 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
2688 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
2688 KB |
Output isn't correct |
8 |
Incorrect |
4 ms |
2816 KB |
Output isn't correct |
9 |
Incorrect |
4 ms |
2688 KB |
Output isn't correct |
10 |
Incorrect |
4 ms |
2688 KB |
Output isn't correct |