样例对了提交0分
查看原帖
样例对了提交0分
1285326
wzjDD楼主2025/7/20 10:50
#include<bits/stdc++.h>
using namespace std;
struct s{
	long long ti,mo;
}a[100001];
queue<long long> q;
int main(){
	long long z = 0,k = 0,h = 0,u = 0,n,m,s = 0,r;
	cin>>n;
	for(int i = 0;i < n;i++){
		cin>>z>>m>>h;
		if(z == 0){
			s+=m;
			a[u].mo = m;
			a[u].ti = h;
			q.push(u);
			u++;
		}
		if(z == 1){
			r = 0;
			int j = 0;
			while(j < u){
				if(q.empty())break;
				int f = q.front();q.pop();
				if(h - a[f].ti <= 45 && m <= a[f].mo && r == 0){
					r = 1;
				}
				else if(h - a[f].ti <= 45) q.push(f);
				j++;
			}
			if(r == 0)s += m;
			else u--;
		}
	}
	cout<<s; 
	return 0;  
}

2025/7/20 10:50
加载中...