Submission details
Task:Monikulmio
Sender:OnlyBitUseless
Submission time:2025-10-27 19:45:39 +0200
Language:C
Status:READY
Result:76
Feedback
groupverdictscore
#1ACCEPTED76
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
#10ACCEPTED0.00 s7details

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:26:13: warning: 'yl' may be used uninitialized in this function [-Wmaybe-uninitialized]
   26 |         int dy = y - yl;
      |             ^~
input/code.c:62:21: warning: 'y0' may be used uninitialized in this function [-Wmaybe-uninitialized]
   62 |         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){

        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 a, l;
    for (int i = 0; i < n; i++) {
        a = -1, l = -1;
        for (int j = 0; j < m; j++) {
            
            if (mx[i][j] == '=') {
                a = -1;
                l = -1;
            } else if (mx[i][j] != '.') {
                if (a < 0) {
                    a = j + 1;
                } else if (l < 0) {
                    l = j;
                }
            }
        }
        
        while (l > a) {
            mx[i][a] = '#';
            a++;
        }
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            printf("%c", mx[i][j]);
        }
        printf("\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 3, col 31: 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 5, col 10: 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 3, col 12: 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 10: 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 3, col 11: 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 2, col 6: expected '#', got '.'