Submission details
Task:Monikulmio
Sender:vulpesomnia
Submission time:2025-10-27 11:54:43 +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.01 s7details
#10ACCEPTED0.03 s7details

Compiler report

warning: unused variable: `i`
  --> input/code.rs:14:9
   |
14 |     for i in 0..k {
   |         ^ help: if this is intentional, prefix it with an underscore: `_i`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `j`
  --> input/code.rs:44:17
   |
44 |             for j in 0..dy.abs() {
   |                 ^ help: if this is intentional, prefix it with an underscore: `_j`

warning: unused variable: `j`
  --> input/code.rs:51:17
   |
51 |             for j in 0..dx.abs() {
   |                 ^ help: if this is intentional, prefix it with an underscore: `_j`

warning: unused variable: `j`
  --> input/code.rs:61:17
   |
61 |             for j in 0..dx.abs() {
   |                 ^ help: if this is intentional, prefix it with an underscore: `_j`

warning: 4 warnings emitted

Code

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("failed to readline");
    let mut iter = input.trim().split_whitespace();
    let (n, m, k): (i32, i32, i32) = (
        iter.next().unwrap().parse().unwrap(),
        iter.next().unwrap().parse().unwrap(),
        iter.next().unwrap().parse().unwrap(),
    );
    
    let mut points: Vec<(i32, i32)> = Vec::new();
    for i in 0..k {
        let mut point = String::new();
        io::stdin().read_line(&mut point).expect("failed to readline");
        let mut iter2 = point.trim().split_whitespace();
        let (y, x): (i32, i32) = (
            iter2.next().unwrap().parse().unwrap(),
            iter2.next().unwrap().parse().unwrap(),
        );
        points.push((x, y));
    }

    let mut descending: Vec<(i32, i32)> = Vec::new();
    let mut ascending: Vec<(i32, i32)> = Vec::new();
    let mut horizontal: Vec<(i32, i32)> = Vec::new();
    let mut vertical: Vec<(i32, i32)> = Vec::new();
    
    let size = points.len();
    for (i, (px, py)) in points.clone().into_iter().enumerate() {
        let p1: (i32, i32) = (px, py);
        let p2: (i32, i32);
        if i == size - 1 {
            p2 = points[0];
        } else {
            p2 = points[i+1];
        }
        let dx = p2.0 - p1.0;
        let dy = p2.1 - p1.1;
        if dx == 0 { // Vertical
            let mut ny = p1.1;
            let step = dy/(dy.abs());
            for j in 0..dy.abs() {
                vertical.push((p1.0, ny));
                ny += step;
            }
        } else if dy == 0 { // Horizontal
            let mut nx = p1.0;
            let step = dx/(dx.abs());
            for j in 0..dx.abs() {
                horizontal.push((nx ,p1.1));
                nx += step;
            }
        } else {
            let k = dy/dx;
            let mut nx = p1.0;
            let mut ny = p1.1;
            let step_x = dx/(dx.abs());
            let step_y = dy/(dy.abs());
            for j in 0..dx.abs() {
                if k == -1 { // Ascending
                    ascending.push((nx ,ny));
                } else {
                    descending.push((nx ,ny));
                }
                nx += step_x;
                ny += step_y;
            }
        }
    }

    for i in 0..n {
        let mut line = String::new();
        'row: for j in 0..m {
            for (x, y) in &points {
                if (j + 1, i + 1) == (*x, *y) {
                    line.push('*');
                    continue 'row;
                }
            }
            for (x, y) in &horizontal {
                if (j + 1, i + 1) == (*x, *y) {
                    line.push('=');
                    continue 'row;
                }
            }
            for (x, y) in &vertical {
                if (j + 1, i + 1) == (*x, *y) {
                    line.push('|');
                    continue 'row;
                }
            }
            for (x, y) in &ascending {
                if (j + 1, i + 1) == (*x, *y) {
                    line.push('/');
                    continue 'row;
                }
            }
            for (x, y) in &descending {
                if (j + 1, i + 1) == (*x, *y) {
                    line.push('\\');
                    continue 'row;
                }
            }
            line.push('.');
        }
        println!("{}", line);
    }

    
}

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 '.'