/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 2ms 540.0 KiB
#3 Wrong Answer 3ms 540.0 KiB

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<ll, pair<string, string>>a, pair<ll, pair<string, string>>b){
        return a.first<b.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;
    }
    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});
    }
    map<pair<string, string>, ll>mp;
    priority_queue<pair<ll, pair<string, string>>, vector<pair<ll, pair<string, string>>>, cmp>ff;
    while(d--){
        ll n, m; cin>>n>>m;
        for(ll i=0;i<n;i++)
        {
            cin>>s>>t>>r;
            mp[{s, t}]=r;
            for(ll j=0;j<g;j++)
            {
                if(v[j].first.first<=r && v[j].first.second>=r){
                    r=v[j].second;
                    break;
                }
            }
            ff.push({r+dq[t], {s, t}});
        }
        for(ll i=0;i<m;i++)
        {
            if(ff.empty()) break;
            s=ff.top().second.first; t=ff.top().second.second;
            cout<<s<<" "<<t<<" "<<mp[{s, t}]<<nl;
            ff.pop();
        }
    }
    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 08:57:23
Judged At
2024-12-09 08:57:23
Judged By
Score
0
Total Time
3ms
Peak Memory
540.0 KiB