5 solutions

  • -1
    @ 2026-1-14 18:01:47

    #include<bits/stdc++.h> using namespace std; struct hunmer { bool o; int money,time; }; long long n,ans,p1,m,t,num,h=1,cnt; int main() { hunmer p[100001]; cin>>n; bool x; for (int i=1; i<=n; i++) { cin>>x>>p1>>t; if (x0) { num++; p[num].money=p1; p[num].time=t; ans+=p1; } else { cnt=0; while (t-p[h].time>45&&h<=num) { h++; } for (int j=h; j<=num; j++) { if (p[j].o0 && p[j].money>=p1) { p[j].o=1; cnt++; break; } } if (cnt==0){ ans+=p1; } } } cout<<ans; return 0; }

    Information

    ID
    57
    Time
    2000ms
    Memory
    512MiB
    Difficulty
    5
    Tags
    (None)
    # Submissions
    60
    Accepted
    23
    Uploaded By