Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- int main()
- {
- ll n;
- while (cin >> n && n != 0)
- {
- ll p1 = 0, p2 = 0;
- vector<pair<string, ll>> z1(n);
- for (int i = 0; i < n; i++)
- {
- cin >> z1.at(i).first;
- cin >> z1.at(i).second;
- }
- for (int i = 0; i < n; i++)
- {
- if (z1.at(i).first != "DROP" && p1 == 0 && p2 != 0)
- {
- cout << "MOVE 2->1 " << p2 << endl;
- p1 += p2;
- p2 = 0;
- }
- if (z1.at(i).first == "DROP")
- {
- cout << "DROP 2 " << z1.at(i).second << endl;
- p2 += z1.at(i).second;
- }
- else
- {
- cout << "TAKE 1 " << z1.at(i).second << endl;
- p1 -= z1.at(i).second;
- }
- }
- cout << '\n';
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment