Why!!
2025-10-04 14:13:31
发布于:福建
19阅读
0回复
0点赞
这为啥过不了!!
# include <bits/stdc++.h>
using namespace std;
struct info{
bool type;
int cost;
long long time;
};
int main (){
int n,m;
cin>>n;
info init;
vector<info> infos(n);
vector<long long> p;
for(int i=0;i<n;i++){
cin>>infos[i].type>>infos[i].cost>>infos[i].time;
if(infos[i].type==0){
m++;
p.emplace_back(infos[i].time);
}
}
long long sum=infos[0].cost,ltime=infos[0].time;
bool ltype=infos[0].type;
int l=0;
for(int i=1;i<n;i++){
if(infos[i].type){
l=0;
while(p[l++]+45>=infos[i].time || l==m){}
l--;
if(l!=m){
if(p[l]<infos[i].time){
infos[i].cost=0;
p[l]=-46;//用了
}
}
}
sum+=infos[i].cost;
}cout<<sum;
return 0;
}
全部评论 1
我怎么知道,你问范楚时去
2025-10-12 来自 广东
0?
2025-10-12 来自 福建
0



有帮助,赞一个