Submission #1611380


Source Code Expand

fn getline() -> String {
   let mut __ret=String::new();
   std::io::stdin().read_line(&mut __ret).ok();
   return __ret;
}

fn main(){
   let n:i32=getline().trim_right().parse().unwrap();
   let cs = getline();
   let mut dict = std::collections::HashMap::<char, i32>::new();

   for c in cs.chars() {
     if dict.contains_key(&c) {
       let orig:i32 = *dict.get(&c).unwrap();
       dict.insert(c, orig + 1);
     } else {
       dict.insert(c, 1);
     }
   }

   let mut max_ans = std::i32::MIN;
   let mut min_ans = std::i32::MAX;

   for key in dict.keys() {
     let cnt = *dict.get(&key).unwrap();
     if cnt > max_ans {
       max_ans = cnt;
     }
     if cnt < min_ans {
       min_ans = cnt;
     }
   }

   println!("{} {}", max_ans, min_ans);
}

Submission Info

Submission Time
Task A - センター採点
User sakaki
Language Rust (1.15.1)
Score 0
Code Size 799 Byte
Status WA
Exec Time 2 ms
Memory 4352 KB

Compile Error

warning: unused variable: `n`, #[warn(unused_variables)] on by default
 --> ./Main.rs:8:8
  |
8 |    let n:i32=getline().trim_right().parse().unwrap();
  |        ^

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 1
WA × 29
Set Name Test Cases
All 00_sample1.txt, 00_sample2.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_all_1.txt, 02_all_2.txt, 02_all_3.txt, 02_all_4.txt, 03_mini_1.txt, 03_mini_2.txt, 03_mini_3.txt, 03_mini_4.txt
Case Name Status Exec Time Memory
00_sample1.txt AC 2 ms 4352 KB
00_sample2.txt WA 2 ms 4352 KB
01_rnd_00.txt WA 2 ms 4352 KB
01_rnd_01.txt WA 2 ms 4352 KB
01_rnd_02.txt WA 2 ms 4352 KB
01_rnd_03.txt WA 2 ms 4352 KB
01_rnd_04.txt WA 2 ms 4352 KB
01_rnd_05.txt WA 2 ms 4352 KB
01_rnd_06.txt WA 2 ms 4352 KB
01_rnd_07.txt WA 2 ms 4352 KB
01_rnd_08.txt WA 2 ms 4352 KB
01_rnd_09.txt WA 2 ms 4352 KB
01_rnd_10.txt WA 2 ms 4352 KB
01_rnd_11.txt WA 2 ms 4352 KB
01_rnd_12.txt WA 2 ms 4352 KB
01_rnd_13.txt WA 2 ms 4352 KB
01_rnd_14.txt WA 2 ms 4352 KB
01_rnd_15.txt WA 2 ms 4352 KB
01_rnd_16.txt WA 2 ms 4352 KB
01_rnd_17.txt WA 2 ms 4352 KB
01_rnd_18.txt WA 2 ms 4352 KB
01_rnd_19.txt WA 2 ms 4352 KB
02_all_1.txt WA 2 ms 4352 KB
02_all_2.txt WA 2 ms 4352 KB
02_all_3.txt WA 2 ms 4352 KB
02_all_4.txt WA 2 ms 4352 KB
03_mini_1.txt WA 2 ms 4352 KB
03_mini_2.txt WA 2 ms 4352 KB
03_mini_3.txt WA 2 ms 4352 KB
03_mini_4.txt WA 2 ms 4352 KB