Submission details
Task:Monikulmio
Sender:OnlyBitUseless
Submission time:2025-10-27 19:24:04 +0200
Language:C
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.00 s0details

Compiler report

input/code.c: In function 'main':
input/code.c:5:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d %d %d", &n, &m, &k);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.c:27:13: warning: 'yl' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |         int dy = y - yl;
      |             ^~
input/code.c:63:21: warning: 'y0' may be used uninitialized in this function [-Wmaybe-uninitialized]
   63 |         if (x0 == x && y0 == y) break;
      |             ~~~~~~~~^~~~~~~~~~

Code

#include <stdio.h>

int main(){
    int n, m, k;
    scanf("%d %d %d", &n, &m, &k);

    int mx[n][m];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            mx[i][j] = '.';
        }
    }
    
    int x0 = -1, y0, xl = -1, yl, x,y;

    while (scanf("%d %d", &x, &y) == 2){
        printf("[%d, %d] -> [%d, %d]\n", xl, yl, x, y);

        if (x0 < 0) {
            x0 = x;
            y0 = y;
        }
        
        mx[x-1][y-1] = '*';

        int dy = y - yl;
        int dx = x - xl;

        while (!(xl == x) || !(yl == y)) {
            if (xl < 0 || yl < 0) break;

            xl += xl > x ? -1 : xl < x ? 1 : 0;
            yl += yl > y ? -1 : yl < y ? 1 : 0;
            
            if (xl == x && yl == y) break;

            if (dx == 0) {
                mx[xl - 1][yl - 1] = '=';
                continue;
            }
            if (dy/dx > 0) {
                mx[xl - 1][yl - 1] = '\\';
            } else if (dy/dx < 0) {
                mx[xl - 1][yl - 1] = '/';
            } else {
                mx[xl - 1][yl - 1] = '|';
            } 
        }

        xl = x;
        yl = y;
    }

    int dy = y0 - y;
    int dx = x0 - x;

    while (!(x0 == x) || !(y0 == y)) {

        x += x > x0 ? -1 : x < x0 ? 1 : 0;
        y += y > y0 ? -1 : y < y0 ? 1 : 0;
        
        if (x0 == x && y0 == y) break;

        if (dx == 0) {
            mx[x - 1][y -1] = '=';
            continue;
        }
        if (dy/dx > 0) {
            mx[x - 1][y - 1] = '\\';
        } else if (dy/dx < 0) {
            mx[x - 1][y - 1] = '/';
        } else {
            mx[x - 1][y - 1] = '|';
        } 
    }
    
    int in;
    
    for (int i = 0; i < n; i++) {
        in = -1;
        for (int j = 0; j < m; j++) {
            if (!(in < 0) && mx[i][j] == '.') {
                printf("#");
                continue;
            }
            printf("%c", mx[i][j]);
            if (mx[i][j] == '/' || mx[i][j] == '|' || mx[i][j] == '\\') in = in < 0 ? 0 : -1;
        
        }
        printf("\n");
    }
}

Test details

Test 1 (public)

Verdict:

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

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

user output
[-1, -4696] -> [5, 2]
[5, 2] -> [2, 5]
[2, 5] -> [5, 8]
[5, 8] -> [7, 8]
[7, 8] -> [7, 2]
...

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

Test 2 (public)

Verdict:

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

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

user output
[-1, -4696] -> [5, 10]
[5, 10] -> [5, 30]
[5, 30] -> [15, 30]
[15, 30] -> [15, 10]
.................................

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

Test 3 (public)

Verdict:

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

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

user output
[-1, -4696] -> [8, 7]
[8, 7] -> [13, 2]
[13, 2] -> [14, 2]
[14, 2] -> [9, 7]
[9, 7] -> [17, 7]
...

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

Test 4 (public)

Verdict:

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

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

user output
[-1, -4696] -> [5, 12]
[5, 12] -> [5, 25]
[5, 25] -> [8, 28]
[8, 28] -> [13, 28]
[13, 28] -> [16, 25]
...

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

Test 5 (public)

Verdict:

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

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

user output
[-1, -4696] -> [3, 20]
[3, 20] -> [7, 16]
[7, 16] -> [7, 9]
[7, 9] -> [11, 13]
[11, 13] -> [15, 9]
...

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

Test 6 (public)

Verdict:

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

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

user output
[-1, -4696] -> [2, 3]
[2, 3] -> [2, 8]
[2, 8] -> [4, 8]
[4, 8] -> [4, 5]
[4, 5] -> [6, 5]
...

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

Test 7 (public)

Verdict:

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

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

user output
[-1, -4696] -> [6, 10]
[6, 10] -> [6, 14]
[6, 14] -> [7, 14]
[7, 14] -> [7, 18]
[7, 18] -> [8, 18]
...

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

Test 8 (public)

Verdict:

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

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

user output
[-1, -4696] -> [11, 3]
[11, 3] -> [11, 5]
[11, 5] -> [10, 6]
[10, 6] -> [11, 7]
[11, 7] -> [11, 9]
...

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

Test 9 (public)

Verdict:

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

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

user output
[-1, -4696] -> [1, 1]
[1, 1] -> [1, 7]
[1, 7] -> [1, 11]
[1, 11] -> [1, 14]
[1, 14] -> [2, 14]
...

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

Test 10 (public)

Verdict:

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

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

user output
[-1, -4696] -> [10, 1]
[10, 1] -> [4, 7]
[4, 7] -> [1, 4]
[1, 4] -> [1, 9]
[1, 9] -> [2, 8]
...

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