| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 91810 | sh25_shenpy | 数字卡片 | C++ | 通过 | 21 MS | 680 KB | 726 | 2026-06-17 06:34:53 |
#include <iostream> #include <deque> using namespace std; int main() { // 加速cin、cout,处理大量数据更快 ios::sync_with_stdio(false); cin.tie(0); int Q; cin >> Q; deque<int> cards; for (int i = 0; i < Q; ++i) { int t, x; cin >> t >> x; if (t == 1) { // 放到最上面 = 队头插入 cards.push_front(x); } else if (t == 2) { // 放到最下面 = 队尾插入 cards.push_back(x); } else if (t == 3) { // 从上第x张,下标x-1 cout << cards[x - 1] << '\n'; } } return 0; }