关于此题的 spfa
查看原帖
关于此题的 spfa
663199
Tachibana27楼主2025/7/3 14:32

rt,请问在这一题中 spfa 的队列中是否最多只会有 2×n×n2\times n\times n 个元素?我手写队列的时候炸掉了,

class Que{
	public:
		int q[N];
		int h;
		int t;
		inline void ini(){
			h=1;
			t=0;
			return;
		}
		inline void pop(){
			h++;
			if(h==N)
				h=1;
			return;
		}
		inline void push(int x){
			t++;
			if(t==N)
				t=1;
			q[t]=x;
			return;
		}
		inline int top(){
			return q[h];
		}
		inline bool empty(){
			return h>t;
		}
}q;

其中 N=2*51*51https://www.luogu.com.cn/record/222173116

2025/7/3 14:32
加载中...