Submission #7635788


Source Code Expand

Copy
#![allow(unused_imports, unused_macros, non_snake_case)]
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

//{{{ macros missing in 1.15.1
#[macro_use]
mod macros {
    macro_rules! eprint {
        ($($t:tt)*) => {{
            use ::std::io::Write;
            let _ = write!(::std::io::stderr(), $($t)*);
        }};
    }
    macro_rules! eprintln {
        () => { eprintln!(""); };
        ($($t:tt)*) => {{
            use ::std::io::Write;
            let _ = writeln!(::std::io::stderr(), $($t)*);
        }};
    }
    macro_rules! dbg {
        ($val:expr) => {
            match $val {
                tmp => {
                    eprintln!(
                        "[{}:{}] {} = {:#?}",
                        file!(),
                        line!(),
                        stringify!($val),
                        &tmp
                    );
                    tmp
                }
            }
        };
    }
}
//}}}

fn run() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    let h: usize = sc.read();
    let w: usize = sc.read();
    let a: usize = sc.read();
    let b: usize = sc.read();
    for y in 0..h {
        for x in 0..w {
            let mut zero = true;
            if x < a {
                zero = !zero
            }
            if y < b {
                zero = !zero
            }
            print!("{}", if zero { 0 } else { 1 });
            if x + 1 == w {
                print!("\n");
            }
        }
    }
}

fn main() {
    std::thread::Builder::new()
        .name("run".to_string())
        .stack_size(1024 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap()
}

//{{{ Scanner
pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(r: R) -> Scanner<R> {
        Scanner { reader: r }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
//}}}

Submission Info

Submission Time
Task A - 01 Matrix
User ichyo
Language Rust (1.15.1)
Score 300
Code Size 2714 Byte
Status AC
Exec Time 131 ms
Memory 9468 KB

Compile Error

warning: unknown lint: `unused_macros`, #[warn(unknown_lints)] on by default
 --> ./Main.rs:1:26
  |
1 | #![allow(unused_imports, unused_macros, non_snake_case)]
  |                          ^^^^^^^^^^^^^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 14
Set Name Test Cases
Sample sample-01.txt, sample-02.txt
All 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, sample-01.txt, sample-02.txt
Case Name Status Exec Time Memory
01-01.txt AC 3 ms 8572 KB
01-02.txt AC 3 ms 8572 KB
01-03.txt AC 3 ms 8572 KB
01-04.txt AC 5 ms 8572 KB
01-05.txt AC 4 ms 8572 KB
01-06.txt AC 124 ms 9468 KB
01-07.txt AC 4 ms 8572 KB
01-08.txt AC 77 ms 9084 KB
01-09.txt AC 131 ms 9468 KB
01-10.txt AC 131 ms 9468 KB
01-11.txt AC 131 ms 9468 KB
01-12.txt AC 131 ms 9468 KB
sample-01.txt AC 3 ms 8572 KB
sample-02.txt AC 3 ms 8572 KB