Submission details
Task:Monikulmio
Sender:MikaelM
Submission time:2025-10-27 19:53:35 +0200
Language:C++ (C++17)
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;
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define fi first
#define se second
#define pii pair<int,int>
using ll = long long;

char r[1001][1001];
int u[1001][1001], d[1001][1001], l[1001][1001];


void draw(int y1, int x1, int y2, int x2) {

    r[y1][x1] = r[y2][x2] = '*';
    
    //   |
    if (x1 == x2) {
        if (y2 < y1) swap(y1, y2);
        for (int i = y1+1; i <= y2-1; i++) r[i][x1] = '|';
        u[y2][x2]++;
        d[y1][x1]++;
    }
    
    //   =
    else if (y1 == y2) {
        if (x2 < x1) swap(x1, x2);
        for (int i = x1+1; i <= x2-1; i++) r[y1][i] = '=';
        l[y2][x2]++;
    }

    else {

        if (y1 < y2) {
            swap(x1, x2);
            swap(y1, y2);
        }

        if (x1 < x2) {
            for (int i = 1; i <= x2-x1-1; i++) r[y1-i][x1+i] = '/';
        }
        else {
            for (int i = 1; i <= x1-x2-1; i++) r[y1-i][x1-i] = '\\';
        }

        u[y1][x1]++;
        d[y2][x2]++;

    }
    

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, m, k;
    cin >> n >> m >> k;

    vector<pii> v;
    for (int i = 0; i < k; i++) {
        int y, x;
        cin >> y >> x;
        v.push_back({y, x});
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) r[i][j] = '.';
    }

    for (int i = 0; i < k; i++) draw(v[i].fi, v[i].se, v[(i+1)%k].fi, v[(i+1)%k].se);

    
    
    for (int i = 1; i <= n; i++) {
        bool x = false, p = false;
        for (int j = 1; j <= m; j++) {
            r[i][j] = ((r[i][j] == '.' && x) ? '#' : r[i][j]);
            if (r[i][j] == '|' || r[i][j] == '/' || r[i][j] == '\\') x = !x;
            else if (r[i][j] == '*') {
                if ((u[i][j] && d[i][j])) x = !x;
                else if (l[i][j] && (u[i][j] || d[i][j])) {
                    if (u[i][j] && !p) x = !x;
                    else if (d[i][j] && p) x = !x;
                }
                else if (u[i][j]) p = true;
                else if (d[i][j]) p = false;
            } 
            
        }
    }


    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cout << r[i][j];
        }
        cout << "\n";
    }
    
    
    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
...*====*........................