/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 516.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 2ms 840.0 KiB
#4 Accepted 10ms 1.645 MiB
#5 Accepted 77ms 14.918 MiB
#6 Accepted 461ms 63.422 MiB
#7 Accepted 373ms 53.195 MiB
#8 Accepted 340ms 55.656 MiB
#9 Accepted 347ms 55.656 MiB
#10 Accepted 357ms 55.758 MiB

Code

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tc=1,tc1=1;
    //cin>>tc;
    up:
    while(tc--){
      ll D,J,G;
      cin>>D>>J>>G;
      map<string,ll>mp;
      for(ll i=0;i<J;i++){
        string s;
        ll val;
        cin>>s>>val;
        mp[s]=val;
      }
      map<ll,ll>mp1;
      for(ll i=0;i<G;i++){
        ll l,r,p;
        cin>>l>>r>>p;
        for(ll j=l;j<=r;j++){
          mp1[j]=p;
        }
      }
      ll avail=0,c=0;
      vector<string>nam,pr;
      vector<ll>ag;
      set<pair<ll,ll>>sp;
      vector<ll>ans;
      for(ll i=0;i<D;i++){
        ll n,m;
        cin>>n>>m;
        for(ll j=0;j<n;j++){
          string s,t;
          ll age;
          cin>>s>>t>>age;
          nam.push_back(s),pr.push_back(t),ag.push_back(age);
          sp.insert({-mp[t]-mp1[age],c++});
        }
        avail+=m;
        while(1){
          if(sp.size()==0||avail==0){
            break;
          }
          auto[name,in]=*sp.begin();
          ans.push_back(in);
          sp.erase({name,in});
          avail--;
        }
      }
      for(auto i:ans){
        cout<<nam[i]<<" "<<pr[i]<<" "<<ag[i]<<'\n';
      }
      ll sz=ans.size();
      cout<<"Still unvaccinated people: "<<c-sz<<'\n';
    }
}

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 11:28:13
Judged At
2024-12-10 11:28:13
Judged By
Score
100
Total Time
461ms
Peak Memory
63.422 MiB