結果
問題 | No.163 cAPSlOCK |
ユーザー | Sarievo |
提出日時 | 2023-05-23 16:34:45 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 5,268 bytes |
コンパイル時間 | 13,417 ms |
コンパイル使用メモリ | 378,368 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-02 08:30:38 |
合計ジャッジ時間 | 12,985 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 0 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 1 ms
5,376 KB |
testcase_17 | AC | 1 ms
5,376 KB |
testcase_18 | AC | 1 ms
5,376 KB |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
testcase_21 | AC | 1 ms
5,376 KB |
testcase_22 | AC | 0 ms
5,376 KB |
コンパイルメッセージ
warning: unused import: `std::collections::HashSet` --> src/main.rs:1:5 | 1 | use std::collections::HashSet; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused macro definition: `map` --> src/main.rs:5:14 | 5 | macro_rules! map { () => { ::std::collections::HashMap::new() }; ($($key: expr => $value: expr),+ $(,)?) => {{ const CAP: usize = $crate:... | ^^^ | = note: `#[warn(unused_macros)]` on by default warning: unused macro definition: `set` --> src/main.rs:6:14 | 6 | macro_rules! set { () => { ::std::collections::HashSet::new() }; ($($elem: expr),+ $(,)?) => {{ const CAP: usize = $crate::count!($($elem... | ^^^ warning: unused macro definition: `btmap` --> src/main.rs:7:14 | 7 | macro_rules! btmap { () => { ::std::collections::BTreeMap::new() }; ($($key: expr => $value: expr),+ $(,)?) => {{ let mut map = ::std::co... | ^^^^^ warning: unused macro definition: `btset` --> src/main.rs:8:14 | 8 | macro_rules! btset { () => { ::std::collections::BTreeSet::new() }; ($($elem: expr),+ $(,)?) => {{ let mut set = ::std::collections::BTre... | ^^^^^ warning: unused macro definition: `deque` --> src/main.rs:9:14 | 9 | macro_rules! deque { () => { ::std::collections::VecDeque::new() }; ($elem: expr; $n: expr) => {{ let mut deque = ::std::collections::Vec... | ^^^^^ warning: unused macro definition: `bheap` --> src/main.rs:10:14 | 10 | macro_rules! bheap { () => { ::std::collections::BinaryHeap::new() }; ($($elem: expr),+ $(,)?) => {{ const CAP: usize = $crate::count!($(... | ^^^^^ warning: unused macro definition: `cvec` --> src/main.rs:19:14 | 19 | macro_rules! cvec { ($($tokens: tt)+) => { $crate::c![$($tokens)+].collect::<::std::vec::Vec<_>>() }; } | ^^^^ warning: unused macro definition: `cmap` --> src/main.rs:20:14 | 20 | macro_rules! cmap { ($key:expr => $value:expr; $(
ソースコード
use std::collections::HashSet; // Copyright (c) 2023 Sarievo // https://github.com/GrayJack/sugars/blob/dev/LICENSE #[macro_export] macro_rules! count { (@subst $($x: tt)*) => (()); ($($rest: expr),*) => (<[()]>::len(&[$($crate::count!(@subst $rest)),*])); } macro_rules! map { () => { ::std::collections::HashMap::new() }; ($($key: expr => $value: expr),+ $(,)?) => {{ const CAP: usize = $crate::count!($($key),*); let mut map = ::std::collections::HashMap::with_capacity(CAP); $(let _ = map.insert($key, $value);)+map }}; } macro_rules! set { () => { ::std::collections::HashSet::new() }; ($($elem: expr),+ $(,)?) => {{ const CAP: usize = $crate::count!($($elem),*); let mut set = ::std::collections::HashSet::with_capacity(CAP); $(let _ = set.insert($elem);)+set }}; } macro_rules! btmap { () => { ::std::collections::BTreeMap::new() }; ($($key: expr => $value: expr),+ $(,)?) => {{ let mut map = ::std::collections::BTreeMap::new(); $(let _ = map.insert($key, $value);)+map }}; } macro_rules! btset { () => { ::std::collections::BTreeSet::new() }; ($($elem: expr),+ $(,)?) => {{ let mut set = ::std::collections::BTreeSet::new(); $(set.insert($elem);)+set }}; } macro_rules! deque { () => { ::std::collections::VecDeque::new() }; ($elem: expr; $n: expr) => {{ let mut deque = ::std::collections::VecDeque::new(); deque.resize_with($n, || $elem);deque }}; ($($elem: expr),+ $(,)?) => {{ const CAP: usize = $crate::count!($($elem),*); let mut deque = ::std::collections::VecDeque::with_capacity(CAP); $(deque.push_back($elem);)+deque }}; } macro_rules! bheap { () => { ::std::collections::BinaryHeap::new() }; ($($elem: expr),+ $(,)?) => {{ const CAP: usize = $crate::count!($($elem),*); let mut bheap = ::std::collections::BinaryHeap::with_capacity(CAP); $(bheap.push($elem);)+bheap }} } #[macro_export] macro_rules! c { ($e:expr; $i:pat in $iter:expr) => { $iter.map(|$i| $e) }; ($e:expr; $i:pat in $iter:expr, if $cond:expr) => {{ $iter.filter(|$i| $cond).map(|$i| $e) }}; ($e:expr; $i1:pat in $iter1:expr, $i2:pat in $iter2:expr) => {{ $iter1.flat_map(|$i1| $iter2.map(move |$i2| $e)) }}; ($e:expr; $i1:pat in $iter1:expr, $i2:pat in $iter2:expr, if $cond:expr) => {{ $iter1.flat_map(|$i1| $iter2.filter_map(move |$i2| if $cond { Some($e) } else { None })) }}; ($e:expr; $i1:pat in $iter1:expr, $i2:pat in $iter2:expr, $i3:pat in $iter3:expr) => {{ $iter1.flat_map(|$i1| $iter2.flat_map(move |$i2| $iter3.map(move |$i3| $e))) }}; ($e:expr; $i1:pat in $iter1:expr, $i2:pat in $iter2:expr, $i3:pat in $iter3:expr, if $cond:expr) => {{ $iter1.flat_map(|$i1| { $iter2.flat_map(move |$i2| { $iter3.filter_map(move |$i3| if $cond { Some($e) } else { None }) }) }) }}; } macro_rules! cvec { ($($tokens: tt)+) => { $crate::c![$($tokens)+].collect::<::std::vec::Vec<_>>() }; } macro_rules! cmap { ($key:expr => $value:expr; $($tokens: tt)+) => {{ $crate::c![ ($key, $value); $($tokens)+ ].collect::<::std::collections::HashMap<_, _>>() }}; } macro_rules! cset { ($($tokens: tt)+) => {{ $crate::c![$($tokens)+].collect::<::std::collections::HashSet<_>>() }}; } macro_rules! cbtmap { ($key:expr => $value:expr; $($tokens: tt)+) => {{ $crate::c![ ($key, $value); $($tokens)+ ].collect::<::std::collections::BTreeMap<_, _>>() }}; } macro_rules! cbtset { ($($tokens: tt)+) => {{ $crate::c![$($tokens)+].collect::<::std::collections::BTreeSet<_>>() }}; } macro_rules! cdeque { ($($tokens: tt)+) => {{ use std::collections::VecDeque; $crate::c![$($tokens)+].collect::<::std::collections::VecDeque<_>>() }}; } macro_rules! cbheap { ($($tokens: tt)+) => {{ use std::collections::BinaryHeap; $crate::c![$($tokens)+].collect::<::std::collections::BinaryHeap<_>>() }}; } const DX: [i32; 8] = [0, 1, 0, -1, 1, 1, -1, -1]; const DY: [i32; 8] = [1, 0, -1, 0, 1, -1, -1, 1]; fn main() { let (r, w) = (std::io::stdin(), std::io::stdout()); let mut sc = IO::new(r.lock(), w.lock()); let s = sc.chars(); let mut t = vec![]; for x in s.clone() { if x.is_lowercase() { t.push(x.to_ascii_uppercase()); } else { t.push(x.to_ascii_lowercase()); } } println!("{}", t.iter().map(char::to_string).collect::<Vec<_>>().join("")); } pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>); impl<R: std::io::Read, W: std::io::Write> IO<R, W> { pub fn new(r: R, w: W) -> Self { Self(r, std::io::BufWriter::new(w)) } pub fn write<S: ToString>(&mut self, s: S) { use std::io::Write; self.1.write_all(s.to_string().as_bytes()).unwrap(); } pub fn read<T: std::str::FromStr>(&mut self) -> T { use std::io::Read; let buf = self.0.by_ref().bytes() .map(|b| b.unwrap()) .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t') .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t') .collect::<Vec<_>>(); unsafe { std::str::from_utf8_unchecked(&buf) }.parse().ok().expect("Parse error.") } pub fn chars(&mut self) -> Vec<char> { self.read::<String>().chars().collect() } pub fn usize0(&mut self) -> usize { self.read::<usize>() - 1 } pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.read()).collect() } }