Submission #3719271


Source Code Expand

#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(dead_code)]
pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer)
}

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) } ; }
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(dead_code)]
const BIG_STACK_SIZE: bool = false;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
#[allow(dead_code)]
fn solve() {
    let out = stdout();
    let mut out = out.lock();
    let mut board = read_vec2::<String>(4u32);
    //println!("{:?}", board)
    for i in (0..4).rev() {
        for j in (0..4).rev() {
            write!(out, "{} ", board[i][j]).unwrap();
        }
        write!(out, "\n").unwrap();
    }
}

Submission Info

Submission Time
Task B - 回転
User wh317706
Language Rust (1.15.1)
Score 100
Code Size 3413 Byte
Status AC
Exec Time 2 ms
Memory 4352 KB

Compile Error

warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
   --> ./Main.rs:113:9
    |
113 |     let mut board = read_vec2::<String>(4u32);
    |         ^^^^^^^^^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 30
Set Name Test Cases
All 00_sample_00.txt, 00_sample_01.txt, 01_all_dot.txt, 02_all_o.txt, 03_all_x.txt, rand_0.txt, rand_1.txt, rand_10.txt, rand_11.txt, rand_12.txt, rand_13.txt, rand_14.txt, rand_15.txt, rand_16.txt, rand_17.txt, rand_18.txt, rand_19.txt, rand_2.txt, rand_20.txt, rand_21.txt, rand_22.txt, rand_23.txt, rand_24.txt, rand_3.txt, rand_4.txt, rand_5.txt, rand_6.txt, rand_7.txt, rand_8.txt, rand_9.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 2 ms 4352 KB
00_sample_01.txt AC 2 ms 4352 KB
01_all_dot.txt AC 2 ms 4352 KB
02_all_o.txt AC 2 ms 4352 KB
03_all_x.txt AC 2 ms 4352 KB
rand_0.txt AC 2 ms 4352 KB
rand_1.txt AC 2 ms 4352 KB
rand_10.txt AC 2 ms 4352 KB
rand_11.txt AC 2 ms 4352 KB
rand_12.txt AC 2 ms 4352 KB
rand_13.txt AC 2 ms 4352 KB
rand_14.txt AC 2 ms 4352 KB
rand_15.txt AC 2 ms 4352 KB
rand_16.txt AC 2 ms 4352 KB
rand_17.txt AC 2 ms 4352 KB
rand_18.txt AC 2 ms 4352 KB
rand_19.txt AC 2 ms 4352 KB
rand_2.txt AC 2 ms 4352 KB
rand_20.txt AC 2 ms 4352 KB
rand_21.txt AC 2 ms 4352 KB
rand_22.txt AC 2 ms 4352 KB
rand_23.txt AC 2 ms 4352 KB
rand_24.txt AC 2 ms 4352 KB
rand_3.txt AC 2 ms 4352 KB
rand_4.txt AC 2 ms 4352 KB
rand_5.txt AC 2 ms 4352 KB
rand_6.txt AC 2 ms 4352 KB
rand_7.txt AC 2 ms 4352 KB
rand_8.txt AC 2 ms 4352 KB
rand_9.txt AC 2 ms 4352 KB