Submission #1680696
Source Code Expand
#![allow(unused_imports, unused_variables, dead_code)] use std::io::*; use std::fmt::*; use std::str::*; use std::cmp::*; use std::collections::*; trait InputValue { fn parse(s: &str) -> Self; } fn read<T: InputValue>() -> T { let mut buf = String::new(); let _ = stdin().read_line(&mut buf); T::parse(&buf.trim()) } 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 } 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 n = read(); let s: Vec<String> = readn(n); let mut cnt = vec![255; 26]; for s in s { let mut part = vec![0; 26]; for x in s.into_bytes() { part[(x - 'a' as u8) as usize] += 1; } for i in 0..26 { cnt[i] = min(cnt[i], part[i]); } } for i in 0..26 { for _ in 0..cnt[i] { print!("{}", ('a' as u8 + i as u8) as char); } } println!(); }
Submission Info
Submission Time | |
---|---|
Task | C - Dubious Document |
User | hamadu |
Language | Rust (1.15.1) |
Score | 300 |
Code Size | 1793 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 4352 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt |
All | 0_000.txt, 0_001.txt, dec_half.txt, hand.txt, max.txt, max_10.txt, max_5.txt, maxx.txt, rnd.txt, single.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 2 ms | 4352 KB |
0_001.txt | AC | 2 ms | 4352 KB |
dec_half.txt | AC | 2 ms | 4352 KB |
hand.txt | AC | 2 ms | 4352 KB |
max.txt | AC | 2 ms | 4352 KB |
max_10.txt | AC | 2 ms | 4352 KB |
max_5.txt | AC | 2 ms | 4352 KB |
maxx.txt | AC | 2 ms | 4352 KB |
rnd.txt | AC | 2 ms | 4352 KB |
single.txt | AC | 2 ms | 4352 KB |