/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 2ms 768.0 KiB
#4 Accepted 17ms 2.012 MiB
#5 Accepted 197ms 15.211 MiB
#6 Accepted 1328ms 74.156 MiB
#7 Accepted 1200ms 64.145 MiB
#8 Accepted 1091ms 64.137 MiB
#9 Accepted 1112ms 64.055 MiB
#10 Accepted 1096ms 64.223 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
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 09:23:13
Judged At
2024-12-09 09:23:13
Judged By
Score
100
Total Time
1328ms
Peak Memory
74.156 MiB