BIT區間加值 緒論眾所周知,BIT能夠實現在$O(n)$空間下單點加值,並計算區間和。至於區間加值則需要使用線段樹及lazy tag。但線段樹code超長,debug很累,而且需要約$4n$的空間。 於是我們想要在BIT上實作區間加值,這有可能嗎? 答案是肯定的。 正文差分差分就是將序列中的每一項改為自己減去前一項之值,也就是說: $g_i = f_i - f_{i - 1} 2022-12-07 資訊 > 演算法 #algo #BIT
Codeforces - Restore-the-Permutation Codeforces出處 Codeforces Round 834 (Div. 3)難度 1900標籤 binary search constructive algorithms data structures greedy math *1900 Codeforces - Restore-the-PermutationRestor 2022-12-07 資訊 > 題解 > Codeforces #solution #greedy
d799. 区间求和 - 高中生程式解題系統 Zerojudge解題紀錄 d799. 区间求和 - 高中生程式解題系統Zerojudge-d799-3.cpp // Author : ysh // 12/07/2022 Wed 12:54:30.08 #include<bits/stdc++.h> using namespace std; struct tree{ ve 2022-12-07 資訊 > 題解 > Zerojudge #solution #BIT
Codeforces - Mouse-Hunt Codeforces出處 Educational Codeforces Round 49 (Rated for Div. 2)難度 1700標籤 dfs and similar graphs *1700 Codeforces - Mouse-HuntMouse-Hunt.cpp // Author : ysh // 12/07/2022 2022-12-07 資訊 > 題解 > Codeforces #solution #DFS
1175 - Longest Increasing Subsequence | TIOJ INFOR Online Judge 1175 - Longest Increasing Subsequence | TIOJ INFOR Online JudgeTIOJ-1175.cpp // Author : ysh // 12/07/2022 Wed 11:27:02.80 // https://tioj.ck.tp.edu.tw/problems/1175 #include<bits/stdc++.h> using n 2022-12-07 資訊 > 題解 > TIOJ #solution #DP
d539. 區間 MAX - 高中生程式解題系統 Zerojudge解題紀錄 d539. 區間 MAX - 高中生程式解題系統Zerojudge-d539-7.cpp // Author : ysh // 12/07/2022 Wed 9:10:36.25 #include<bits/stdc++.h> using namespace std; #define N 500000 int m 2022-12-07 資訊 > 題解 > Zerojudge #solution #sqrt
微積分上課筆記5 段考範圍 羅畢達定理 when $f(x)$ and $g(x)$ are differentiable and $g’(a)\neq 0$,thenif $\displaystyle \lim_{x \rightarrow a} f(x) = 0$ $\displaystyle \lim_{x \rightarrow a} g(x) = 0$ (or 2022-12-05 數學 > 上課筆記 #math #calculus
Codeforces - Multi-Colored-Segments Codeforces出處 Codeforces Round 826 (Div. 3)難度 2000標籤 binary search data structures math sortings *2000 Codeforces - Multi-Colored-SegmentsMulti-Colored-Segments.cpp // A 2022-12-03 資訊 > 題解 > Codeforces #solution #seg_tree #offline
2022.11 TOI 潛力組題解 因為感覺沒甚麼人在寫TOI練習賽題解,而且為了拯救快變成修課筆記的競程筆記,想說來寫看看 Cycleproblem給定一有向圖,求能夠到達任一環路的所有點集合。 solution開一個陣列倒著記錄每一個有向邊。再用一個陣列記錄入度,跑一次拓樸排序,剩下入度不為0的點即是環路及可到達環路的點(因為是倒著紀錄)。 code code // 2022-12-02 資訊 > 題解 #algo #solution #exam
CSES - Hotel Queries CSES - Hotel QueriesHotel-Queries.cpp // Author : ysh // 11/29/2022 Tue 17:06:04.59 // https://cses.fi/problemset/task/1143 #include<bits/stdc++.h> using namespace std; struct box{ int x; 2022-11-29 資訊 > 題解 > CSES #solution #binary_search #seg_tree