2102.cpp (337B)
1 class SORTracker { 2 using type_t = tuple<int, string>; 3 4 set<type_t> st; 5 set<type_t>::iterator pos = end(st); 6 7 public: 8 void add(string name, int score) { 9 const auto it = st.insert({-score, name}).first; 10 if (pos == end(st) || *it < *pos) pos--; 11 } 12 13 const string &get() { return get<1>(*pos++); } 14 };