2 solutions
-
0
Guest MOD
-
1
#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 (x==0) { 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].o==0 && p[j].money>=p1) { p[j].o=1; cnt++; break; } } if (cnt==0){ ans+=p1; } } } cout<<ans; return 0; }
Information
- ID
- 52
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 5
- Tags
- # Submissions
- 73
- Accepted
- 30
- Uploaded By