Submission details
Task:Monikulmio
Sender:worst
Submission time:2025-10-27 16:12:12 +0200
Language:C++ (C++20)
Status:READY
Result:41
Feedback
groupverdictscore
#141
Test results
testverdicttimescore
#1ACCEPTED0.00 s10details
#2ACCEPTED0.00 s10details
#30.00 s0details
#40.00 s0details
#50.00 s0details
#6ACCEPTED0.00 s7details
#70.00 s0details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.01 s7details
#100.00 s0details

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);
    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;
            while (abs(x - l[next].second) != 1) {
                if (y < l[next].first) {
                    y++;
                    sp = '\\';
                } else {
                    y--;
                    sp = '/';
                }
                if (x < l[next].second) {
                    x++;
                } else {
                    x--;
                }

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

    vector<bool> can(n, false);
    for (int i = 0; i < n; i++) {
        int c = 0;
        for (int j = 0; j < m; j++) {
            if (v[i][j] != '.') {
                c++;
            }
        }
        if (c >= 2) {
            can[i] = true;
        }
    }

    for (int i = 0; i < n; i++) {
        if (!can[i]) {
            continue;
        }
        bool in = false;
        for (int j = 0; j < m; j++) {
            if (v[i][j] != '.') {
                if (v[i][j] != '=') {
                    in = !in;
                }
            } else {
                if (in) {
                    v[i][j] = '#';
                }
            }
        }
    }

    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:

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

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

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

Feedback: Incorrect character on row 4, col 29: expected '/', got '\'

Test 4 (public)

Verdict:

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

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

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

Feedback: Incorrect character on row 4, col 27: expected '\', got '/'

Test 5 (public)

Verdict:

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

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

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

Feedback: Incorrect character on row 4, col 19: expected '/', got '\'

Test 6 (public)

Verdict: ACCEPTED

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

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

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

Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 9: expected '.', got '#'

Test 7 (public)

Verdict:

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

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

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

Feedback: Incorrect character on row 10, col 8: expected '\', got '/'

Test 8 (public)

Verdict: ACCEPTED

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

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

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

Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 30: expected '#', got '.'

Test 9 (public)

Verdict: ACCEPTED

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

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

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

Feedback: Lines are drawn correctly. Incorrect fill character on row 2, col 11: expected '#', got '.'

Test 10 (public)

Verdict:

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

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

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

Feedback: Incorrect character on row 2, col 5: expected '\', got '/'