/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 1ms 816.0 KiB
#3 Accepted 3ms 844.0 KiB
#4 Accepted 23ms 2.004 MiB
#5 Accepted 190ms 12.871 MiB
#6 Accepted 1010ms 50.805 MiB
#7 Accepted 891ms 50.844 MiB
#8 Time Exceeded ≥2047ms ≥47.875 MiB
#9 Time Exceeded ≥2014ms ≥48.039 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 08:04:09
Judged At
2024-12-09 08:04:09
Judged By
Score
60
Total Time
≥2047ms
Peak Memory
≥50.844 MiB