Submission details
Task:Monikulmio
Sender:MikaelM
Submission time:2025-10-27 19:28:32 +0200
Language:C++ (C++17)
Status:READY
Result:76
Feedback
groupverdictscore
#1ACCEPTED76
Test results
testverdicttimescore
#1ACCEPTED0.00 s10details
#2ACCEPTED0.00 s10details
#3ACCEPTED0.00 s7details
#4ACCEPTED0.00 s7details
#5ACCEPTED0.01 s7details
#6ACCEPTED0.00 s7details
#7ACCEPTED0.00 s7details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#10ACCEPTED0.00 s7details

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];


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] = '|';
    }
    
    //   =
    else if (y1 == y2) {
        if (x2 < x1) swap(x1, x2);
        for (int i = x1+1; i <= x2-1; i++) r[y1][i] = '=';
    }

    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] = '\\';
        }

    }
    

}

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);

    

    bool x = false;
    for (int i = 1; i <= n; i++) {
        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 (
                    (r[i-1][j] == '|' || r[i-1][j-1] == '\\' || r[i-1][j+1] == '/') &&
                    (r[i+1][j] == '|' || r[i+1][j-1] == '/' || r[i+1][j+1] == '\\')
                ) {
                    x = !x;
                }
            }
        }
    }


    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
.................................

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

Test 4 (public)

Verdict: ACCEPTED

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

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

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

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

Test 5 (public)

Verdict: ACCEPTED

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

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

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

Feedback: Lines are drawn correctly. Incorrect fill character on row 7, col 17: 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 3, col 3: expected '#', got '.'

Test 7 (public)

Verdict: ACCEPTED

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

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

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

Feedback: Lines are drawn correctly. Incorrect fill character on row 7, col 19: 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 15: expected '.', got '#'

Test 10 (public)

Verdict: ACCEPTED

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

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

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

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