原创 模擬賽1sol

2月16日簡要題解 light 這個題作爲第一題是難了一點 = =。 下文中的“有解”表示“先手必勝”,首先說一個結論: 如果 N=2k​N=2^k​N=2k​,那麼對於任意的初始局面是有解的。 否則,並不是每一種局面都是先手必勝的

原创 P1330 封鎖陽光大學 圖論前序**

//2//可能不只有一個聯通塊 ,因此每個聯通塊要求一個最小值 //1//dfs的時候結果爲真,不能返回,否則for循環就不繼續枚舉了,只有假的時候返回 #include<iostream> #include<cstdio> #inc

原创 P3384 【模板】樹鏈剖分

#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; typedef

原创 set基本用法

#include <iostream> #include <set> using namespace std; int main() { set<int> s; s.insert(2); s.inse

原创 SP1043 GSS1 - Can you answer these queries I

#include<bits/stdc++.h> #define LL long long #define INF 0x3f3f3f3f using namespace std; int n,m,a[500005]; struct Tree

原创 有上下界的網絡流

https://www.cnblogs.com/gtarcoder/p/4888973.html

原创 P1083 借教室

二分+前綴和,以後看 //拿來複習線段樹了 #include<bits/stdc++.h> #define mx 1000005 using namespace std; int a[mx]; int n,m; int read()//

原创 gss4

#include<bits/stdc++.h> #define N 100005 #define ll long long using namespace std; int n; ll a[N]; struct Tree{ int

原创 P3128 [USACO15DEC]最大流Max Flow [樹上差分-點差]

兩點間的路徑每個點給一個單位的壓力,詢問最大壓力的點。 LCA用的離線,點在樹上差分 #include<bits/stdc++.h> #define mxn 500005 using namespace std; int n,k,x,y,

原创 bzoj3211 花神遊歷各國

單點修改,區間查詢,優化方法:sqrt到一定程度,數爲0,向上傳標記,下次再修改時,如果有標記,則不修改,提高修改的時間。區間查詢和普通的一樣。 #include<iostream> #include<cstdio> #include<c

原创 gss3

#include<bits/stdc++.h> #define LL long long #define INF 0x3f3f3f3f using namespace std; int n,m,a[500005]; struct Tree

原创 CDQ分治

https://www.cnblogs.com/mlystdcall/p/6219421.html

原创 poj 2686 最短路

#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <vector> #include <queue> #include <

原创 雙向鏈表 應用

雙向鏈表 應用 營業額統計 開車旅行 https://blog.csdn.net/pbihao/article/details/52831600

原创 tsp

#include<bits/stdc++.h> #define inf 0x3f3f3f3f using namespace std; int dp[130005][17]; int n,m,x,y,w,len[17][17]; int