原创 ACM寧夏賽記

啊哈哈哈哈哈水了個金啊 大一立的flag實現了啊 皇家每羊的第一枚region金啊 頓時覺得大學生涯得到了昇華了啊 一年半的ACM生涯沒白費啊 (抽風得瑟中 週六早成四點起牀和隊友去了機場 翹了微機實驗和大霧實驗 中午劉老師請我們吃了羊雜

原创 2019 Shanghai Online Contest Problem D Counting Sequences I

搜索思維題 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int Max=3000; const ll M=1e9+7; ll ANS[

原创 2019 Shanghai Online Contest Problem C Triple

做三遍fft 算法沒問題被卡常了 #include<bits/stdc++.h> using namespace std; typedef long long ll; const double PI = acos(-1.0); cons

原创 2019 Xuzhou Online Contest Problem G Colorful String

迴文樹 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=3e5+10; int NUM[N][30]; int check(i

原创 2019 Xuzhou Online Contest Problem K Center

將所有點的兩兩的中心處理出來,看哪個點被用的最多用哪個 尊龍的代碼~ #include<bits/stdc++.h> using namespace std; struct point{ int x,y; } p[1010]

原创 2013年數模B碎紙片拼接問題的解決方法

一直沒時間寫博客(其實是在咕咕咕),上週和隊友完美解決了這個國賽題目,寫下我們的方法 第一個問題,中文和英文的長條拼接。這是最簡單的爲題,首先建立一個圖鄰接矩陣,用一個紙片最右邊的向量到另一個製片最左邊向量的歐式距離當作這兩個點的距離,然

原创 2019 Nanchang Online Contest Problem H The Nth Item

線性遞推函數的循環節是mod+1,但還是被卡時間,所以先把1-1e7中的F函數放到內存中,用矩陣快速冪提前處理出1e7~100e7的冪的特徵矩陣,這樣每次回答尋用只用O(1)的時間 #include<bits/stdc++.h> usi

原创 2019 Nanchang Online Contest Problem I Yukino With Subinterval

將每個連續的最右端賦值權值1,需要寫帶修改的主席樹,我沒寫過拿CDQ分治水過 這題居然是全場AC最少的題目,我一個半小時搞定(其實是因爲寫主席樹寫了一半發現不會寫,改成了CDQ分治) #include<bits/stdc++.h> us

原创 2019 Xuzhou Online Contest Problem I Query

很腦殘的寫了主席樹,其實樹狀數組就能解決 #include<bits/stdc++.h> using namespace std; const int N=2e5+10; inline void read(int &x){char ch

原创 HDU 6599 Palindromic_Automaton

迴文自動機插入的時候判斷合法性 #include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int N=3e5+10; ll p[N

原创 HDU 6579 Operation Linear Basis

帶位置信息的線性基 #include<bits/stdc++.h> using namespace std; const int N=1e6+10; int A[N]; struct Linear_Basis{ int d[30

原创 LuoGu P3808 Aho Corasick Automaton

字符串經典算法 #include<bits/stdc++.h> using namespace std; const int N = 1e6 + 10; struct Aho_Corasick_Automaton { int c

原创 BZOJ 2396 神奇的矩陣

隨機算法 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e3+10; ll A[N][N],B[N][N],C[N][N]

原创 Codeforces 1195F Geometers Anonymous Club

可以寫樹狀數組,這裏直接寫的線段樹 #include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10; struct SegmentTree { int l,

原创 LuoGu P3796 Aho Corasick Automaton

這個做法其實有問題的,能過是因爲給的數據範圍有點怪,完全可以加強數據範圍卡掉 最好的做法是在find時在fail樹上打標記,最後bfs #include<bits/stdc++.h> using namespace std; const