3个TLE,求解
2026-08-21 20:24:57
发布于:广东
2阅读
0回复
0点赞
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
typedef long long ll;
const ll N=1e6+10;
const ll M=5050;
ll n,ans,flag;
struct node{
ll p,t,u;
};
vector<node>vt;
int main(){
cin>>n;
for(ll i=1;i<=n;i++){
ll a,b,c;
cin>>a>>b>>c;
if(a==0){
vt.push_back({b,c,0});
ans+=b;
}
else{
for(ll i=0;i<vt.size();i++){
if(vt[i].u==0&&b<=vt[i].p&&c-vt[i].t<=45){
vt[i].u=1;
flag=1;
break;
}
}
if(flag!=1)ans+=b;
flag=0;
}
}
cout<<ans;
return 0;
}
这里空空如也





有帮助,赞一个