Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- struct score {
- int points;
- int time;
- };
- class srt {
- public:
- bool operator()(const score &a, const score &b) {
- if (a.points == b.points)
- return a.time > b.time;
- else
- return a.points > b.points;
- }
- };
- int main() {
- int m, n;
- cin >> m >> n;
- map<string, string, srt> table;
- for (size_t i = 0; i < n; i++) {
- string s;
- score x{};
- if (table[s].points < x.points) {
- x.time = i;
- table[s] = x;
- }
- }
- for (auto item : table) {
- cout << item.first << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement