Submission #16606731


Source Code Expand

Copy
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    };
    let mut xyz = vec![vec![0, 0, 0]];
    for (i, &a_i) in a.iter().enumerate() {
        let mut xyz_next = xyz[i].clone();
        xyz_next.sort_by_key(|&v| -v);
        for v in xyz_next.iter_mut() {
            if *v == a_i {
                *v += 1;
                break;
            }
        }
        xyz.push(xyz_next);
    }
    let mut count = 1_usize;
    for (&a_i, xyz_i) in a.iter().zip(xyz.iter()) {
        count *= xyz_i.iter().filter(|&&v| v == a_i).count();
        count %= 1_000_000_007;
    }
    let ans = count;
    println!("{}", ans);
}

Submission Info

Submission Time
Task E - Colorful Hats 2
User bouzuya
Language Rust (1.42.0)
Score 500
Code Size 659 Byte
Status
Exec Time 29 ms
Memory 8864 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
× 3
× 34
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in59.txt, in61.txt, in62.txt, in63.txt, in64.txt, in65.txt, in66.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
in01.txt 9 ms 2012 KB
in02.txt 25 ms 8848 KB
in03.txt 2 ms 2068 KB
in04.txt 9 ms 2196 KB
in05.txt 23 ms 8796 KB
in06.txt 28 ms 8844 KB
in07.txt 22 ms 8804 KB
in08.txt 29 ms 8864 KB
in09.txt 2 ms 2080 KB
in10.txt 24 ms 8828 KB
in11.txt 1 ms 2128 KB
in12.txt 1 ms 2056 KB
in13.txt 25 ms 8484 KB
in14.txt 20 ms 8784 KB
in15.txt 24 ms 8828 KB
in16.txt 25 ms 8824 KB
in17.txt 25 ms 8824 KB
in18.txt 21 ms 8396 KB
in19.txt 1 ms 2056 KB
in20.txt 2 ms 2056 KB
in21.txt 5 ms 2676 KB
in22.txt 25 ms 8444 KB
in23.txt 21 ms 8628 KB
in24.txt 23 ms 8560 KB
in59.txt 2 ms 2172 KB
in61.txt 3 ms 1996 KB
in62.txt 1 ms 2028 KB
in63.txt 1 ms 1944 KB
in64.txt 1 ms 2032 KB
in65.txt 2 ms 2148 KB
in66.txt 1 ms 2152 KB
sample_01.txt 3 ms 2136 KB
sample_02.txt 1 ms 1960 KB
sample_03.txt 1 ms 2032 KB