Submission details
Task:Monikulmio
Sender:Mariia
Submission time:2025-10-29 19:37:14 +0200
Language:C++ (C++20)
Status:READY
Result:85
Feedback
groupverdictscore
#1ACCEPTED85
Test results
testverdicttimescore
#1ACCEPTED0.00 s10details
#2ACCEPTED0.00 s10details
#3ACCEPTED0.00 s7details
#4ACCEPTED0.00 s10details
#5ACCEPTED0.00 s7details
#6ACCEPTED0.00 s10details
#7ACCEPTED0.00 s10details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#10ACCEPTED0.01 s7details

Code

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<char>> t(n, vector<char> (m, '.'));
    vector<vector<int>> ind(n, vector<int> (m, 0));
    vector<pair<int, int>> points;
    for (int i = 0; i < k; i++) {
        int y, x;
        cin >> y >> x;
        y--; x--;
        t[y][x] = '*';
        ind[y][x] = i + 1;
        points.push_back({y, x});
    }
    points.push_back(points[0]);
    for (int i = 1; i <= k; i++) {
        int y0 = points[i - 1].first;
        int x0 = points[i - 1].second;
        int y1 = points[i].first;
        int x1 = points[i].second;
        if (y1 == y0) {
            for (int j = min(x0, x1) + 1; j < max(x0, x1); j++) {
                t[y0][j] = '=';
            }
        } else if (x1 == x0) {
            for (int j = min(y0, y1) + 1; j < max(y0, y1); j++) {
                t[j][x0] = '|';
            }
        } else if (y0 > y1 && x0 < x1) {
            int dif = y0 - y1;
            for (int j = 1; j < dif; j++) {
                t[y0 - j][x0 + j] = '/';
            }
        } else if (y0 > y1 && x0 > x1) {
            int dif = y0 - y1;
            for (int j = 1; j < dif; j++) {
                t[y0 - j][x0 - j] = '\\';
            }
        } else if (y0 < y1 && x0 < x1) {
            int dif = y1 - y0;
            for (int j = 1; j < dif; j++) {
                t[y0 + j][x0 + j] = '\\';
            }
        } else if (y0 < y1 && x0 > x1) {
            int dif = y1 - y0;
            for (int j = 1; j < dif; j++) {
                t[y0 + j][x0 - j] = '/';
            }
        }
    }
    vector<vector<int>> tmp(n, vector<int> (m, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (t[i][j] != '.' && t[i][j] != '*' && t[i][j] != '=') {
                tmp[i][j] = 1;
            } else if (t[i][j] == '*') {
                if (i - 1 < 0) continue;
                if (j - 1 >= 0 && (t[i - 1][j - 1] == '\\' || t[i - 1][j - 1] == '*')) {
                    int ts = abs(ind[i - 1][j - 1] - ind[i][j]);
                    if (t[i - 1][j - 1] == '\\') {
                        tmp[i][j]++;
                        continue;
                    }
                    if (t[i - 1][j - 1] == '*' && ts != 1 && ts != k - 1) continue;
                    tmp[i][j]++;
                }
                if (t[i - 1][j] == '|' || t[i - 1][j] == '*') {
                    int ts = abs(ind[i - 1][j] - ind[i][j]);
                    if (t[i - 1][j] == '|') {
                        tmp[i][j]++;
                        continue;
                    }
                    if (t[i - 1][j] == '*' && ts != 1 && ts != k - 1) continue;
                    tmp[i][j]++;
                }
                if (j + 1 < m && (t[i - 1][j + 1] == '/' || t[i - 1][j + 1] == '*')) {
                    int ts = abs(ind[i - 1][j + 1] - ind[i][j]);
                    if (t[i - 1][j + 1] == '/') {
                        tmp[i][j]++;
                        continue;
                    }
                    if (t[i - 1][j + 1] == '*' && ts != 1 && ts != k - 1) continue;
                    tmp[i][j]++;
                }
            }
        }
    }
    for (int i = 0; i < n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            cnt += tmp[i][j];
            if (t[i][j] == '.' && cnt % 2 == 1 && cnt != 0) {
                t[i][j] = '#';
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cout << t[i][j];
        }
        cout << '\n';
    }
}

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 5, col 33: expected '#', got '.'

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

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

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

Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 33: 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 6, col 4: 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 8, col 39: expected '#', got '.'