/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 1ms 540.0 KiB
#3 Runtime Error 4ms 904.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  long double
#define ull unsigned long long
#define PI acos(-1.0)
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<pii>
#define rev_str(str) reverse(str.begin(),str.end());
#define print(v) for(auto i:v) cout<<i<<" ";cout<<endl;
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(ll i =a ;i<b;i++)
#define per(i,b,a) for(ll i=b;i>=a;i--)
#define all(a)  (a.begin(),a.end())
#define srt(a) sort(all(a))
#define rsrt(a) sort(a.rbegin(),a.rend())
bool sortByValue(const pair<int,int>& a,const pair<int,int>& b){
    return a.second > b.second;
}
bool sortByValueS(const pair<string,int>& a,const pair<string,int>& b){
    return a.second > b.second;
}
const ll N=10e5+5;

ll gcd(ll a,ll b){
    return b == 0 ? a : gcd(b, a%b);
}

ll lcm(ll a,ll b){
    return (a / gcd(a, b)) * b;
}


void solve(){
    ll D, J, G;
    cin >> D >> J >> G;
    map <string, ll> job;
    for (int i = 0; i < J; i++){
        string s; ll pr;
        cin >> s >> pr;
        job[s]+= pr; 
    }
    vector <pair <pair <ll, ll>, ll>> age(G);
    for (int i = 0; i< G; i++){
        cin >> age[i].first.first >> age[i].first.second >> age[i].second;
    }

    int vec = 0, total = 0;
    vector <pair<string, ll>> line;

    while(D--){
        ll N, M;
        cin >> N >> M;
        vec += M;
        total += N;
        while(N--){
            string name, kam;
            cin >> name >> kam;
            int priorety = 0, boyosh;
            cin >> boyosh;

            if (job.find(kam) != job.end()){
                priorety += job[kam];
            }

            for (int i = 0; i < age.size(); i++){
                if (boyosh >= age[i].first.first && boyosh <= age[i].first.second){
                    priorety += age[i].second;
                }
            }
            string ss = to_string(boyosh);
            string man = name + ' ' + kam + ' ' + ss + " ";
            line.push_back({man, priorety});
        }
    }

    //for (auto i : line) cout << i.first << ' ' << i.second << endl;
    sort(line.begin(), line.end(), sortByValueS);
    //for (auto i : line) cout << i.first << ' ' << i.second << endl;
    int j = 0;
    int x = vec;
    while(vec--){
        cout << line[j].first << endl;
        j++;
    }
    cout << "Still unvaccinated people: " << max(0,total - x) << endl;
    
}

int main(){
    fast;

    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:51:09
Judged At
2024-12-09 08:51:09
Judged By
Score
0
Total Time
4ms
Peak Memory
904.0 KiB