We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a214a5 commit ecb69e5Copy full SHA for ecb69e5
tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp
@@ -0,0 +1,32 @@
1
+#define PROBLEM "https://judge.yosupo.jp/problem/deque"
2
+#include "../template.hpp"
3
+#include "../../../library/data_structures/uncommon/deque_op.hpp"
4
+int main() {
5
+ cin.tie(0)->sync_with_stdio(0);
6
+ int q;
7
+ cin >> q;
8
+ deq dq(vector<int>(),
9
+ [](int x, int y) -> int { return min(x, y); });
10
+ while (q--) {
11
+ int type;
12
+ cin >> type;
13
+ if (type == 0) {
14
+ int x;
15
+ cin >> x;
16
+ dq.push_front(x);
17
+ } else if (type == 1) {
18
19
20
+ dq.push_back(x);
21
+ } else if (type == 2) {
22
+ dq.pop_front();
23
+ } else if (type == 3) {
24
+ dq.pop_back();
25
+ } else {
26
+ int i;
27
+ cin >> i;
28
+ cout << dq[i] << '\n';
29
+ }
30
31
+ return 0;
32
+}
0 commit comments