Open1
AOJ - ITP2 - Rust
1_A Vector
use std::io;
fn read<T: std::str::FromStr>() -> Vec<T> {
let mut buf = String::new();
io::stdin().read_line(&mut buf).unwrap();
buf.trim().split(' ').flat_map(str::parse).collect()
}
fn main() {
let mut a = Vec::new();
let q = read::<i32>();
for _i in 0..q[0] {
let query = read::<i32>();
if query.len() == 1 {
a.pop();
} else if query[0] == 0 {
a.push(query[1])
} else if query[0] == 1 {
println!("{}", a[query[1] as usize])
}
}
}