摘要:
题目链接:https://www.luogu.org/problemnew/show/P2002 缩点把原图变为DAG,再在DAG上判断找入度为0的点的个数。 注意一点出度为0的点的个数不等于入度为0的点。 include include include include include using 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P2169 tarjan缩点 + SPFA 缩完点之后加边注意别写错。 也可以不用建两个图,可以在一张图上判断是否强连通再SPFA. include include include include include 阅读全文
摘要:
无优化:500ms deque优化:400ms include include include include include using namespace std; const int maxn = 550000; const int inf = 0x7fffffff; int dis[maxn 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P2939 本来说是双倍经验题,跟飞行路线一样的,结果我飞行路线拿deque优化SPFA过了这里过不了了。 所以多学一种优先队列优化。 include include include include include 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P4568 卡了一晚上,算是分层图最短路的模板。注意卡SPFA,所以我写了个SLF优化。 同时 AC400祭!~ include include include include include define ri 阅读全文
摘要:
题目链接:http://noi.openjudge.cn/ch0206/9277/ ... include include include include using namespace std; struct Matrix{ long long m[3][3]; }A,E,ans; long lo 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P2880 是你逼我用ST表的啊qaq include include include include using namespace std; const int maxn = 500001; int minst 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P1774 归并排序求逆序对。 include define livelove long long using namespace std; const int maxn = 600001; livelove a[ 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P1462 记住HP=0也叫死。 include include include include include using namespace std; const int maxn = 5000001; con 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P3808 include include include include include using namespace std; const int maxn = 1000010; int n, trie[ma 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P1801 替罪羊树吼啊! include include include include define il inline using namespace std; const int maxn = 200000 阅读全文
摘要:
题目链接:https://www.luogu.org/problemnew/show/P2590 我想学树剖QAQ include include include include using namespace std; const int maxn = 31000; int fa[maxn], d 阅读全文