# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112024 | fredbr | Konj (COCI19_konj) | C++17 | 156 ms | 17324 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |