# 13980 - CPP_practice >author: Utin ###### tags: `Data Structure` --- ## Brief See the code below ## Solution 0 ```c= #include <iostream> #include <vector> int main() { std::vector<int> V; int v1, v2; while (std::cin >> v1 >> v2) { switch(v1) { case 0: V.push_back(v2); break; case 1: V.front() += V.back() + v2; V.pop_back(); break; case 2: V.back() += V.front() + v2; } } std::cout << V.front() << ' ' << V.back() << '\n'; } // By Utin ``` ## Reference