/ SeriousOJ /

Record Detail

Memory Exceeded


  
# Status Time Cost Memory Cost
#1 Memory Exceeded ≥1184ms ≥1.0 GiB
#2 Time Exceeded ≥2094ms ≥1.773 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
P1098 KuZ the Maximum spanning tree
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 09:38:38
Judged At
2024-12-09 09:38:38
Judged By
Score
0
Total Time
≥2094ms
Peak Memory
≥1.0 GiB