优先队列vector溢出
查看原帖
优先队列vector溢出
945364
LiJoQiao楼主2023/3/24 18:44

写到一半试运行了一下,然后 terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. 然后RE了... 代码如下 请问用什么替代

#include<cstdio>
#include<queue>
using namespace std;
priority_queue<int,vector<int>,greater<int> > q[6];
int main()
{
	int n,P,t;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&P,&t);
		q[i-1].push(t);
	}
	return 0;
	
}
2023/3/24 18:44
加载中...