Submission #16053036


Source Code Expand

Copy
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars
    };
    let mut map = std::collections::BTreeMap::new();
    for &s_i in s.iter() {
        *map.entry(s_i).or_insert(0) += 1;
    }
    let mut c_o = 0;
    for (_, v) in map.iter() {
        if v % 2 != 0 {
            c_o += 1;
        }
    }
    let ans = if c_o > 0 {
        let g = (s.len() - c_o) / c_o;
        if g % 2 == 0 {
            g + 1
        } else {
            g / 2 * 2 + 1
        }
    } else {
        s.len()
    };
    println!("{}", ans);
}

Submission Info

Submission Time
Task B - 回文分割
User bouzuya
Language Rust (1.42.0)
Score 100
Code Size 567 Byte
Status AC
Exec Time 11 ms
Memory 2584 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 4
AC × 45
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.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, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt, 1_26.txt, 1_27.txt, 1_28.txt, 1_29.txt, 1_30.txt, 1_31.txt, 1_32.txt, 1_33.txt, 1_34.txt, 1_35.txt, 1_36.txt, 1_37.txt, 1_38.txt, 1_39.txt, 1_40.txt
Case Name Status Exec Time Memory
0_00.txt AC 8 ms 2188 KB
0_01.txt AC 1 ms 2076 KB
0_02.txt AC 2 ms 2124 KB
0_03.txt AC 1 ms 2156 KB
1_00.txt AC 1 ms 2116 KB
1_01.txt AC 2 ms 2048 KB
1_02.txt AC 1 ms 2148 KB
1_03.txt AC 2 ms 2016 KB
1_04.txt AC 3 ms 2472 KB
1_05.txt AC 8 ms 2468 KB
1_06.txt AC 5 ms 2520 KB
1_07.txt AC 7 ms 2480 KB
1_08.txt AC 2 ms 2040 KB
1_09.txt AC 1 ms 2116 KB
1_10.txt AC 2 ms 1904 KB
1_11.txt AC 3 ms 2016 KB
1_12.txt AC 1 ms 1948 KB
1_13.txt AC 1 ms 2060 KB
1_14.txt AC 1 ms 1904 KB
1_15.txt AC 1 ms 2084 KB
1_16.txt AC 2 ms 2048 KB
1_17.txt AC 1 ms 2132 KB
1_18.txt AC 1 ms 2092 KB
1_19.txt AC 3 ms 2096 KB
1_20.txt AC 5 ms 2100 KB
1_21.txt AC 1 ms 2096 KB
1_22.txt AC 1 ms 1968 KB
1_23.txt AC 2 ms 2100 KB
1_24.txt AC 1 ms 2080 KB
1_25.txt AC 3 ms 2312 KB
1_26.txt AC 2 ms 2184 KB
1_27.txt AC 4 ms 2260 KB
1_28.txt AC 3 ms 2324 KB
1_29.txt AC 9 ms 2388 KB
1_30.txt AC 7 ms 2336 KB
1_31.txt AC 11 ms 2584 KB
1_32.txt AC 3 ms 2312 KB
1_33.txt AC 3 ms 2196 KB
1_34.txt AC 4 ms 2172 KB
1_35.txt AC 3 ms 2244 KB
1_36.txt AC 4 ms 2268 KB
1_37.txt AC 5 ms 2260 KB
1_38.txt AC 9 ms 2336 KB
1_39.txt AC 6 ms 2336 KB
1_40.txt AC 2 ms 2216 KB