Submission details
Task:Monikulmio
Sender:wolruso
Submission time:2025-10-29 18:15:57 +0200
Language:Rust (2021)
Status:READY
Result:70
Feedback
groupverdictscore
#1ACCEPTED70
Test results
testverdicttimescore
#1ACCEPTED0.00 s7details
#2ACCEPTED0.00 s7details
#3ACCEPTED0.00 s7details
#4ACCEPTED0.00 s7details
#5ACCEPTED0.00 s7details
#6ACCEPTED0.00 s7details
#7ACCEPTED0.00 s7details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#10ACCEPTED0.00 s7details

Code

use std::{io::stdin, str::from_utf8_unchecked};

fn main() {
    let mut l = String::new();
    stdin().read_line(&mut l).unwrap();
    let mut t = l.split(' ');
    let n: usize = t.next().unwrap().parse().unwrap();
    let m: usize = t.next().unwrap().parse().unwrap();
    let k: usize = t.next().unwrap().trim().parse().unwrap();
    let mut d: Vec<Vec<u8>> = Vec::with_capacity(n);
    for _ in 0..n {
        let mut s = Vec::with_capacity(m);
        for _ in 0..m {
            s.push('.' as u8);
        }
        d.push(s);
    }
    let mut p: Vec<[usize; 2]> = Vec::with_capacity(k);
    for _ in 0..k {
        let mut pl = String::new();
        stdin().read_line(&mut pl).unwrap();
        let mut pt = pl.split(' ');
        let y: usize = pt.next().unwrap().parse().unwrap();
        let x: usize = pt.next().unwrap().trim().parse().unwrap();
        p.push([x - 1, y - 1])
    }
    for i in 0..k {
        let px = p[i][0];
        let py = p[i][1];
        d[py][px] = '*' as u8;
        if i == (k - 1) && k < 3 {
            break;
        }
        let np = (i + 1) % k;
        let nx = p[np][0];
        let ny = p[np][1];
        let (sx, sy, mx, my, dx, dy);
        if px > nx {
            sx = nx;
            mx = px;
        } else {
            sx = px;
            mx = nx;
        }
        dx = mx - sx;
        if py > ny {
            sy = ny;
            my = py;
        } else {
            sy = py;
            my = ny;
        }
        dy = my - sy;
        if dx == 0 {
            for j in (sy + 1)..my {
                d[j][px] = '|' as u8;
            }
        } else if dy == 0 {
            for j in (sx + 1)..mx {
                d[py][j] = '=' as u8;
            }
        } else if dx == dy {
            let c;
            if (nx > px && ny < py) || (nx < px && ny > py) {
                c = '/' as u8;
                for j in 1..dx {
                    d[sy + j][sx + (dx - j)] = c;
                }
            } else {
                c = '\\' as u8;
                for j in 1..dx {
                    d[sy + j][sx + j] = c;
                }
            }
        }
    }
    for i in 0..n {
        println!("{}", unsafe { from_utf8_unchecked(&d[i]) });
    }
}

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: 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 4, col 30: 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 4, 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 4, col 20: 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: 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 2, 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 '.'