Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <string>
- #include <vector>
- #include <map>
- #define mp make_pair
- #define pb push_back
- #define x first
- #define y second
- using namespace std;
- typedef long double ld;
- vector<pair<string, ld> > ans;
- map <string, ld> a, b, num;
- bool cmp(pair<string, ld> a, pair<string, ld> b)
- {
- return (a.y > b.y) || (a.y == b.y && num[a.x] < num[b.x]);
- }
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie();
- cout.tie();
- int n, m, r = 0, k;
- string v, s;
- cin >> n >> m >> v;
- for (int i = 0; i < n; i++)
- {
- cin >> s >> k;
- num[s] = r++;
- ans.pb(mp(s, k));
- }
- r = 0;
- for (int i = 0; i < n; i++)
- {
- cin >> s >> r >> k;
- ans[num[s]].y += ((r - ans[num[s]].y) / k) * m;
- }
- sort(ans.begin(), ans.end(), cmp);
- for (int i = 0; i < ans.size(); i++)
- if (ans[i].x == v)
- return cout << i + 1, 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement