/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 2ms 812.0 KiB
#4 Accepted 9ms 1.973 MiB
#5 Accepted 83ms 13.188 MiB
#6 Accepted 397ms 51.199 MiB
#7 Accepted 585ms 46.727 MiB
#8 Wrong Answer 573ms 48.383 MiB
#9 Wrong Answer 577ms 48.301 MiB

Code

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

struct id {
    string name, job;
    int age;
    id(string name_, string job_, int age_) {
        name = name_; job = job_; age = age_;
    }
};

void solve() {
    int D, J, G; cin >> D >> J >> G;
    map<string, int> job;
    for (int i = 0; i < J; i++) {
        string name; cin >> name;
        int p; cin >> p;
        job[name] += p; 
    }
    vector<array<int, 2>> age;
    for (int i = 0; i < G; i++) {
        int l, r, p; cin >> l >> r >> p;
        age.push_back({l, p});
    }
    sort(age.begin(), age.end());
    vector<id> entry;
    multiset<array<int, 2>> rem;
    int vac = 0;
    for (int it = 0; it < D; it++) {
        int n, m; cin >> n >> m;
        vac += m;
        for (int i = 0; i < n; i++) {
            string name, job_name;
            cin >> name;
            cin >> job_name;
            int cur_age; cin >> cur_age;
            // cout << name << " " << job_name << " " << cur_age << '\n';
            int priority = job[job_name];
            for (int j = age.size() - 1; j >= 0; j--) {
                if (age[j][0] <= cur_age) {
                    priority += age[j][1]; break;
                }
            }
            rem.insert(array<int, 2>{-priority, int(entry.size())});
            entry.push_back(id(name, job_name, cur_age));
        }
        while (!rem.empty() && vac > 0) {
            vac -= 1;
            auto f = *rem.begin();
            rem.erase(rem.begin());
            int _id = f[1];
            cout << entry[_id].name << " " << entry[_id].job << " " << entry[_id].age << '\n';
        }
    }
    cout << "Still unvaccinated people: " << rem.size() << '\n';
} 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    // cin >> tt;
    for(int t = 1; t <= tt; t++) {
        solve();
    }
}

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:56
Judged At
2024-12-10 11:28:56
Judged By
Score
60
Total Time
585ms
Peak Memory
51.199 MiB