Created
June 9, 2021 11:55
-
-
Save tokugh/c2777248fe78452eee116eff13871891 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use proconio::{input, fastout}; | |
use std::collections::VecDeque; | |
const QMAX: usize = 100000; | |
#[fastout] | |
fn main() { | |
let mut data = VecDeque::with_capacity(QMAX); | |
input! { tx: [(usize, usize)], }; | |
for txi in tx { | |
match txi { | |
(1, x) => data.push_front(x), | |
(2, x) => data.push_back(x), | |
(3, x) => println!("{}", data[x-1]), | |
_ => unreachable!(), | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment