結果

問題 No.1026 OGAWA's New Keyboard
ユーザー akakimidori
提出日時 2020-04-14 16:46:08
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 634 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,100 ms
コンパイル使用メモリ 188,864 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-05 10:05:18
合計ジャッジ時間 1,825 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let mut deq = std::collections::VecDeque::new();
    for _ in 0..n {
        let op: usize = it.next().unwrap().parse().unwrap();
        let c: char = it.next().unwrap().chars().next().unwrap();
        if op == 0 {
            deq.push_back(c);
        } else {
            deq.push_front(c);
        }
    }
    let ans: String = deq.into_iter().collect();
    println!("{}", ans);
}

fn main() {
    run();
}
0