Submission details
Task:Monikulmio
Sender:worst
Submission time:2025-10-27 17:09:40 +0200
Language:C++ (C++20)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttimescore
#1ACCEPTED0.00 s10details
#2ACCEPTED0.00 s10details
#3ACCEPTED0.00 s10details
#4ACCEPTED0.00 s10details
#5ACCEPTED0.00 s10details
#6ACCEPTED0.00 s10details
#7ACCEPTED0.00 s10details
#8ACCEPTED0.00 s10details
#9ACCEPTED0.00 s10details
#10ACCEPTED0.01 s10details

Code

#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<char>> v(n, vector<char>(m, '.'));
    vector<pair<int, int>> l(k);
    map<pair<int, int>, int> cnt;

    for (int i = 0; i < k; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        l[i].first = x;
        l[i].second = y;
        v[x][y] = '*';
    }
    for (int i = 0; i < k; i++) {
        int next = (i + 1) % k;
        // connect l[i] and l[i + 1]
        if (l[i].first == l[next].first) {
            for (int j = min(l[i].second, l[next].second) + 1; j < max(l[i].second, l[next].second); j++) {
                v[l[i].first][j] = '=';
            }
        } else if (l[i].second == l[next].second) {
            for (int j = min(l[i].first, l[next].first) + 1; j < max(l[i].first, l[next].first); j++) {
                v[j][l[i].second] = '|';
            }
        } else {
            int y = l[i].first;
            int x = l[i].second;
            char sp;
            if (y < l[next].first) {
                if (x < l[next].second) {
                    sp = '\\';
                } else {
                    sp = '/';
                }
            } else {
                if (x < l[next].second) {
                    sp = '/';
                } else {
                    sp = '\\';
                }
            }
            while (abs(x - l[next].second) != 1) {
                if (y < l[next].first) {
                    y++;
                } else {
                    y--;
                }
                if (x < l[next].second) {
                    x++;
                } else {
                    x--;
                }

                v[y][x] = sp;
            }
        }

        if (l[i].first < l[next].first) {
            cnt[l[i]]++;
        } else if (l[i].first > l[next].first) {
            cnt[l[next]]++;
        }
    }

    // fill
    for (int i = 0; i < n; i++) {
        bool in = false;
        for (int j = 0; j < m; j++) {
            if (v[i][j] == '.') {
                if (in) {
                    v[i][j] = '#';
                }
            } else if (v[i][j] == '*') {
                if (cnt[{i, j}] == 1) {
                    in = !in;
                }
            } else if (v[i][j] != '=') {
                in = !in;
            }
        }
    }

    // output
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cout << v[i][j];
        }
        cout << endl;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout << fixed << setprecision(6) << endl;

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

Test details

Test 1 (public)

Verdict: ACCEPTED

input
8 9 5
5 2
2 5
5 8
7 8
...

correct output
.........
....*....
.../#\...
../###\..
.*#####*.
...

user output
.........
....*....
.../#\...
../###\..
.*#####*.
...

Test 2 (public)

Verdict: ACCEPTED

input
20 40 4
5 10
5 30
15 30
15 10

correct output
.................................

user output
.................................

Test 3 (public)

Verdict: ACCEPTED

input
20 40 29
8 7
13 2
14 2
9 7
...

correct output
.................................

user output
.................................

Test 4 (public)

Verdict: ACCEPTED

input
20 40 14
5 12
5 25
8 28
13 28
...

correct output
.................................

user output
.................................

Test 5 (public)

Verdict: ACCEPTED

input
20 40 12
3 20
7 16
7 9
11 13
...

correct output
.................................

user output
.................................

Test 6 (public)

Verdict: ACCEPTED

input
9 35 33
2 3
2 8
4 8
4 5
...

correct output
.................................

user output
.................................

Test 7 (public)

Verdict: ACCEPTED

input
30 100 69
6 10
6 14
7 14
7 18
...

correct output
.................................

user output
.................................

Test 8 (public)

Verdict: ACCEPTED

input
40 60 192
11 3
11 5
10 6
11 7
...

correct output
.................................

user output
.................................

Test 9 (public)

Verdict: ACCEPTED

input
50 100 142
1 1
1 7
1 11
1 14
...

correct output
*=====*===*==*...................

user output
*=====*===*==*...................

Test 10 (public)

Verdict: ACCEPTED

input
100 100 1000
10 1
4 7
1 4
1 9
...

correct output
...*====*........................

user output
...*====*........................