求助
查看原帖
求助
973480
封禁用户楼主2024/7/18 18:10
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5;
int n,num=1;
long long ans=0;
struct piao{
    int c,p,t;
}a[maxn];
struct yh{
    int prime,time;
    bool f;
}youhui[maxn];
int main(){
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i].c >> a[i].p >> a[i].t;
        if(a[i].c==0){
            ans+=a[i].p;
            youhui[num].prime=a[i].p;
            youhui[num].time=a[i].t;
            youhui[num].f=true;
            num++;
        }
        else{
            bool flag=true;
            for(int j=1;j<=num;j++){
                if(a[i].p<=youhui[j].prime&&a[i].t-youhui[j].time<=45&&youhui[j].f==true){
                    flag=false;
                    break;
                }
            }
            if(flag){
                ans+=a[i].p;
            }
        }
    }
    cout << ans;
    return 0;
}
2024/7/18 18:10
加载中...