/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 368.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 3ms 608.0 KiB
#4 Accepted 18ms 1.961 MiB
#5 Accepted 197ms 15.137 MiB
#6 Accepted 1278ms 74.18 MiB
#7 Accepted 1117ms 64.047 MiB
#8 Accepted 1132ms 64.125 MiB
#9 Accepted 1054ms 64.0 MiB
#10 Accepted 1054ms 64.207 MiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define all(v) v.begin(),v.end()
#define nl "\n"
#define FIO \
    ios_base::sync_with_stdio(false);\
    cin.tie(NULL);\
    cout.tie(NULL);
class cmp{
    public:
    bool operator()(pair<pair<pair<ll, ll>, ll>, pair<string, string>>a, pair<pair<pair<ll, ll>, ll>, pair<string, string>>b){
        if(a.first.first.first==b.first.first.first){
            return a.first.first.second>b.first.first.second;
        }
        return a.first.first.first<b.first.first.first;
    }
};
void solve()
{
    ll d, j, g; cin>>d>>j>>g; string s, t; ll r;
    map<string, ll> dq;
    while(j--){
        cin>>s>>r;
        dq[s]=r;
    }
    ll k=1;
    vector<pair<pair<ll, ll>, ll>>v;
    for(ll i=0;i<g;i++){
        ll p, q; cin>>p>>q>>r;
        v.push_back({{p, q}, r});
    }
    ll mm=0;
    map<pair<string, string>, ll>mp;
    priority_queue<pair<pair<pair<ll, ll>, ll>, pair<string, string>>, vector<pair<pair<pair<ll, ll>, ll>, pair<string, string>>>, cmp>ff;
    while(d--){
        ll n, m; cin>>n>>m; m+=mm;
        for(ll i=0;i<n;i++)
        {
            cin>>s>>t>>r;
            mp[{s, t}]=r;
            ll p=0;
            for(ll j=0;j<g;j++)
            {
                if(v[j].first.first<=r && v[j].first.second>=r){
                    p=v[j].second;
                    break;
                }
            }
            ff.push({{{p+dq[t], k}, r}, {s, t}});
            k++;
        }
        ll x=0;
        for(ll i=0;i<m;i++)
        // while(mm--)
        {
            if(ff.empty()) break;
            s=ff.top().second.first; t=ff.top().second.second;
            cout<<s<<" "<<t<<" "<<ff.top().first.second<<nl;
            ff.pop();
            x++;
        }
        mm=m-x;
    }
    cout<<"Still unvaccinated people: "<<ff.size()<<nl;
}

int32_t main()
{
 FIO
    ll t=1;
    // cin>>t;
    for(ll i=1;i<=t;i++)
    {
        // cout<<"Case "<<i<<": ";
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1148 e-Vaccine
Contest
LU IUJPC : Sylhet Division 2024 Replay Contest
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 09:59:44
Judged At
2024-12-10 09:59:44
Judged By
Score
100
Total Time
1278ms
Peak Memory
74.18 MiB