2 条题解

  • 0
    @ 2026-10-6 9:29:03
    #include<bits/stdc++.h>
    using namespace std;
    struct node{
    	int p,t;
    	bool f;
    } q[100005];
    int head=1,tail=0,n,sum=0;
    int main(){
    	cin>>n;
    	int ty,pi,ti;
    	for(int i=1;i<=n;i++){
    		cin>>ty>>pi>>ti;
    		if(ty==0){
    			sum+=pi;
    			q[++tail]={pi,ti,false}; 
    		}else{
    			bool b=false;
    			while(head<=tail&&ti-q[head].t>45) head++;
    			for(int i=head;i<=tail;i++){
    				if(q[i].p>=pi&&q[i].f==false){
    					b=true;
    					q[i].f=true;
    					break;
    				}
    			}
    			if(b==false) sum+=pi; 
    		}
    	}
    	cout<<sum;
    	return 0;
    }
    
    
    • 0
      @ 2026-10-6 9:28:54
      
      
      • 1

      信息

      ID
      84
      时间
      1000ms
      内存
      256MiB
      难度
      9
      标签
      递交数
      127
      已通过
      11
      上传者