Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <string>
- #include <cstring>
- #include <fstream>
- #include <cmath>
- #include <vector>
- #include <utility>
- #include <cstdlib>
- #include <deque>
- #include <queue>
- #include <iomanip>
- #include <numeric>
- #include <stack>
- #include <map>
- //#include <unordered_map>
- #include <set>
- //#include <unordered_set>
- #include <cmath>
- #include <list>
- #define mp make_pair
- #define pb push_back
- #define x first
- #define y second
- #define pnt pair<int, int>
- #define preturn(a) return cout << a << endl, 0
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef unsigned int uint;
- const int N = (int)250000, mdt = 1e7, limit = 1e8;
- const ld eps = 1e-8, eps1 = 1e-20, PI = 3.14159265358979323846264338, OOO = 1e100L, lim = sqrt(2e9 + 100);
- const ll OO = 1e18 * 8, mod = 1e9 + 7, md = 4294967291;
- 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