Submission details
Task:Monikulmio
Sender:aa10
Submission time:2025-10-29 19:12:12 +0200
Language:C++ (C++17)
Status:READY
Result:35
Feedback
groupverdictscore
#135
Test results
testverdicttimescore
#1ACCEPTED0.00 s7details
#2ACCEPTED0.00 s7details
#30.00 s0details
#40.00 s0details
#50.00 s0details
#6ACCEPTED0.00 s7details
#70.00 s0details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#100.00 s0details

Code

#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main() {
    // main input
    int n, m, k;
    cin >> n;
    cin >> m;
    cin >> k;
    
    // create the list
    vector<string> rows;
    for (int i = 0; i < n; i++){
        string row (m, '.');
        rows.push_back(row);
    }
    
    // add start point
    int y, x, prev_y, prev_x, start_y, start_x;
    cin >> y;
    cin >> x;
    start_y = y;
    start_x = x;
    rows[y-1][x-1] = '*';
    
    // add characters to the list
    for (int i = 1; i <= k; i++){
        prev_y = y;
        prev_x = x;
        if (i == k){ // back to start
            y = start_y;
            x = start_x;
        } else {
            cin >> y;
            cin >> x;
        }
        
        // add * to the point
        rows[y-1][x-1] = '*';
        
        // add lines between current and last point
        if (x == prev_x){ // up/down
            for (int j = 1; j < abs(prev_y-y); j++){
                if (y > prev_y){
                    rows[y-j-1][x-1] = '|';
                } else {
                    rows[y+j-1][x-1] = '|';
                }
            }
        }
        else if (y == prev_y){ // left/right
            for (int j = 1; j < abs(prev_x-x); j++){
                if (x > prev_x){
                    rows[y-1][x-j-1] = '=';
                } else {
                    rows[y-1][x+j-1] = '=';
                }
            }
        }
        else { // diagonal
            for (int j = 1; j < abs(prev_y-y); j++){
                if (x > prev_x && y > prev_y){
                    rows[y-j-1][x-j-1] = '\\';
                }
                else if  (x > prev_x && y < prev_y){
                    rows[y+j-1][x-j-1] = '/';
                }
                else if (y > prev_y){
                   rows[y-j-1][x+j-1] = '\\';
                }
                else {
                    rows[y+j-1][x+j-1] = '/';
                }
            }
        }
    }
    
    // print the list
    for (string row : rows){
        cout << row << endl;
    }

    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
.........
....*....
.../.\...
../...\..
.*.....*.
...

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

Test 2 (public)

Verdict: ACCEPTED

input
20 40 4
5 10
5 30
15 30
15 10

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

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

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

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 3, col 3: 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 '/'