求调!思路跟题解差不多,但全WA
查看原帖
求调!思路跟题解差不多,但全WA
1003901
Angela2022楼主2023/10/19 19:03
#include<bits/stdc++.h>
using namespace std;
struct ride{
	int p,t;
};
ride bus[100010],sub[100010];
bool vis[100010],book[100010];
int main(){
	int n;
	cin>>n;
	int ctb=0,cts=0,ans=0;
	int k=1;
	for(int i=1;i<=n;i++){
		int id,p,t;cin>>id>>p>>t;
		if(id==0){
			sub[++cts]=(ride){p,t};
			ans+=p;
			cout<<ans<<endl;
		}
		else{
			bus[++ctb]=(ride){p,t};
			cout<<k<<" "<<p<<" "<<t<<endl;
			bool ch=false;
				for(int j=k;j<=cts;j++){
					cout<<j<<" "<<book[j]<<" "<<p<<sub[j].p<<endl;
					if(!book[j]&&t<=sub[j].t+45&&p<=sub[j].p){
						k=j;
						book[j]=true;
						ch=true;
						break;
					}
					else{
						if(t>sub[cts].t+45){
						    k=cts+1;
						}
					}
					if(!ch)ans+=p;
					cout<<ans<<endl;
				}
		}
	}
	cout<<ans<<endl;
	return 0;
}
2023/10/19 19:03
加载中...