Submission details
Task:Monikulmio
Sender:dankke
Submission time:2025-10-31 11:07:10 +0200
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.00 s0details
#20.00 s0details
#30.00 s0details
#40.00 s0details
#50.00 s0details
#60.00 s0details
#70.00 s0details
#80.00 s0details
#90.00 s0details
#100.01 s0details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:106:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  106 |     for (size_t i = 0; i < n; i++)
      |                        ~~^~~

Code

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

int sgn(int val) {
    if (val == 0)
    {
        return 0;
    }
    else if (val < 0)
    {
        return -1;
    }
    else
    {
        return 1;
    }
    
}

int main() {
    // Init variables
    int n, m, k; 

    vector<string> board;
    vector<vector<int>> corners;

    cin >> n;
    cin >> m;
    cin >> k;

    // get the corner coords
    for (int i = 0; i < k; i++)
    {   
        int x, y;
        cin >> y;
        cin >> x;
        corners.push_back({y - 1, x - 1});
        
    }
    
    // create board
    for (int i = 0; i < n; i++)
    {
        board.push_back("");
        for (int j = 0; j < m; j++)
        {
            board[i] += ".";
        }
        
    }
    cout << "y: " << board.size() << "\n";
    cout << "x: " << board[0].size() << "\n";


    // mark corners and sides
    vector<int> last_corner;
    last_corner = corners.back();

    
    for (auto &&current_corner : corners)
    {
        int y1, x1, y2, x2, dy, dx;
        string side_char;
        y1 = last_corner[0];
        x1 = last_corner[1];
        y2 = current_corner[0];
        x2 = current_corner[1];
        dy = y1 - y2;
        dx = x1 - x2;
        board[y1].replace(x1, 1, "*");
        if (dy == 0)
        {
            side_char = "=";
        }
        else if (dx == 0)
        {
            side_char = "|";
        }
        else if (dx == dy)
        {
            side_char = "\\";
        }
        else
        {
            side_char = "/";
        }
        //printf("max(): %d \n", max(abs(dx), abs(dy)) - 2);
        printf("dx: %d, dy: %d \n", dx, dy);
        for (int i = 1; i < max(abs(dx), abs(dy)); i++)
        {

            int fy, fx;
            fy = y2 + i * sgn(dy); 
            fx = x2 + i * sgn(dx);
            printf("i: %i \n", i);
            printf("fy: %d, y2: %d, sgn(dy): %d \n", fy, y2, sgn(dy));
            printf("fx: %d, x2: %d, sgn(dx): %d \n", fx, x2, sgn(dx));
            board[fy].replace(fx, 1, side_char);
        }
        last_corner = current_corner;

    }
    cout << board.size() << " " << board[0].size() << "\n";
    for (size_t i = 0; i < n; i++)
    {
        cout << board[i] << "\n";
    }
    cout << endl;
    return 0;
}

Test details

Test 1 (public)

Verdict:

input
8 9 5
5 2
2 5
5 8
7 8
...

correct output
.........
....*....
.../#\...
../###\..
.*#####*.
...

user output
y: 8
x: 9
dx: 0, dy: 2 
i: 1 
fy: 5, y2: 4, sgn(dy): 1 
...

Feedback: Incorrect length on line 1: expected 9, got 2

Test 2 (public)

Verdict:

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

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

user output
y: 20
x: 40
dx: 0, dy: 10 
i: 1 
fy: 5, y2: 4, sgn(dy): 1 
...

Feedback: Incorrect length on line 1: expected 40, got 2

Test 3 (public)

Verdict:

input
20 40 29
8 7
13 2
14 2
9 7
...

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

user output
y: 20
x: 40
dx: 18, dy: 0 
i: 1 
fy: 7, y2: 7, sgn(dy): 0 
...

Feedback: Incorrect length on line 1: expected 40, got 2

Test 4 (public)

Verdict:

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

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

user output
y: 20
x: 40
dx: 0, dy: 13 
i: 1 
fy: 5, y2: 4, sgn(dy): 1 
...

Feedback: Incorrect length on line 1: expected 40, got 2

Test 5 (public)

Verdict:

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

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

user output
y: 20
x: 40
dx: 4, dy: 4 
i: 1 
fy: 3, y2: 2, sgn(dy): 1 
...

Feedback: Incorrect length on line 1: expected 40, got 2

Test 6 (public)

Verdict:

input
9 35 33
2 3
2 8
4 8
4 5
...

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

user output
y: 9
x: 35
dx: -1, dy: 1 
dx: -5, dy: 0 
i: 1 
...

Feedback: Incorrect length on line 1: expected 35, got 2

Test 7 (public)

Verdict:

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

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

user output
y: 30
x: 100
dx: -3, dy: 3 
i: 1 
fy: 6, y2: 5, sgn(dy): 1 
...

Feedback: Incorrect length on line 1: expected 100, got 2

Test 8 (public)

Verdict:

input
40 60 192
11 3
11 5
10 6
11 7
...

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

user output
y: 40
x: 60
dx: 1, dy: 1 
dx: -2, dy: 0 
i: 1 
...

Feedback: Incorrect length on line 1: expected 60, got 2

Test 9 (public)

Verdict:

input
50 100 142
1 1
1 7
1 11
1 14
...

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

user output
y: 50
x: 100
dx: 0, dy: 2 
i: 1 
fy: 1, y2: 0, sgn(dy): 1 
...

Feedback: Incorrect length on line 1: expected 100, got 2

Test 10 (public)

Verdict:

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

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

user output
y: 100
x: 100
dx: 0, dy: 1 
dx: -6, dy: 6 
i: 1 
...

Feedback: Incorrect length on line 1: expected 100, got 2