/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Wrong Answer 2ms 504.0 KiB
#3 Accepted 3ms 568.0 KiB
#4 Accepted 10ms 1.297 MiB
#5 Accepted 76ms 9.605 MiB
#6 Wrong Answer 452ms 42.75 MiB

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;
    map<int, queue<int>> mp;
    while(d--) {
        int n, m; cin >> n >> m;
        while(n--){
            string s, t; int age;
            cin >> s >> t >> age;

            int cur = a[t];
            int pqr = 0;

            for(int i=0;i<rng.size();++i) {
                if(age>=rng[i].first and age <= rng[i].second){
                    cur += rngPrio[{rng[i].first, rng[i].second}];
                    pqr++;
                }
                assert(pqr<2);
            }
            string tot = s + " " + t + " " + to_string(age);
            // string tot = "";
            // cout << tot << endl;
            // li.insert({cur, -id});
            mp[cur].push(id);
            ids.push_back(tot);
            id++;
        }
        // for(auto [xx,xxx,xxxx]: li) cerr << xx << " " << xxx << " " << xxxx << endl;
        // cerr << endl;
        while(m and (int)mp.size()){
            // auto [Pro, id] = *li.rbegin();
            // li.erase(li.find(*li.rbegin()));
            auto it = mp.rbegin();
            int nn = it->second.front();
            it->second.pop();
            if(it->second.empty()) mp.erase(it->first);
            cout << ids[nn-1] << nl;
            m--;
            // cout << endl;
            // cout << endl;
        }
    }
    int ss = 0;
    for(auto xxx : mp){
        ss += xxx.second.size();
    }
    cout << "Still unvaccinated people: " << ss << 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 08:53:04
Judged At
2024-12-09 08:53:04
Judged By
Score
30
Total Time
452ms
Peak Memory
42.75 MiB