/ SeriousOJ /

Record Detail

Wrong Answer


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

Code

#include<bits/stdc++.h>
using namespace std;

#define nl '\n'
#define ll long long
// #define int long long
#define pii pair<int, int> 



void solve(){
    int d,j,g; cin >> d >> j >>g;
    // prio, -id, name
    map<string, int> a;
    for(int i=0;i<j;++i) {
        string s; int p;
        cin >> s >> p;
        a[s] = p;
    }
    vector<pii> rng;
    map<pii, int> rngPrio;
    while(g--) {
        int l,r,p; cin >> l >> r >> p;
        rng.push_back(make_pair(l,r));
        rngPrio[{l, r}] = p;
    }
    sort(rng.begin(), rng.end());
    // for(auto [p, q]: rngPrio) cout << p.first << " " << p.second << " " << q << endl;
    // int q; cin  >> q;
    // int id = 0;
    // prio, id, name
    set<pair<int, int>> li; 
    vector<string> ids;
    int id = 1;
    int xta = 0;
    while(d--) {
        int n, m; cin >> n >> m;
        while(n--){
            string s, t; int age;
            cin >> s >> t >> age;

            int cur = a[t];

            auto lbid = upper_bound(rng.begin(), rng.end(), make_pair(age, (int)-2e9)) - rng.begin();
            // cout << lbid << " ";
            if(lbid != 0){
                lbid--;
                if(rng[lbid].first <= age and rng[lbid].second>=age){
                    cur += rngPrio[{rng[lbid].first, rng[lbid].second}];
                }
                // cout << cur << endl;
            }
            string tot = s + " " + t + " " + to_string(age);
            // string tot = "";
            li.insert({cur, -id});
            ids.push_back(tot);
            id++;
        }
        // for(auto [xx,xxx,xxxx]: li) cerr << xx << " " << xxx << " " << xxxx << endl;
        // cerr << endl;
        m += xta;
        while(m and (int)li.size()){
            auto [Pro, id] = *li.rbegin();
            li.erase(li.find(*li.rbegin()));
            cout << ids[-id-1] << nl;
            m--;
            // cout << endl;
            // cout << endl;
        }
        xta = m;
    }
    cout << "Still unvaccinated people: " << (int)li.size() << nl;
}

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t = 1, tc = 0;
    // cin >> t ;
    while(t--){
        // cout << "Case " << ++tc  << ": ";
        solve();
    }
    return 0;
}

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 06:51:58
Judged At
2024-12-09 07:01:58
Judged By
Score
0
Total Time
3ms
Peak Memory
560.0 KiB