Submission details
Task:Monikulmio
Sender:zli0122
Submission time:2025-10-27 10:28:02 +0200
Language:C++ (C++11)
Status:READY
Result:69
Feedback
groupverdictscore
#169
Test results
testverdicttimescore
#1ACCEPTED0.00 s10details
#2ACCEPTED0.00 s10details
#3ACCEPTED0.00 s7details
#4ACCEPTED0.00 s7details
#5ACCEPTED0.00 s7details
#6ACCEPTED0.00 s7details
#7ACCEPTED0.00 s7details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#100.00 s0details

Code

#include <bits/stdc++.h>
 
#define debug(x) cout << #x << ": " << (x) << endl
 
using namespace std;

const int N=111, M=111;
const char ascii_char[8]={'.','#','*', '=','/','|','\\','*'};

void solve() {
    int n, m, k;
    cin >> n >> m >> k;
    int grid[N][M]; //0:., 1:#, 2:* normal, 3:=, 4:/, 5:|, 6:backslash, 7:* side vertex

    int r, c, prev_r, prev_c, init_r, init_c;
    cin >> r >> c;
    r-=1; c-=1;
    init_r=r; init_c=c;
    prev_r=r; prev_c=c;
    int init_dr;
    int prev_dr = 0;

    for (int _=1; _<k; _++) {
        cin >> r >> c;
        r-=1; c-=1;

        if (_==1) {init_dr = r-init_r;}
        
        if (r-prev_r == 0 && c-prev_c > 0) for (int i=1;i<c-prev_c;i++) grid[prev_r][prev_c+i] = 3;
        if (r-prev_r == 0 && c-prev_c < 0) for (int i=1;i<prev_c-c;i++) grid[prev_r][prev_c-i] = 3;

        if (r-prev_r > 0 && c-prev_c < 0) for (int i=1;i<r-prev_r;i++) grid[prev_r+i][prev_c-i] = 4;
        if (r-prev_r < 0 && c-prev_c > 0) for (int i=1;i<c-prev_c;i++) grid[prev_r-i][prev_c+i] = 4;
        
        if (r-prev_r > 0 && c-prev_c == 0) for (int i=1;i<r-prev_r;i++) grid[prev_r+i][prev_c] = 5;
        if (r-prev_r < 0 && c-prev_c == 0) for (int i=1;i<prev_r-r;i++) grid[prev_r-i][prev_c] = 5;
        
        if (r-prev_r > 0 && c-prev_c > 0) for (int i=1;i<c-prev_c;i++) grid[prev_r+i][prev_c+i] = 6;
        if (r-prev_r < 0 && c-prev_c < 0) for (int i=1;i<prev_c-c;i++) grid[prev_r-i][prev_c-i] = 6;

        grid[r][c]=2;

        if ((r-prev_r > 0 && prev_dr > 0) || (r-prev_r < 0 && prev_dr < 0)) grid[prev_r][prev_c] = 7;

        prev_dr = r-prev_r;
        prev_r=r;
        prev_c=c;
    }
    
    c=init_c; r=init_r;
    if (r-prev_r == 0 && c-prev_c > 0) for (int i=1;i<c-prev_c;i++) grid[prev_r][prev_c+i] = 3;
    if (r-prev_r == 0 && c-prev_c < 0) for (int i=1;i<prev_c-c;i++) grid[prev_r][prev_c-i] = 3;

    if (r-prev_r > 0 && c-prev_c < 0) for (int i=1;i<r-prev_r;i++) grid[prev_r+i][prev_c-i] = 4;
    if (r-prev_r < 0 && c-prev_c > 0) for (int i=1;i<c-prev_c;i++) grid[prev_r-i][prev_c+i] = 4;

    if (r-prev_r > 0 && c-prev_c == 0) for (int i=1;i<r-prev_r;i++) grid[prev_r+i][prev_c] = 5;
    if (r-prev_r < 0 && c-prev_c == 0) for (int i=1;i<prev_r-r;i++) grid[prev_r-i][prev_c] = 5;
    
    if (r-prev_r > 0 && c-prev_c > 0) for (int i=1;i<c-prev_c;i++) grid[prev_r+i][prev_c+i] = 6;
    if (r-prev_r < 0 && c-prev_c < 0) for (int i=1;i<prev_c-c;i++) grid[prev_r-i][prev_c-i] = 6;

    grid[r][c] = 2;

    if ((r-prev_r > 0 && prev_dr > 0) || (r-prev_r < 0 && prev_dr < 0)) grid[prev_r][prev_c] = 7;

    if ((r-prev_r > 0 && init_dr > 0) || (r-prev_r < 0 && init_dr < 0)) grid[init_r][init_c] = 7;

    int counter;
    for (int r=0; r<n; r++) {
        counter = 0;
        for (int c=0; c<m; c++) {
            // cout << grid[r][c];
            if (grid[r][c] == 0) {
                cout << ascii_char[counter%2];
            } else {
                cout << ascii_char[grid[r][c]];
                if (grid[r][c] >= 4) counter++;
            }
        }
        cout << "\n";
    }
}

 
int main() {
    cin.tie(0) -> ios::sync_with_stdio(0);
    solve();
}

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

Test 10 (public)

Verdict:

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

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

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