Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define int long long
- using namespace std;
- ifstream fin("text.in");
- ofstream fout("text.out");
- const int NMAX = 1e5;
- inline int seconds(string s) {
- return ((s[0] - '0') * 10 + (s[1] - '0')) * 3600 + ((s[3] - '0') * 10 + (s[4] - '0')) * 60 + ((s[6] - '0') * 10 + (s[7] - '0'));
- }
- inline bool fcmp(const pair < int , int >& A, const pair < int , int >& B) {
- return A.first > B.first || (A.first == B.first && A.second < B.second);
- }
- int32_t main() {
- string start, ans;
- int X, cnt;
- fin >> start >> X >> cnt;
- vector < tuple < int , int , int > > a;
- vector < bool > ok(NMAX + 1);
- for(int tt = 0; tt < cnt; ++tt) {
- int id, tid;
- string moment, type;
- fin >> id >> moment >> type >> tid;
- if(type == "correct")
- a.push_back(make_tuple(seconds(moment), id, tid));
- ok[id] = true;
- }
- sort(a.begin(), a.end());
- vector < int > points(NMAX + 1, X), values(NMAX + 1);
- for(auto x : a) {
- values[get<1>(x)] += points[get<2>(x)];
- if(points[get<2>(x)] > 0)
- --points[get<2>(x)];
- }
- vector < pair < int , int > > sol;
- for(int i = 0; i <= NMAX; ++i)
- if(ok[i])
- sol.emplace_back(values[i], i);
- sort(sol.begin(), sol.end(), fcmp);
- for(auto x : sol)
- fout << x.first << ' ' << x.second << ' ';
- }
Advertisement
Add Comment
Please, Sign In to add comment