Submission #1575387


Source Code Expand

Copy
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let _: usize = read();
    let a: Vec<i32> = readnc();

    let mut four = 0;
    let mut two = 0;
    let mut zero = 0;
    for a in a {
        match a % 4 {
            0 => { four += 1 },
            2 => { two += 1  },
            _ => { zero += 1 },
        }
    }

    if (four >= zero) || (four + 1 == zero && two == 0) {
        println!("Yes");
    } else {
        println!("No");
    }
}

Submission Info

Submission Time
Task C - 4-adjacent
User hamadu
Language Rust (1.15.1)
Score 400
Code Size 1752 Byte
Status AC
Exec Time 11 ms
Memory 6396 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 5
AC × 19
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt
Case Name Status Exec Time Memory
0_00.txt AC 2 ms 4352 KB
0_01.txt AC 2 ms 4352 KB
0_02.txt AC 2 ms 4352 KB
0_03.txt AC 2 ms 4352 KB
0_04.txt AC 2 ms 4352 KB
1_00.txt AC 2 ms 4352 KB
1_01.txt AC 2 ms 4352 KB
1_02.txt AC 2 ms 4352 KB
1_03.txt AC 2 ms 4352 KB
1_04.txt AC 2 ms 4352 KB
1_05.txt AC 2 ms 4352 KB
1_06.txt AC 2 ms 4352 KB
1_07.txt AC 11 ms 6396 KB
1_08.txt AC 10 ms 6396 KB
1_09.txt AC 11 ms 6396 KB
1_10.txt AC 11 ms 6396 KB
1_11.txt AC 11 ms 6396 KB
1_12.txt AC 11 ms 6396 KB
1_13.txt AC 11 ms 6396 KB