Submission details
Task:Monikulmio
Sender:OnlyBitUseless
Submission time:2025-10-29 11:55:55 +0200
Language:C
Status:READY
Result:94
Feedback
groupverdictscore
#1ACCEPTED94
Test results
testverdicttimescore
#1ACCEPTED0.00 s10details
#2ACCEPTED0.00 s10details
#3ACCEPTED0.00 s10details
#4ACCEPTED0.00 s10details
#5ACCEPTED0.00 s10details
#6ACCEPTED0.00 s10details
#7ACCEPTED0.00 s10details
#8ACCEPTED0.00 s10details
#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:25:13: warning: 'yl' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |         int dy = y - yl;
      |             ^~
input/code.c:61:21: warning: 'y0' may be used uninitialized in this function [-Wmaybe-uninitialized]
   61 |         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] = '|';
        } 
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (mx[i][j] == '#') {
                if ((i == 0 || i == n - 1) || (j == 0 || j == m-1)) {
                    mx[i][j] = '.';
                    continue; 
                }
                if (mx[i][j-1] == '.' || mx[i-1][j] == '.') mx[i][j] = '.';
            }
        }
    }
    
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (mx[n-i][m-j] == '#') {
                if (mx[n-i][m-j+1] == '.' || mx[n-i+1][m-j] == '.') mx[n-i][m-j] = '.';
            }
        }
    }
    
    for (int i = 1; i <= m; i++) {
        for (int j = 0; j < n; j++) {
            if (mx[j][m-i] == '#') {
                if (mx[j][m-i+1] == '.' || mx[j-1][m-i] == '.') mx[j][m-i] = '.';
            }
        }
    }
    
    for (int i = 0; i < m; i++) {
        for (int j = 1; j <= n; j++) {
            if (mx[n-j][i] == '#') {
                if (mx[n-j][i-1] == '.' || mx[n-j+1][i] == '.') mx[n-j][i] = '.';
            }
        }
    }
    
    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
.................................

Test 4 (public)

Verdict: ACCEPTED

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

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

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

Test 5 (public)

Verdict: ACCEPTED

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

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

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

Test 6 (public)

Verdict: ACCEPTED

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

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

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

Test 7 (public)

Verdict: ACCEPTED

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

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

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

Test 8 (public)

Verdict: ACCEPTED

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

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

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

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