28279

    [실4] 28279 - 덱2

    #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; deque dq; while(n--) { int o, t; cin >> o; if (o == 1) { cin >> t; dq.push_front(t); } else if (o == 2) { cin >> t; dq.push_back(t); } else if (o == 3) { if (dq.empty()) cout