Submission #52983362


Source Code Expand

use proconio::input;
use std::collections::VecDeque;

fn main() {
    input! {
        n: usize,
        an: [i32; n],
    }

    let mut q = VecDeque::new();
    for a in an {
        q.push_front(a);
        while q.len() > 1 {
            if q[0] != q[1] {
                break;
            } else {
                let tmp = q.pop_front().unwrap();
                q.pop_front();
                q.push_front(tmp + 1);
            }
        }
    }
    println!("{}", q.len());
}

Submission Info

Submission Time
Task C - Merge the balls
User flowert
Language Rust (rustc 1.70.0)
Score 250
Code Size 509 Byte
Status AC
Exec Time 9 ms
Memory 5524 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 2
AC × 38
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 1880 KiB
example_01.txt AC 1 ms 1960 KiB
hand_00.txt AC 9 ms 4540 KiB
hand_01.txt AC 6 ms 3536 KiB
hand_02.txt AC 6 ms 3664 KiB
hand_03.txt AC 6 ms 4828 KiB
hand_04.txt AC 6 ms 4716 KiB
hand_05.txt AC 6 ms 3640 KiB
hand_06.txt AC 7 ms 4756 KiB
hand_07.txt AC 1 ms 1868 KiB
hand_08.txt AC 1 ms 1872 KiB
hand_09.txt AC 1 ms 1884 KiB
hand_10.txt AC 1 ms 1904 KiB
random_00.txt AC 9 ms 4908 KiB
random_01.txt AC 9 ms 4952 KiB
random_02.txt AC 9 ms 4980 KiB
random_03.txt AC 9 ms 5012 KiB
random_04.txt AC 9 ms 4868 KiB
random_05.txt AC 8 ms 5260 KiB
random_06.txt AC 8 ms 5212 KiB
random_07.txt AC 8 ms 5216 KiB
random_08.txt AC 8 ms 5524 KiB
random_09.txt AC 8 ms 5384 KiB
random_10.txt AC 9 ms 4928 KiB
random_11.txt AC 9 ms 4872 KiB
random_12.txt AC 8 ms 5432 KiB
random_13.txt AC 9 ms 5116 KiB
random_14.txt AC 8 ms 5244 KiB
random_15.txt AC 8 ms 5320 KiB
random_16.txt AC 8 ms 5468 KiB
random_17.txt AC 8 ms 5384 KiB
random_18.txt AC 9 ms 5460 KiB
random_19.txt AC 7 ms 5520 KiB
random_20.txt AC 8 ms 5500 KiB
random_21.txt AC 7 ms 5472 KiB
random_22.txt AC 8 ms 5284 KiB
random_23.txt AC 7 ms 5440 KiB
random_24.txt AC 8 ms 5500 KiB