/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 332.0 KiB
#2 Runtime Error malloc(): mismatching next->prev_size (unsorted) 2ms 796.0 KiB
#3 Runtime Error 2ms 796.0 KiB

Code

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std ;
using namespace __gnu_pbds;
template<typename T>using o_set=tree<T,null_type,std::less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define opt() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+10 ;
const int mod= 1e9+7 ;
#define pb push_back
#define mp make_pair

bool cmp(pair<int,int>a,pair<int,int>b)
{
    if(a.first>b.first)return true;
    else if(a.first==b.first)
    {
        return a.second<b.second;
    }
    return false;
}

int32_t main()
{
    opt();
    int tt=1;
    //cin>>tt;
    for(int tc=1; tc<=tt; tc++)
    {
        int d,j,g;
        cin>>d>>j>>g;
        map<string,int>job;
        for(int i=0; i<j; i++)
        {
            string s;
            cin>>s;
            int pr;
            cin>>pr;
            job[s]=pr;
        }
        vector<int>age(126);
        for(int i=0; i<g; i++)
        {
            int l,r,val;
            cin>>l>>r>>val;
            for(int i=l; i<=r; i++)age[i]=val;
        }
        map<string,int>name;
        vector<pair<string,int>>vec;
        map<string,int>nmbr;
        map<int,string>inv;
        vector<pair<int,int>>vect;
        int totalVac=0;
        int jj=1;
        int tn=0;
        for(int i=0; i<d; i++)
        {
            int n,m;
            cin>>n>>m;
            tn+=n;
            totalVac+=m;

            for(int i=0; i<n; i++)
            {
                string a,b;
                cin>>a>>b;
                string con=a;
                con+=" ";
                con+=b;
                int x;
                cin>>x;
                string y=to_string(x);
                con+=" ";
                con+=y;
                name[con]=job[b]+age[x];
                vec.pb({con,name[con]});
                nmbr[con]=jj;
                inv[jj]=con;
                vect.pb({name[con],jj});
                jj++;

            }
            if(vec.size()>=2)sort(vect.begin(),vect.end(),cmp);
            vector<string>ans1;
            for(int i=0; i<m; i++)
            {
                cout<<inv[vect[0].second]<<endl;
                vect.erase(vect.begin());
            }

        }

        // for(int i=0;i<vect.size();i++)
        // {
        //     cout<<vect[i].first<<" "<<vect[i].second<<endl;
        // }

        cout<<"Still unvaccinated people: "<<tn-totalVac<<endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1148 e-Vaccine
Contest
LU IUJPC : Sylhet Division 2024
Language
C++11 (G++ 13.2.0)
Submit At
2024-12-09 09:30:40
Judged At
2024-12-09 09:30:40
Judged By
Score
0
Total Time
2ms
Peak Memory
796.0 KiB