답안 #112025

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112025 2019-05-17T05:47:42 Z fredbr Konj (COCI19_konj) C++17
42 / 70
157 ms 14712 KB
#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 6 ms 2688 KB Output isn't correct
2 Incorrect 5 ms 2688 KB Output isn't correct
3 Correct 157 ms 14712 KB Output is correct
4 Correct 4 ms 2688 KB Output is correct
5 Correct 4 ms 2688 KB Output is correct
6 Correct 4 ms 2688 KB Output is correct
7 Incorrect 4 ms 2688 KB Output isn't correct
8 Incorrect 4 ms 2688 KB Output isn't correct
9 Correct 4 ms 2688 KB Output is correct
10 Correct 4 ms 2688 KB Output is correct