Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define int long long
- int time_per_meter = 1;
- using namespace std;
- vector<int> times_actions;
- vector<int> distance_actions;
- void check_actions(int distance, int time)
- {
- for (int i = 0; i < distance_actions.size(); i++)
- if (distance_actions[i] == distance)
- time_per_meter++;
- for (int i = 0; i < times_actions.size(); i++)
- if (times_actions[i] == time)
- time_per_meter++;
- }
- signed main()
- {
- vector<int> times(1001, -1);
- int n;
- cin >> n;
- for (int i = 0; i < n; i++)
- {
- pair<string, int> p;
- cin >> p.first >> p.second;
- if (p.second >= 0 && p.second <= 1000)
- {
- if (p.first == "T")
- times_actions.push_back(p.second);
- else
- distance_actions.push_back(p.second);
- }
- }
- times[0] = 0;
- check_actions(0, 0);
- for (int i = 1; i <= 1000; i++)
- {
- times[i] = times[i - 1] + time_per_meter;
- check_actions(i, times[i]);
- }
- cout << times[1000];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement