摘要:
###1.数组模拟队列(hh=0,tt=-1模拟的是双端队列) int q[N] int hh=0,tt=-1;队头指针和队尾指针. push -> q[++tt]=x; pop -> hh++;//从队头弹出 pop -> tt--;//从队尾弹出 empty() -> cout<<((hh<=t 阅读全文
摘要:
acwing851—spfa求最短路 #include<iostream> #include<cstring> #include<algorithm> #include<queue> using namespace std; const int N=1e5+10; int n,m; int idx, 阅读全文
摘要:
#include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=510,M=1e4+10; int n,m,k,dis[N],backup[N]; //dis数组表示dis[i]到起点 阅读全文