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)
- {
- string a;
- ll w;
- ll p1 = 0, p2 = 0;
- for (int i = 0; i < n; i++)
- {
- cin >> a >> w;
- if (a.at(0) == 'D')
- {
- cout << "DROP 2 " << w << endl;
- p2 += w;
- }
- else
- {
- if (w != 0 && p1 == 0 && p2 != 0)
- {
- cout << "MOVE 2->1 " << p2 << endl;
- p1 += p2;
- p2 = 0;
- }
- cout << "TAKE 1 " << w << endl;
- p1 -= w;
- }
- }
- cout << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment