/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 3ms 744.0 KiB
#4 Accepted 18ms 1.992 MiB
#5 Accepted 143ms 12.871 MiB
#6 Accepted 771ms 50.617 MiB
#7 Accepted 731ms 50.832 MiB
#8 Time Exceeded ≥2095ms ≥48.25 MiB
#9 Time Exceeded ≥2055ms ≥48.078 MiB

Code

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

typedef long long ll;
#define bug(a) cout<<#a<<" : "<<a<<endl;
#define bug2(a,b) cout<<#a<<" : "<<a<<"\t"<<#b<<" : "<<b<<endl;
struct node{
    string n,jo;
    int a,x,y;
};
bool cmp(node &f,node &g)
{
    if(f.x==g.x)return f.y<g.y;
    return f.x>g.x;
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t=1;
    while(t--){
        int d,j,g;
        cin>>d>>j>>g;
        map<string,int> mp;
        map<int,int>mp1;
        while(j--)
        {
            string s;
            int x;
            cin>>s>>x;
            mp[s]=x;
        }
        while(g--)
        {
            int a,b,c;
            cin>>a>>b>>c;
            for(int i=a; i<=b; i++)
            {
                mp1[i]=c;
            }
        }
        
        map<int,int> mp4;
        vector<node> v;
        int num=0,vac=0,vac2=0;
        j=0;
        while(d--)
        {
            int n,m;
            cin>>n>>m;
            num += n;
            vac += m;
            vac2 += m;
            while(n--){
                string a,b;
                int c;
                cin>>a>>b>>c;
                int z=mp[b]+mp1[c];
                mp4[z]++;
                node temp;
                temp.n=a;
                temp.jo=b;
                temp.a=c;
                temp.x=z;
                temp.y=mp4[z];
                v.push_back(temp);
            }
            sort(v.begin()+j,v.end(),cmp);
            while(vac2>0 && j<v.size()){
                cout<<v[j].n<<" "<<v[j].jo<<" "<<v[j].a<<endl;
                j++;
                vac2--;
            }
        }
        num -= vac;
        if(num<0)num=0;
        cout<<"Still unvaccinated people: "<<num<<endl;
    }
    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 09:37:59
Judged At
2024-12-09 09:37:59
Judged By
Score
60
Total Time
≥2095ms
Peak Memory
≥50.832 MiB