Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <algorithm>
- #include <vector>
- #include <map>
- #include <queue>
- #include <set>
- using namespace std;
- int main()
- {
- long long L, T, va, vb;
- map <long long, long long> Alica, Bob;
- cin >> L >> T >> va >> vb;
- int n;
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- int who, ts, tl;
- cin >> who >> ts >> tl;
- if (who == 1)
- Alica[ts] = tl;
- else
- Bob[ts] = tl;
- }
- int tA = 0, tB = 0, Sab = 0;
- int tnow = 0;
- int meetting = 0;
- while (T > 0)
- {
- if (Alica.find(tnow) != Alica.end())
- tA = Alica[tnow];
- if (Bob.find(tnow) != Bob.end())
- tB = Bob[tnow];
- if (tA == 0)
- Sab += va;
- else
- tA--;
- if (tB == 0)
- Sab += vb;
- else
- tB--;
- if (L <= Sab)
- {
- meetting += Sab / L;
- Sab = Sab%L;
- }
- T--;
- tnow++;
- }
- cout << meetting;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment