문제 링크입니다: https://www.acmicpc.net/problem/5430 생각보다 구현하기 까다로운 문제였습니다.'R' 명령어가 올 때 직접 뒤집지 않고 boolean 변수 left를 통해 해당 덱이 뒤집어져있는지의 여부를 확인합니다.뒤집어져있을 때 'D' 명령어가 들어오면 pop_back, 뒤집어져있지 않을 때 'D' 명령어가 들어오면 pop_front를 해줍니다.물론, 덱이 비어있을 때는 "error"를 출력해줍니다. #include #include #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(0); cin.tie(0); int test_case; cin >> test_case; for (..