From d5a5c18c1a4b51aba31b694eff4b983394453a84 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Fri, 20 May 2022 09:23:27 +0800 Subject: [PATCH] chore: separate definition blocks --- .clang-format | 1 + AcWing/1279/1279.cpp | 1 + AcWing/17/17.cpp | 6 +++--- AcWing/20/20.cpp | 14 ++++++------ AcWing/2437/2437.cpp | 1 + AcWing/247/247.cpp | 2 ++ AcWing/253/253.cpp | 1 + AcWing/2568/2568.cpp | 1 + AcWing/3068/3068.cpp | 2 ++ AcWing/859/859.cpp | 1 + AcWing/918/918.cpp | 1 + BZOJ/2243/2243.cpp | 1 + Codeforces/1661/D/D.cpp | 1 + Codeforces/1679/B/B.cpp | 1 + Gym/103081/I/I.cpp | 1 + Gym/237040/F/F.cpp | 1 + HDU/6080/6080.cpp | 2 ++ LibreOJ/10127/10127.cpp | 2 ++ LibreOJ/10128/10128.cpp | 1 + LibreOJ/10129/10129.cpp | 2 ++ LibreOJ/10138/10138.cpp | 1 + LibreOJ/10141/10141.cpp | 1 + LibreOJ/102/102.cpp | 1 + LibreOJ/104/104.cpp | 1 + LibreOJ/105/105.cpp | 1 + LibreOJ/123/123.cpp | 1 + LibreOJ/131/131.cpp | 2 ++ LibreOJ/132/132.cpp | 1 + LibreOJ/2054/2054.cpp | 1 + LibreOJ/2125/2125.cpp | 1 + LibreOJ/2130/2130.cpp | 1 + LibreOJ/2279/2279.cpp | 1 + LibreOJ/2606/2606.cpp | 1 + LibreOJ/2633/2633.cpp | 4 ++++ LibreOJ/2759/2759.cpp | 1 + LibreOJ/4/4.cpp | 9 +++++--- LibreOJ/6013/6013.cpp | 1 + Luogu/CF383C/CF383C.cpp | 1 + Luogu/CF438D/CF438D.cpp | 1 + Luogu/CF920F/CF920F.cpp | 1 + Luogu/P1000/P1000.c | 48 ++++++++++++++++++++--------------------- Luogu/P1068/P1068.cpp | 1 + Luogu/P1083/P1083.cpp | 1 + Luogu/P1093/P1093.cpp | 1 + Luogu/P1105/P1105.cpp | 1 + Luogu/P1182/P1182.cpp | 1 + Luogu/P1206/P1206.cpp | 3 +++ Luogu/P1383/P1383.cpp | 1 + Luogu/P1440/P1440.cpp | 1 + Luogu/P1471/P1471.cpp | 2 ++ Luogu/P1486/P1486.cpp | 1 + Luogu/P1531/P1531.cpp | 2 ++ Luogu/P1765/P1765.cpp | 1 + Luogu/P1789/P1789.cpp | 1 + Luogu/P1801/P1801.cpp | 1 + Luogu/P1816/P1816.cpp | 2 ++ Luogu/P1947/P1947.cpp | 1 + Luogu/P2003/P2003.cpp | 1 + Luogu/P2023/P2023.cpp | 2 ++ Luogu/P2036/P2036.cpp | 1 + Luogu/P2045/P2045.cpp | 1 + Luogu/P2068/P2068.cpp | 2 ++ Luogu/P2073/P2073.cpp | 1 + Luogu/P2146/P2146.cpp | 1 + Luogu/P2153/P2153.cpp | 1 + Luogu/P2251/P2251.cpp | 1 + Luogu/P2343/P2343.cpp | 1 + Luogu/P2357/P2357.cpp | 2 ++ Luogu/P2412/P2412.cpp | 2 ++ Luogu/P2471/P2471.cpp | 1 + Luogu/P2486/P2486.cpp | 1 + Luogu/P2502/P2502.cpp | 3 +++ Luogu/P2574/P2574.cpp | 3 +++ Luogu/P2590/P2590.cpp | 1 + Luogu/P2846/P2846.cpp | 2 ++ Luogu/P2880/P2880.cpp | 2 ++ Luogu/P2895/P2895.cpp | 1 + Luogu/P3063/P3063.cpp | 1 + Luogu/P3178/P3178.cpp | 1 + Luogu/P3353/P3353.cpp | 2 ++ Luogu/P3366/P3366.cpp | 1 + Luogu/P3368/P3368.cpp | 2 ++ Luogu/P3372/P3372.cpp | 2 ++ Luogu/P3373/P3373.cpp | 10 +++++---- Luogu/P3381/P3381.cpp | 1 + Luogu/P3384/P3384.cpp | 1 + Luogu/P3385/P3385.cpp | 1 + Luogu/P3387/P3387.cpp | 1 + Luogu/P3391/P3391.cpp | 1 + Luogu/P3833/P3833.cpp | 1 + Luogu/P3870/P3870.cpp | 1 + Luogu/P4016/P4016.cpp | 1 + Luogu/P4092/P4092.cpp | 1 + Luogu/P4114/P4114.cpp | 1 + Luogu/P4145/P4145.cpp | 1 + Luogu/P4315/P4315.cpp | 1 + Luogu/P4588/P4588.cpp | 2 ++ Luogu/P4668/P4668.cpp | 4 ++++ Luogu/P5057/P5057.cpp | 2 ++ Luogu/P5097/P5097.cpp | 2 ++ Luogu/P5490/P5490.cpp | 2 ++ Luogu/P5731/P5731.cpp | 2 +- Luogu/P5837/P5837.cpp | 1 + Luogu/P7667/P7667.cpp | 1 + Luogu/P7912/P7912.cpp | 1 + Luogu/P8251/P8251.cpp | 1 + Luogu/SP2713/SP2713.cpp | 2 ++ Luogu/SP3267/SP3267.cpp | 1 + Luogu/SP7259/SP7259.cpp | 2 ++ S2OJ/100/100.cpp | 1 + S2OJ/104/104.cpp | 1 + S2OJ/1159/1159.cpp | 4 ++++ S2OJ/1172/1172.cpp | 1 + S2OJ/1199/1199.cpp | 1 + S2OJ/1224/1224.cpp | 1 + S2OJ/1256/1256.cpp | 2 ++ S2OJ/1266/1266.cpp | 1 + S2OJ/438/438.cpp | 2 ++ S2OJ/790/790.cpp | 1 + S2OJ/99/99.cpp | 1 + 120 files changed, 202 insertions(+), 42 deletions(-) diff --git a/.clang-format b/.clang-format index 622e7d42..5e59cc3e 100644 --- a/.clang-format +++ b/.clang-format @@ -11,4 +11,5 @@ AllowShortFunctionsOnASingleLine: Empty AllowShortCaseLabelsOnASingleLine: true AllowShortIfStatementsOnASingleLine: true EmptyLineBeforeAccessModifier: LogicalBlock +SeparateDefinitionBlocks: Always PointerAlignment: Right diff --git a/AcWing/1279/1279.cpp b/AcWing/1279/1279.cpp index cf569c96..8f1716f3 100644 --- a/AcWing/1279/1279.cpp +++ b/AcWing/1279/1279.cpp @@ -105,6 +105,7 @@ struct node { node() : l(0), r(0), s(0), d(0), lc(0), rc(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} } tr[N << 2]; diff --git a/AcWing/17/17.cpp b/AcWing/17/17.cpp index 2c2f82bd..4359aad4 100644 --- a/AcWing/17/17.cpp +++ b/AcWing/17/17.cpp @@ -7,11 +7,11 @@ * }; */ class Solution { -public: + public: vector printListReversingly(ListNode* head) { vector res; - ListNode *tail = head; - while(tail != NULL) { + ListNode* tail = head; + while (tail != NULL) { res.push_back(tail->val); tail = tail->next; } diff --git a/AcWing/20/20.cpp b/AcWing/20/20.cpp index 9858f775..3344f0f2 100644 --- a/AcWing/20/20.cpp +++ b/AcWing/20/20.cpp @@ -1,29 +1,29 @@ class MyQueue { -private: + private: queue q; -public: + + public: /** Initialize your data structure here. */ MyQueue() { - } - + /** Push element x to the back of queue. */ void push(int x) { q.push(x); } - + /** Removes the element from in front of queue and returns that element. */ int pop() { int ret = q.front(); q.pop(); return ret; } - + /** Get the front element. */ int peek() { return q.front(); } - + /** Returns whether the queue is empty. */ bool empty() { return q.empty(); diff --git a/AcWing/2437/2437.cpp b/AcWing/2437/2437.cpp index 813c0a3e..aaa6b1a0 100644 --- a/AcWing/2437/2437.cpp +++ b/AcWing/2437/2437.cpp @@ -15,6 +15,7 @@ struct node { node() : l(0), r(0), s(0), v(0), d(false), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), d(false), k(rand()) {} } tr[N]; diff --git a/AcWing/247/247.cpp b/AcWing/247/247.cpp index c96fb37f..918f7f6c 100644 --- a/AcWing/247/247.cpp +++ b/AcWing/247/247.cpp @@ -11,6 +11,7 @@ struct segment { segment() : x(0), y1(0), y2(0), k(0) {} + segment(double _x, double _y1, double _y2, int _k) : x(_x), y1(_y1), y2(_y2), k(_k) {} @@ -25,6 +26,7 @@ struct node { node() : l(0), r(0), cnt(0), len(0) {} + node(int _l, int _r) : l(_l), r(_r), cnt(0), len(0) {} } tr[10005 << 3]; diff --git a/AcWing/253/253.cpp b/AcWing/253/253.cpp index 681418a1..fac60340 100644 --- a/AcWing/253/253.cpp +++ b/AcWing/253/253.cpp @@ -46,6 +46,7 @@ struct node { node() : l(0), r(0), s(0), v(0), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), k(rand()) {} } tr[N]; diff --git a/AcWing/2568/2568.cpp b/AcWing/2568/2568.cpp index 49ef499c..87f911f4 100644 --- a/AcWing/2568/2568.cpp +++ b/AcWing/2568/2568.cpp @@ -12,6 +12,7 @@ struct node { node() : l(0), r(0), s(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0) {} } tr[100005 << 2]; diff --git a/AcWing/3068/3068.cpp b/AcWing/3068/3068.cpp index 933babb9..5deffd3e 100644 --- a/AcWing/3068/3068.cpp +++ b/AcWing/3068/3068.cpp @@ -11,6 +11,7 @@ struct segment { segment() : x(0), y1(0), y2(0), k(0) {} + segment(int _x, int _y1, int _y2, int _k) : x(_x), y1(_y1), y2(_y2), k(_k) {} @@ -25,6 +26,7 @@ struct node { node() : l(0), r(0), cnt(0), len(0) {} + node(int _l, int _r) : l(_l), r(_r), cnt(0), len(0) {} } tr[100005 << 3]; diff --git a/AcWing/859/859.cpp b/AcWing/859/859.cpp index 1afa40fd..51a8f8dd 100644 --- a/AcWing/859/859.cpp +++ b/AcWing/859/859.cpp @@ -3,6 +3,7 @@ using namespace std; int n, m, fa[100005], res, cnt; + struct node { int u, v, w; diff --git a/AcWing/918/918.cpp b/AcWing/918/918.cpp index 7b37e2c3..62fcbd47 100644 --- a/AcWing/918/918.cpp +++ b/AcWing/918/918.cpp @@ -102,6 +102,7 @@ struct node { node() : l(0), r(0), s(0), d(-1) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(-1) {} } tr[N << 2]; diff --git a/BZOJ/2243/2243.cpp b/BZOJ/2243/2243.cpp index 7a1b6388..d088793b 100644 --- a/BZOJ/2243/2243.cpp +++ b/BZOJ/2243/2243.cpp @@ -105,6 +105,7 @@ struct node { node() : l(0), r(0), s(0), d(0), lc(0), rc(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} } tr[N << 2]; diff --git a/Codeforces/1661/D/D.cpp b/Codeforces/1661/D/D.cpp index f5aeaafe..91326cee 100644 --- a/Codeforces/1661/D/D.cpp +++ b/Codeforces/1661/D/D.cpp @@ -13,6 +13,7 @@ struct node { node() : l(0), r(0), s(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0) {} } tr[N << 2]; diff --git a/Codeforces/1679/B/B.cpp b/Codeforces/1679/B/B.cpp index 775ecaf1..cbd0c67f 100644 --- a/Codeforces/1679/B/B.cpp +++ b/Codeforces/1679/B/B.cpp @@ -9,6 +9,7 @@ struct node { node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/Gym/103081/I/I.cpp b/Gym/103081/I/I.cpp index 74e02dc4..e461456b 100644 --- a/Gym/103081/I/I.cpp +++ b/Gym/103081/I/I.cpp @@ -16,6 +16,7 @@ std::vector g[N]; // Shortest Path int dist[N], max; bool vis[N]; + void spfa() { memset(dist, 0x3f, sizeof(dist)); std::queue q; diff --git a/Gym/237040/F/F.cpp b/Gym/237040/F/F.cpp index 58724cf5..64dad6c0 100644 --- a/Gym/237040/F/F.cpp +++ b/Gym/237040/F/F.cpp @@ -9,6 +9,7 @@ struct node { node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/HDU/6080/6080.cpp b/HDU/6080/6080.cpp index 6a369f2b..6be067b1 100644 --- a/HDU/6080/6080.cpp +++ b/HDU/6080/6080.cpp @@ -8,10 +8,12 @@ struct node { int x, y; node() {} + node(int _x, int _y) { x = _x; y = _y; } + node operator-(node B) { return node(x - B.x, y - B.y); } diff --git a/LibreOJ/10127/10127.cpp b/LibreOJ/10127/10127.cpp index a3b402cd..49e38606 100644 --- a/LibreOJ/10127/10127.cpp +++ b/LibreOJ/10127/10127.cpp @@ -9,12 +9,14 @@ struct node { l = r = 0; v = -0x3f3f3f3f; } + node(int _l, int _r) { l = _l; r = _r; v = -0x3f3f3f3f; } } tr[200005 << 2]; + int m, p; char op; diff --git a/LibreOJ/10128/10128.cpp b/LibreOJ/10128/10128.cpp index 12af3fe7..5f303c6a 100644 --- a/LibreOJ/10128/10128.cpp +++ b/LibreOJ/10128/10128.cpp @@ -15,6 +15,7 @@ struct node { l = r = s = 0; allIsOne = false; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/LibreOJ/10129/10129.cpp b/LibreOJ/10129/10129.cpp index 380d9812..87fc3239 100644 --- a/LibreOJ/10129/10129.cpp +++ b/LibreOJ/10129/10129.cpp @@ -10,12 +10,14 @@ struct node { l = r = s = d = 0; x = 1; } + node(int _l, int _r) { l = _l, r = _r; s = d = 0; x = 1; } } tr[100005 << 2]; + int n, m, p, op, x, y; long long k, a[100005]; diff --git a/LibreOJ/10138/10138.cpp b/LibreOJ/10138/10138.cpp index 5408eaf1..f95a3af5 100644 --- a/LibreOJ/10138/10138.cpp +++ b/LibreOJ/10138/10138.cpp @@ -107,6 +107,7 @@ struct node { node() : l(0), r(0), sum(0), max(numeric_limits::min()) {} + node(int _l, int _r) : l(_l), r(_r), sum(0), max(numeric_limits::min()) {} } tr[N << 2]; diff --git a/LibreOJ/10141/10141.cpp b/LibreOJ/10141/10141.cpp index cf569c96..8f1716f3 100644 --- a/LibreOJ/10141/10141.cpp +++ b/LibreOJ/10141/10141.cpp @@ -105,6 +105,7 @@ struct node { node() : l(0), r(0), s(0), d(0), lc(0), rc(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} } tr[N << 2]; diff --git a/LibreOJ/102/102.cpp b/LibreOJ/102/102.cpp index 200f0e47..5635452e 100644 --- a/LibreOJ/102/102.cpp +++ b/LibreOJ/102/102.cpp @@ -16,6 +16,7 @@ int n, m, s, t, flow, cost; // Graph int idx, head[N], ver[M << 1], next[M << 1]; std::pair edge[M << 1]; + // void add(int u, int v, int c, int w) { diff --git a/LibreOJ/104/104.cpp b/LibreOJ/104/104.cpp index 9e2a0177..9774df49 100644 --- a/LibreOJ/104/104.cpp +++ b/LibreOJ/104/104.cpp @@ -15,6 +15,7 @@ class Treap { node() : left(nullptr), right(nullptr), size(1), val(0), key(rand()) {} + node(int _val) : left(nullptr), right(nullptr), size(1), val(_val), key(rand()) {} diff --git a/LibreOJ/105/105.cpp b/LibreOJ/105/105.cpp index 813c0a3e..aaa6b1a0 100644 --- a/LibreOJ/105/105.cpp +++ b/LibreOJ/105/105.cpp @@ -15,6 +15,7 @@ struct node { node() : l(0), r(0), s(0), v(0), d(false), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), d(false), k(rand()) {} } tr[N]; diff --git a/LibreOJ/123/123.cpp b/LibreOJ/123/123.cpp index 6fb9ff9b..5c2e6f7c 100644 --- a/LibreOJ/123/123.cpp +++ b/LibreOJ/123/123.cpp @@ -6,6 +6,7 @@ using std::endl; int n, m, fa[500005]; long long ans; + struct node { int u, v, w; diff --git a/LibreOJ/131/131.cpp b/LibreOJ/131/131.cpp index 2ecb0cbb..a90f40b3 100644 --- a/LibreOJ/131/131.cpp +++ b/LibreOJ/131/131.cpp @@ -11,12 +11,14 @@ struct node { node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; s = d = 0; } } tr[1000005 << 2]; + int n, m, op, x, y, k; long long a[1000005]; diff --git a/LibreOJ/132/132.cpp b/LibreOJ/132/132.cpp index fe854d70..e11334d6 100644 --- a/LibreOJ/132/132.cpp +++ b/LibreOJ/132/132.cpp @@ -11,6 +11,7 @@ struct node { node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/LibreOJ/2054/2054.cpp b/LibreOJ/2054/2054.cpp index 77fe4ce2..1aa8b0b3 100644 --- a/LibreOJ/2054/2054.cpp +++ b/LibreOJ/2054/2054.cpp @@ -94,6 +94,7 @@ struct node { node() : l(0), r(0), d(-1) {} + node(int _l, int _r) : l(_l), r(_r), d(-1) {} } tr[N << 2]; diff --git a/LibreOJ/2125/2125.cpp b/LibreOJ/2125/2125.cpp index 1db47bf3..2d4e41b5 100644 --- a/LibreOJ/2125/2125.cpp +++ b/LibreOJ/2125/2125.cpp @@ -114,6 +114,7 @@ struct node { node() : l(0), r(0), s(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0) {} } tr[N << 2]; diff --git a/LibreOJ/2130/2130.cpp b/LibreOJ/2130/2130.cpp index 7b37e2c3..62fcbd47 100644 --- a/LibreOJ/2130/2130.cpp +++ b/LibreOJ/2130/2130.cpp @@ -102,6 +102,7 @@ struct node { node() : l(0), r(0), s(0), d(-1) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(-1) {} } tr[N << 2]; diff --git a/LibreOJ/2279/2279.cpp b/LibreOJ/2279/2279.cpp index 900488b1..6b4b3b14 100644 --- a/LibreOJ/2279/2279.cpp +++ b/LibreOJ/2279/2279.cpp @@ -7,6 +7,7 @@ struct node { node() : l(0), r(0), max(0) {} + node(int _l, int _r) : l(_l), r(_r), max(0) {} } tr[50005 << 2]; diff --git a/LibreOJ/2606/2606.cpp b/LibreOJ/2606/2606.cpp index 35cd0a9a..3a22f44a 100644 --- a/LibreOJ/2606/2606.cpp +++ b/LibreOJ/2606/2606.cpp @@ -40,6 +40,7 @@ struct node { node() : l(0), r(0), m(std::numeric_limits::max()), d(0) {} + node(int _l, int _r) : l(_l), r(_r), m(std::numeric_limits::max()), d(0) {} } tr[1000005 << 1]; diff --git a/LibreOJ/2633/2633.cpp b/LibreOJ/2633/2633.cpp index 5a64ffb7..50d4ceb3 100644 --- a/LibreOJ/2633/2633.cpp +++ b/LibreOJ/2633/2633.cpp @@ -14,12 +14,16 @@ struct node { node() : x(0), y(0), step(0) {} + node(int _x, int _y) : x(_x), y(_y), step(0) {} + node(pair _point) : x(_point.first), y(_point.second), step(0) {} + node(pair _point, int _step) : x(_point.first), y(_point.second), step(_step) {} + node(int _x, int _y, int _step) : x(_x), y(_y), step(_step) {} }; diff --git a/LibreOJ/2759/2759.cpp b/LibreOJ/2759/2759.cpp index 514fc19e..6f4f43e8 100644 --- a/LibreOJ/2759/2759.cpp +++ b/LibreOJ/2759/2759.cpp @@ -15,6 +15,7 @@ std::vector> g[N]; // Dijkstra - Shortest Path long long dist[N]; bool vis[N]; + void dijkstra() { memset(dist, 0x3f, sizeof(dist)); dist[1] = 0; diff --git a/LibreOJ/4/4.cpp b/LibreOJ/4/4.cpp index 37bbb8f7..563dcee1 100644 --- a/LibreOJ/4/4.cpp +++ b/LibreOJ/4/4.cpp @@ -1,3 +1,6 @@ -#include -char s[]="#include%cchar%cs[]=%c%s%c%c%cint main(){printf(s,10,32,34,s,34,59,10);}"; -int main(){printf(s,10,32,34,s,34,59,10);} \ No newline at end of file +#include +char s[] = "#include%cchar%cs[]=%c%s%c%c%cint main(){printf(s,10,32,34,s,34,59,10);}"; + +int main() { + printf(s, 10, 32, 34, s, 34, 59, 10); +} \ No newline at end of file diff --git a/LibreOJ/6013/6013.cpp b/LibreOJ/6013/6013.cpp index e0474526..ee06c03f 100644 --- a/LibreOJ/6013/6013.cpp +++ b/LibreOJ/6013/6013.cpp @@ -15,6 +15,7 @@ int n, s, t, a[N], sum, avg, cost; // Graph int idx, head[N], ver[M << 1], next[M << 1]; std::pair edge[M << 1]; + // void add(int u, int v, int flow, int cost) { diff --git a/Luogu/CF383C/CF383C.cpp b/Luogu/CF383C/CF383C.cpp index 8909b488..6c97e2e6 100644 --- a/Luogu/CF383C/CF383C.cpp +++ b/Luogu/CF383C/CF383C.cpp @@ -85,6 +85,7 @@ struct node { node() : l(0), r(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), d(0) {} } tr[N << 2]; diff --git a/Luogu/CF438D/CF438D.cpp b/Luogu/CF438D/CF438D.cpp index 408b002a..01f5d3cc 100644 --- a/Luogu/CF438D/CF438D.cpp +++ b/Luogu/CF438D/CF438D.cpp @@ -42,6 +42,7 @@ struct node { node() : l(0), r(0), s(0), m(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), m(0) {} } tr[100005 << 2]; diff --git a/Luogu/CF920F/CF920F.cpp b/Luogu/CF920F/CF920F.cpp index 8e3d82ee..5e64717e 100644 --- a/Luogu/CF920F/CF920F.cpp +++ b/Luogu/CF920F/CF920F.cpp @@ -65,6 +65,7 @@ struct node { node() : l(0), r(0), s(0), m(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), m(0) {} } tr[300005 << 2]; diff --git a/Luogu/P1000/P1000.c b/Luogu/P1000/P1000.c index 89a81b69..64c78e74 100644 --- a/Luogu/P1000/P1000.c +++ b/Luogu/P1000/P1000.c @@ -1,29 +1,29 @@ // R14715360 -#include +#include + int main() { printf( - " ********\n" - " ************\n" - " ####....#.\n" - " #..###.....##....\n" - " ###.......###### ### ###\n" - " ........... #...# #...#\n" - " ##*####### #.#.# #.#.#\n" - " ####*******###### #.#.# #.#.#\n" - " ...#***.****.*###.... #...# #...#\n" - " ....**********##..... ### ###\n" - " ....**** *****....\n" - " #### ####\n" - " ###### ######\n" - "##############################################################\n" - "#...#......#.##...#......#.##...#......#.##------------------#\n" - "###########################################------------------#\n" - "#..#....#....##..#....#....##..#....#....#####################\n" - "########################################## #----------#\n" - "#.....#......##.....#......##.....#......# #----------#\n" - "########################################## #----------#\n" - "#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n" - "########################################## ############\n" - ); + " ********\n" + " ************\n" + " ####....#.\n" + " #..###.....##....\n" + " ###.......###### ### ###\n" + " ........... #...# #...#\n" + " ##*####### #.#.# #.#.#\n" + " ####*******###### #.#.# #.#.#\n" + " ...#***.****.*###.... #...# #...#\n" + " ....**********##..... ### ###\n" + " ....**** *****....\n" + " #### ####\n" + " ###### ######\n" + "##############################################################\n" + "#...#......#.##...#......#.##...#......#.##------------------#\n" + "###########################################------------------#\n" + "#..#....#....##..#....#....##..#....#....#####################\n" + "########################################## #----------#\n" + "#.....#......##.....#......##.....#......# #----------#\n" + "########################################## #----------#\n" + "#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n" + "########################################## ############\n"); return 0; } \ No newline at end of file diff --git a/Luogu/P1068/P1068.cpp b/Luogu/P1068/P1068.cpp index 1a5914cb..e220d1cb 100644 --- a/Luogu/P1068/P1068.cpp +++ b/Luogu/P1068/P1068.cpp @@ -5,6 +5,7 @@ using namespace std; int n, m, ans; + struct node { int k, s; } a[100001]; diff --git a/Luogu/P1083/P1083.cpp b/Luogu/P1083/P1083.cpp index 35cd0a9a..3a22f44a 100644 --- a/Luogu/P1083/P1083.cpp +++ b/Luogu/P1083/P1083.cpp @@ -40,6 +40,7 @@ struct node { node() : l(0), r(0), m(std::numeric_limits::max()), d(0) {} + node(int _l, int _r) : l(_l), r(_r), m(std::numeric_limits::max()), d(0) {} } tr[1000005 << 1]; diff --git a/Luogu/P1093/P1093.cpp b/Luogu/P1093/P1093.cpp index aa0fcf2d..c94e9e8e 100644 --- a/Luogu/P1093/P1093.cpp +++ b/Luogu/P1093/P1093.cpp @@ -8,6 +8,7 @@ struct node { node() { id = chinese = math = english = all = 0; } + node(int _id, int _chinese, int _math, int _english) { id = _id; chinese = _chinese; diff --git a/Luogu/P1105/P1105.cpp b/Luogu/P1105/P1105.cpp index 7f3f6eac..a7b2dee5 100644 --- a/Luogu/P1105/P1105.cpp +++ b/Luogu/P1105/P1105.cpp @@ -6,6 +6,7 @@ int n, ans[20005]; struct node { int id, h, l, r; + struct { int l, r; } ans; diff --git a/Luogu/P1182/P1182.cpp b/Luogu/P1182/P1182.cpp index 61790707..7c3706bd 100644 --- a/Luogu/P1182/P1182.cpp +++ b/Luogu/P1182/P1182.cpp @@ -16,6 +16,7 @@ bool check(int x) { } return num >= m; } + int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { diff --git a/Luogu/P1206/P1206.cpp b/Luogu/P1206/P1206.cpp index 4a0e060e..eb3258f1 100644 --- a/Luogu/P1206/P1206.cpp +++ b/Luogu/P1206/P1206.cpp @@ -10,6 +10,7 @@ class node { } return x - 10 + 'A'; } + int len; int nums[20]; @@ -17,6 +18,7 @@ class node { node() { len = 0; } + node(int x, int b) { len = 0; while (x) { @@ -37,6 +39,7 @@ class node { } return s; } + bool check() { for (int i = 0; i < len; i++) { if (nums[i] != nums[len - i - 1]) { diff --git a/Luogu/P1383/P1383.cpp b/Luogu/P1383/P1383.cpp index 47defef3..e7a47270 100644 --- a/Luogu/P1383/P1383.cpp +++ b/Luogu/P1383/P1383.cpp @@ -47,6 +47,7 @@ struct node { node() : l(0), r(0), s(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0) {} } tr[N << 5]; diff --git a/Luogu/P1440/P1440.cpp b/Luogu/P1440/P1440.cpp index d446342e..38b6e8c6 100644 --- a/Luogu/P1440/P1440.cpp +++ b/Luogu/P1440/P1440.cpp @@ -11,6 +11,7 @@ struct node { l = r = 0; min = 0x3f3f3f3f; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/Luogu/P1471/P1471.cpp b/Luogu/P1471/P1471.cpp index 29758deb..77a17365 100644 --- a/Luogu/P1471/P1471.cpp +++ b/Luogu/P1471/P1471.cpp @@ -10,12 +10,14 @@ struct node { l = r = 0; s = s2 = d = 0.00; } + node(int _l, int _r) { l = _l; r = _r; s = s2 = d = 0.00; } } tr[100005 << 2]; + int n, m, op, x, y; double k, a[100005]; diff --git a/Luogu/P1486/P1486.cpp b/Luogu/P1486/P1486.cpp index 561283f3..dc092b28 100644 --- a/Luogu/P1486/P1486.cpp +++ b/Luogu/P1486/P1486.cpp @@ -19,6 +19,7 @@ struct node { node() : l(0), r(0), s(0), v(0), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), k(rand()) {} } tr[N]; diff --git a/Luogu/P1531/P1531.cpp b/Luogu/P1531/P1531.cpp index 9ddf61ea..657d8c4d 100644 --- a/Luogu/P1531/P1531.cpp +++ b/Luogu/P1531/P1531.cpp @@ -10,12 +10,14 @@ struct node { l = r = 0; max = -0x3f3f3f3f; } + node(int _l, int _r) { l = _l; r = _r; max = -0x3f3f3f3f; } } tr[200005 << 2]; + int n, m, x, y, a[200005]; char op; diff --git a/Luogu/P1765/P1765.cpp b/Luogu/P1765/P1765.cpp index 376e2479..9503d224 100644 --- a/Luogu/P1765/P1765.cpp +++ b/Luogu/P1765/P1765.cpp @@ -5,6 +5,7 @@ using namespace std; int num[26] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4}; + // a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v. w, x, y, z int main() { char c; diff --git a/Luogu/P1789/P1789.cpp b/Luogu/P1789/P1789.cpp index caaa85e9..741a1c8e 100644 --- a/Luogu/P1789/P1789.cpp +++ b/Luogu/P1789/P1789.cpp @@ -8,6 +8,7 @@ int dx2[25] = {-2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2}; int dy2[25] = {-2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2}; + int main() { cin >> n >> m >> k; int a[n + 5][n + 5]; diff --git a/Luogu/P1801/P1801.cpp b/Luogu/P1801/P1801.cpp index 78c9d71c..fc862cc9 100644 --- a/Luogu/P1801/P1801.cpp +++ b/Luogu/P1801/P1801.cpp @@ -40,6 +40,7 @@ struct node { node() : l(0), r(0), s(0), v(0), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), k(rand()) {} } tr[N]; diff --git a/Luogu/P1816/P1816.cpp b/Luogu/P1816/P1816.cpp index 0d8557b5..50998d67 100644 --- a/Luogu/P1816/P1816.cpp +++ b/Luogu/P1816/P1816.cpp @@ -10,12 +10,14 @@ struct node { l = r = 0; min = 0x3f3f3f3f; } + node(int _l, int _r) { l = _l; r = _r; min = 0x3f3f3f3f; } } tr[100005 << 2]; + int n, m, x, y, a[100005]; void pushup(int u) { diff --git a/Luogu/P1947/P1947.cpp b/Luogu/P1947/P1947.cpp index c1c847a1..0e305581 100644 --- a/Luogu/P1947/P1947.cpp +++ b/Luogu/P1947/P1947.cpp @@ -1,4 +1,5 @@ extern "C" int Seniorious(int); + extern "C" int Chtholly(int n, int OvO) { int ans = 1; int l = 1, r = n; diff --git a/Luogu/P2003/P2003.cpp b/Luogu/P2003/P2003.cpp index 2363bca2..087b8062 100644 --- a/Luogu/P2003/P2003.cpp +++ b/Luogu/P2003/P2003.cpp @@ -8,6 +8,7 @@ struct node { node() { x1 = x2 = 0; } + node(int _x1, int _x2, int _y) { x1 = _x1; x2 = _x2; diff --git a/Luogu/P2023/P2023.cpp b/Luogu/P2023/P2023.cpp index bff9a5bf..e383a8ce 100644 --- a/Luogu/P2023/P2023.cpp +++ b/Luogu/P2023/P2023.cpp @@ -10,12 +10,14 @@ struct node { l = r = s = d = 0; x = 1; } + node(int _l, int _r) { l = _l, r = _r; s = d = 0; x = 1; } } tr[100005 << 2]; + int n, m, p, op, x, y; long long k, a[100005]; diff --git a/Luogu/P2036/P2036.cpp b/Luogu/P2036/P2036.cpp index eb8505ff..43345329 100644 --- a/Luogu/P2036/P2036.cpp +++ b/Luogu/P2036/P2036.cpp @@ -5,6 +5,7 @@ using namespace std; struct { int s, b; } a[15]; + int n, ans = 0x3f3f3f3f; void dfs(int now, int s, int b) { diff --git a/Luogu/P2045/P2045.cpp b/Luogu/P2045/P2045.cpp index 1abb7d44..2b488bbf 100644 --- a/Luogu/P2045/P2045.cpp +++ b/Luogu/P2045/P2045.cpp @@ -15,6 +15,7 @@ int n, k, s, t, ans; // Graph int idx, head[N], ver[M << 1], next[M << 1]; std::pair edge[M << 1]; + // void add(int u, int v, int flow, int cost) { diff --git a/Luogu/P2068/P2068.cpp b/Luogu/P2068/P2068.cpp index b87d40f2..edcfd1e2 100644 --- a/Luogu/P2068/P2068.cpp +++ b/Luogu/P2068/P2068.cpp @@ -10,12 +10,14 @@ struct node { l = r = 0; s = 0; } + node(int _l, int _r) { l = _l; r = _r; s = 0; } } tr[1000005 << 2]; + long long n, w, a, b; char op; diff --git a/Luogu/P2073/P2073.cpp b/Luogu/P2073/P2073.cpp index 0332e5ff..747fec7a 100644 --- a/Luogu/P2073/P2073.cpp +++ b/Luogu/P2073/P2073.cpp @@ -9,6 +9,7 @@ struct node { w = 0; c = 0; } + node(long long _w, long long _c) { w = _w; c = _c; diff --git a/Luogu/P2146/P2146.cpp b/Luogu/P2146/P2146.cpp index 7b37e2c3..62fcbd47 100644 --- a/Luogu/P2146/P2146.cpp +++ b/Luogu/P2146/P2146.cpp @@ -102,6 +102,7 @@ struct node { node() : l(0), r(0), s(0), d(-1) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(-1) {} } tr[N << 2]; diff --git a/Luogu/P2153/P2153.cpp b/Luogu/P2153/P2153.cpp index 27f447ca..c636aa8c 100644 --- a/Luogu/P2153/P2153.cpp +++ b/Luogu/P2153/P2153.cpp @@ -15,6 +15,7 @@ int n, m, s, t, flow, cost; // Graph int idx, head[N], ver[M << 1], next[M << 1]; std::pair edge[M << 1]; + // void add(int u, int v, int flow, int cost) { diff --git a/Luogu/P2251/P2251.cpp b/Luogu/P2251/P2251.cpp index fdae4544..c38b2135 100644 --- a/Luogu/P2251/P2251.cpp +++ b/Luogu/P2251/P2251.cpp @@ -11,6 +11,7 @@ struct node { l = r = 0; min = 0x3f3f3f3f; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/Luogu/P2343/P2343.cpp b/Luogu/P2343/P2343.cpp index 20ab2d4b..8d80601d 100644 --- a/Luogu/P2343/P2343.cpp +++ b/Luogu/P2343/P2343.cpp @@ -39,6 +39,7 @@ struct node { node() : l(0), r(0), s(0), v(0), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), k(rand()) {} } tr[N]; diff --git a/Luogu/P2357/P2357.cpp b/Luogu/P2357/P2357.cpp index cd7a7ec2..eec75293 100644 --- a/Luogu/P2357/P2357.cpp +++ b/Luogu/P2357/P2357.cpp @@ -11,6 +11,7 @@ struct node { s = 0; d = 0; } + node(int _l, int _r) { l = _l; r = _r; @@ -18,6 +19,7 @@ struct node { d = 0; } } tr[200005 << 3]; + int n, f, op, x, y, k, a[200005]; void pushup(int u) { diff --git a/Luogu/P2412/P2412.cpp b/Luogu/P2412/P2412.cpp index a28fe02a..fab57d06 100644 --- a/Luogu/P2412/P2412.cpp +++ b/Luogu/P2412/P2412.cpp @@ -10,12 +10,14 @@ struct node { l = r = 0; s = ""; } + node(int _l, int _r) { l = _l; r = _r; s = ""; } } tr[50005 << 2]; + int n, m, x, y; string a[50005], b[50005]; map m1; diff --git a/Luogu/P2471/P2471.cpp b/Luogu/P2471/P2471.cpp index 748bd770..21c89765 100644 --- a/Luogu/P2471/P2471.cpp +++ b/Luogu/P2471/P2471.cpp @@ -8,6 +8,7 @@ struct node { node() { l = r = max = 0; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/Luogu/P2486/P2486.cpp b/Luogu/P2486/P2486.cpp index cf569c96..8f1716f3 100644 --- a/Luogu/P2486/P2486.cpp +++ b/Luogu/P2486/P2486.cpp @@ -105,6 +105,7 @@ struct node { node() : l(0), r(0), s(0), d(0), lc(0), rc(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} } tr[N << 2]; diff --git a/Luogu/P2502/P2502.cpp b/Luogu/P2502/P2502.cpp index be15f072..23663248 100644 --- a/Luogu/P2502/P2502.cpp +++ b/Luogu/P2502/P2502.cpp @@ -16,6 +16,7 @@ struct data { data() { a = b = 0; } + data(int _a, int _b) { int g = __gcd(_a, _b); a = _a / g; @@ -25,9 +26,11 @@ struct data { bool operator<(const data& x) const { return a * x.b < b * x.a; } + bool operator>(const data& x) const { return a * x.b > b * x.a; } + bool operator==(const data& x) const { return a * x.b == b * x.a; } diff --git a/Luogu/P2574/P2574.cpp b/Luogu/P2574/P2574.cpp index 29bd4c13..4c06ecfb 100644 --- a/Luogu/P2574/P2574.cpp +++ b/Luogu/P2574/P2574.cpp @@ -5,15 +5,18 @@ using namespace std; struct node { int l, r; int s, d; + node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; s = d = 0; } } tr[200005 << 2]; + int n, m, op, x, y, a[200005]; void pushup(int u) { diff --git a/Luogu/P2590/P2590.cpp b/Luogu/P2590/P2590.cpp index 5408eaf1..f95a3af5 100644 --- a/Luogu/P2590/P2590.cpp +++ b/Luogu/P2590/P2590.cpp @@ -107,6 +107,7 @@ struct node { node() : l(0), r(0), sum(0), max(numeric_limits::min()) {} + node(int _l, int _r) : l(_l), r(_r), sum(0), max(numeric_limits::min()) {} } tr[N << 2]; diff --git a/Luogu/P2846/P2846.cpp b/Luogu/P2846/P2846.cpp index e1c18864..ae8d000b 100644 --- a/Luogu/P2846/P2846.cpp +++ b/Luogu/P2846/P2846.cpp @@ -8,12 +8,14 @@ struct node { node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; s = d = 0; } } tr[100005 << 2]; + int n, m, op, s, e; void pushup(int u) { diff --git a/Luogu/P2880/P2880.cpp b/Luogu/P2880/P2880.cpp index b8de6684..5221e13b 100644 --- a/Luogu/P2880/P2880.cpp +++ b/Luogu/P2880/P2880.cpp @@ -9,6 +9,7 @@ struct node { l = r = max = 0; min = 0x3f3f3f3f; } + node(int _l, int _r) { l = _l; r = _r; @@ -16,6 +17,7 @@ struct node { min = 0x3f3f3f3f; } } tr[50005 << 2]; + int n, q, a, b, h[50005]; void pushup(int u) { diff --git a/Luogu/P2895/P2895.cpp b/Luogu/P2895/P2895.cpp index 16a2445d..feaa80ca 100644 --- a/Luogu/P2895/P2895.cpp +++ b/Luogu/P2895/P2895.cpp @@ -11,6 +11,7 @@ struct node { node() { x = y = t = 0; } + node(int _x, int _y, int _t) { x = _x, y = _y, t = _t; } diff --git a/Luogu/P3063/P3063.cpp b/Luogu/P3063/P3063.cpp index e281566a..89f8edb6 100644 --- a/Luogu/P3063/P3063.cpp +++ b/Luogu/P3063/P3063.cpp @@ -6,6 +6,7 @@ struct node { int v, l, c; node() {} + node(int _v, int _l, int _c) : v(_v), l(_l), c(_c) {} }; diff --git a/Luogu/P3178/P3178.cpp b/Luogu/P3178/P3178.cpp index 1db47bf3..2d4e41b5 100644 --- a/Luogu/P3178/P3178.cpp +++ b/Luogu/P3178/P3178.cpp @@ -114,6 +114,7 @@ struct node { node() : l(0), r(0), s(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0) {} } tr[N << 2]; diff --git a/Luogu/P3353/P3353.cpp b/Luogu/P3353/P3353.cpp index 81405ce7..47866a49 100644 --- a/Luogu/P3353/P3353.cpp +++ b/Luogu/P3353/P3353.cpp @@ -8,12 +8,14 @@ struct node { node() { l = r = s = 0; } + node(int _l, int _r) { l = _l; r = _r; s = 0; } } tr[1000005 << 2]; + int n, w, x, b, ans; void pushup(int u) { diff --git a/Luogu/P3366/P3366.cpp b/Luogu/P3366/P3366.cpp index f1760400..b65c73ba 100644 --- a/Luogu/P3366/P3366.cpp +++ b/Luogu/P3366/P3366.cpp @@ -3,6 +3,7 @@ using namespace std; int n, m, fa[5005], res, cnt; + struct node { int u, v, w; diff --git a/Luogu/P3368/P3368.cpp b/Luogu/P3368/P3368.cpp index 03e77734..e1c6979a 100644 --- a/Luogu/P3368/P3368.cpp +++ b/Luogu/P3368/P3368.cpp @@ -12,6 +12,7 @@ struct node { d = 0; s = 0; } + node(int _l, int _r) { l = _l; r = _r; @@ -19,6 +20,7 @@ struct node { d = 0; } } tr[500005 << 2]; + int n, m, op, x, y, k, a[500005]; void pushup(int u) { diff --git a/Luogu/P3372/P3372.cpp b/Luogu/P3372/P3372.cpp index a48d2091..2d45299a 100644 --- a/Luogu/P3372/P3372.cpp +++ b/Luogu/P3372/P3372.cpp @@ -12,12 +12,14 @@ struct node { node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; s = d = 0; } } tr[100005 << 2]; + int n, m, op, x, y, k, a[100005]; /** diff --git a/Luogu/P3373/P3373.cpp b/Luogu/P3373/P3373.cpp index 37ff1279..121cb075 100644 --- a/Luogu/P3373/P3373.cpp +++ b/Luogu/P3373/P3373.cpp @@ -10,12 +10,14 @@ struct node { l = r = s = d = 0; x = 1; } + node(int _l, int _r) { l = _l, r = _r; s = d = 0; x = 1; } } tr[100005 << 2]; + int n, m, p, op, x, y; long long k, a[100005]; @@ -90,10 +92,10 @@ void modify(int u, int l, int r, long long x, long long d) { /** * @brief 求区间和 - * @param u - * @param l - * @param r - * @return int + * @param u + * @param l + * @param r + * @return int */ long long query(int u, int l, int r) { if (tr[u].l >= l && tr[u].r <= r) { // 被包含直接返回 diff --git a/Luogu/P3381/P3381.cpp b/Luogu/P3381/P3381.cpp index 7da9af62..215ffcc7 100644 --- a/Luogu/P3381/P3381.cpp +++ b/Luogu/P3381/P3381.cpp @@ -16,6 +16,7 @@ int n, m, s, t, flow, cost; // Graph int idx, head[N], ver[M << 1], next[M << 1]; std::pair edge[M << 1]; + // < c, w> void add(int u, int v, int c, int w) { diff --git a/Luogu/P3384/P3384.cpp b/Luogu/P3384/P3384.cpp index 6858b245..ddb85c82 100644 --- a/Luogu/P3384/P3384.cpp +++ b/Luogu/P3384/P3384.cpp @@ -65,6 +65,7 @@ struct node { node() : l(0), r(0), s(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0) {} } tr[N << 2]; diff --git a/Luogu/P3385/P3385.cpp b/Luogu/P3385/P3385.cpp index 617b23e8..e461a674 100644 --- a/Luogu/P3385/P3385.cpp +++ b/Luogu/P3385/P3385.cpp @@ -11,6 +11,7 @@ struct node { node() { u = v = w = 0; } + node(int _u, int _v, int _w) { u = _u; v = _v; diff --git a/Luogu/P3387/P3387.cpp b/Luogu/P3387/P3387.cpp index 8020edfe..962b96a8 100644 --- a/Luogu/P3387/P3387.cpp +++ b/Luogu/P3387/P3387.cpp @@ -48,6 +48,7 @@ void tarjan(int u) { // Shortest Path int dist[N]; + int spfa(int s) { memset(dist, -0x3f, sizeof(dist)); std::queue q; diff --git a/Luogu/P3391/P3391.cpp b/Luogu/P3391/P3391.cpp index 813c0a3e..aaa6b1a0 100644 --- a/Luogu/P3391/P3391.cpp +++ b/Luogu/P3391/P3391.cpp @@ -15,6 +15,7 @@ struct node { node() : l(0), r(0), s(0), v(0), d(false), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), d(false), k(rand()) {} } tr[N]; diff --git a/Luogu/P3833/P3833.cpp b/Luogu/P3833/P3833.cpp index 0378b0ba..632deff9 100644 --- a/Luogu/P3833/P3833.cpp +++ b/Luogu/P3833/P3833.cpp @@ -95,6 +95,7 @@ struct node { node() : l(0), r(0), s(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), d(0) {} } tr[N << 2]; diff --git a/Luogu/P3870/P3870.cpp b/Luogu/P3870/P3870.cpp index a93bdbbf..1b74f870 100644 --- a/Luogu/P3870/P3870.cpp +++ b/Luogu/P3870/P3870.cpp @@ -15,6 +15,7 @@ struct node { s = d = 0; } } tr[100005 << 2]; + int n, m, op, a, b; void pushup(int u) { diff --git a/Luogu/P4016/P4016.cpp b/Luogu/P4016/P4016.cpp index e0474526..ee06c03f 100644 --- a/Luogu/P4016/P4016.cpp +++ b/Luogu/P4016/P4016.cpp @@ -15,6 +15,7 @@ int n, s, t, a[N], sum, avg, cost; // Graph int idx, head[N], ver[M << 1], next[M << 1]; std::pair edge[M << 1]; + // void add(int u, int v, int flow, int cost) { diff --git a/Luogu/P4092/P4092.cpp b/Luogu/P4092/P4092.cpp index 77fe4ce2..1aa8b0b3 100644 --- a/Luogu/P4092/P4092.cpp +++ b/Luogu/P4092/P4092.cpp @@ -94,6 +94,7 @@ struct node { node() : l(0), r(0), d(-1) {} + node(int _l, int _r) : l(_l), r(_r), d(-1) {} } tr[N << 2]; diff --git a/Luogu/P4114/P4114.cpp b/Luogu/P4114/P4114.cpp index d9e70d61..98ebb18a 100644 --- a/Luogu/P4114/P4114.cpp +++ b/Luogu/P4114/P4114.cpp @@ -96,6 +96,7 @@ struct node { node() : l(0), r(0), m(0) {} + node(int _l, int _r) : l(_l), r(_r), m(0) {} } tr[N << 2]; diff --git a/Luogu/P4145/P4145.cpp b/Luogu/P4145/P4145.cpp index 136ce3f0..fd1f7307 100644 --- a/Luogu/P4145/P4145.cpp +++ b/Luogu/P4145/P4145.cpp @@ -14,6 +14,7 @@ struct node { l = r = s = 0; allIsOne = false; } + node(int _l, int _r) { l = _l; r = _r; diff --git a/Luogu/P4315/P4315.cpp b/Luogu/P4315/P4315.cpp index 6b864281..6a107160 100644 --- a/Luogu/P4315/P4315.cpp +++ b/Luogu/P4315/P4315.cpp @@ -126,6 +126,7 @@ struct node { node() : l(0), r(0), m(0), da(0), dc(-1) {} + node(int _l, int _r) : l(_l), r(_r), m(0), da(0), dc(-1) {} } tr[N << 2]; diff --git a/Luogu/P4588/P4588.cpp b/Luogu/P4588/P4588.cpp index 404df876..6eb619e1 100644 --- a/Luogu/P4588/P4588.cpp +++ b/Luogu/P4588/P4588.cpp @@ -10,12 +10,14 @@ struct node { l = r = 0; s = 0; } + node(int _l, int _r) { l = _l; r = _r; s = 0; } } tr[100005 << 2]; + int t, q, mod, op, m; void pushup(int u) { diff --git a/Luogu/P4668/P4668.cpp b/Luogu/P4668/P4668.cpp index 5a64ffb7..50d4ceb3 100644 --- a/Luogu/P4668/P4668.cpp +++ b/Luogu/P4668/P4668.cpp @@ -14,12 +14,16 @@ struct node { node() : x(0), y(0), step(0) {} + node(int _x, int _y) : x(_x), y(_y), step(0) {} + node(pair _point) : x(_point.first), y(_point.second), step(0) {} + node(pair _point, int _step) : x(_point.first), y(_point.second), step(_step) {} + node(int _x, int _y, int _step) : x(_x), y(_y), step(_step) {} }; diff --git a/Luogu/P5057/P5057.cpp b/Luogu/P5057/P5057.cpp index fc2319fe..93d00ac0 100644 --- a/Luogu/P5057/P5057.cpp +++ b/Luogu/P5057/P5057.cpp @@ -9,12 +9,14 @@ struct node { l = r = 0; v = d = 0; } + node(int _l, int _r) { l = _l; r = _r; v = d = 0; } } tr[100005 << 2]; + int n, m, t, x, y; void build(int u, int l, int r) { diff --git a/Luogu/P5097/P5097.cpp b/Luogu/P5097/P5097.cpp index e915cb7c..c2ab29f2 100644 --- a/Luogu/P5097/P5097.cpp +++ b/Luogu/P5097/P5097.cpp @@ -9,12 +9,14 @@ struct node { l = r = 0; min = 0x3f3f3f3f; } + node(int _l, int _r) { l = _l; r = _r; min = 0x3f3f3f3f; } } tr[25005 << 2]; + int n, q, x, y, a[25005]; void pushup(int u) { diff --git a/Luogu/P5490/P5490.cpp b/Luogu/P5490/P5490.cpp index 933babb9..5deffd3e 100644 --- a/Luogu/P5490/P5490.cpp +++ b/Luogu/P5490/P5490.cpp @@ -11,6 +11,7 @@ struct segment { segment() : x(0), y1(0), y2(0), k(0) {} + segment(int _x, int _y1, int _y2, int _k) : x(_x), y1(_y1), y2(_y2), k(_k) {} @@ -25,6 +26,7 @@ struct node { node() : l(0), r(0), cnt(0), len(0) {} + node(int _l, int _r) : l(_l), r(_r), cnt(0), len(0) {} } tr[100005 << 3]; diff --git a/Luogu/P5731/P5731.cpp b/Luogu/P5731/P5731.cpp index 54e60a56..86d2355b 100644 --- a/Luogu/P5731/P5731.cpp +++ b/Luogu/P5731/P5731.cpp @@ -16,7 +16,7 @@ int main() { * ax, ay-1 -> 左侧 * ax+1, ay -> 下方 * ax-1, ay -> 上方 - * + * * 0 --- 1 ---------- ay ----------> n * | +------+------+------+------+------+ * 1 | | | ax-1 | | | diff --git a/Luogu/P5837/P5837.cpp b/Luogu/P5837/P5837.cpp index d203d847..c1b573d9 100644 --- a/Luogu/P5837/P5837.cpp +++ b/Luogu/P5837/P5837.cpp @@ -8,6 +8,7 @@ struct node { node() { to = cost = limit = 0; } + node(int _to, int _cost, int _limit) { to = _to; cost = _cost; diff --git a/Luogu/P7667/P7667.cpp b/Luogu/P7667/P7667.cpp index d6d8bcb0..fc7dec28 100644 --- a/Luogu/P7667/P7667.cpp +++ b/Luogu/P7667/P7667.cpp @@ -9,6 +9,7 @@ struct node { return a < b.a; } } a[500005]; + int n; long long s[500005], c, ans; diff --git a/Luogu/P7912/P7912.cpp b/Luogu/P7912/P7912.cpp index 01736eae..128d89d7 100644 --- a/Luogu/P7912/P7912.cpp +++ b/Luogu/P7912/P7912.cpp @@ -8,6 +8,7 @@ struct node { node() : start(-1), end(-1), value(false) {} + node(int _start, int _end, bool _value) : start(_start), end(_end), value(_value) {} }; diff --git a/Luogu/P8251/P8251.cpp b/Luogu/P8251/P8251.cpp index 001e8ad9..efc72716 100644 --- a/Luogu/P8251/P8251.cpp +++ b/Luogu/P8251/P8251.cpp @@ -13,6 +13,7 @@ struct node { node() : a(0), b(0), idx(0) {} + node(int _a, int _b, int _idx) : a(_a), b(_b), idx(_idx) {} }; diff --git a/Luogu/SP2713/SP2713.cpp b/Luogu/SP2713/SP2713.cpp index 59111e00..d692f379 100644 --- a/Luogu/SP2713/SP2713.cpp +++ b/Luogu/SP2713/SP2713.cpp @@ -13,9 +13,11 @@ struct node { node() : l(0), r(0), s(0), m(0) {} + node(int _l, int _r) : l(_l), r(_r), s(0), m(0) {} } * tr; + void pushup(int); void build(int, int, int); void modify(int, int, int); diff --git a/Luogu/SP3267/SP3267.cpp b/Luogu/SP3267/SP3267.cpp index b827a7ad..249980a6 100644 --- a/Luogu/SP3267/SP3267.cpp +++ b/Luogu/SP3267/SP3267.cpp @@ -50,6 +50,7 @@ struct node { node() : l(0), r(0), c(0), lid(0), rid(0) {} + node(int _l, int _r) : l(_l), r(_r), c(0), lid(0), rid(0) {} } tr[N << 7]; diff --git a/Luogu/SP7259/SP7259.cpp b/Luogu/SP7259/SP7259.cpp index e1c18864..ae8d000b 100644 --- a/Luogu/SP7259/SP7259.cpp +++ b/Luogu/SP7259/SP7259.cpp @@ -8,12 +8,14 @@ struct node { node() { l = r = s = d = 0; } + node(int _l, int _r) { l = _l; r = _r; s = d = 0; } } tr[100005 << 2]; + int n, m, op, s, e; void pushup(int u) { diff --git a/S2OJ/100/100.cpp b/S2OJ/100/100.cpp index 813c0a3e..aaa6b1a0 100644 --- a/S2OJ/100/100.cpp +++ b/S2OJ/100/100.cpp @@ -15,6 +15,7 @@ struct node { node() : l(0), r(0), s(0), v(0), d(false), k(rand()) {} + node(int _v) : l(0), r(0), s(1), v(_v), d(false), k(rand()) {} } tr[N]; diff --git a/S2OJ/104/104.cpp b/S2OJ/104/104.cpp index 9359bc93..9a141aa5 100644 --- a/S2OJ/104/104.cpp +++ b/S2OJ/104/104.cpp @@ -16,6 +16,7 @@ int n, m, s, t, flow, cost; // Graph int idx, head[N], ver[M << 1], next[M << 1]; std::pair edge[M << 1]; + // < c, w> void add(int u, int v, int c, int w) { diff --git a/S2OJ/1159/1159.cpp b/S2OJ/1159/1159.cpp index 5a64ffb7..50d4ceb3 100644 --- a/S2OJ/1159/1159.cpp +++ b/S2OJ/1159/1159.cpp @@ -14,12 +14,16 @@ struct node { node() : x(0), y(0), step(0) {} + node(int _x, int _y) : x(_x), y(_y), step(0) {} + node(pair _point) : x(_point.first), y(_point.second), step(0) {} + node(pair _point, int _step) : x(_point.first), y(_point.second), step(_step) {} + node(int _x, int _y, int _step) : x(_x), y(_y), step(_step) {} }; diff --git a/S2OJ/1172/1172.cpp b/S2OJ/1172/1172.cpp index 8909b488..6c97e2e6 100644 --- a/S2OJ/1172/1172.cpp +++ b/S2OJ/1172/1172.cpp @@ -85,6 +85,7 @@ struct node { node() : l(0), r(0), d(0) {} + node(int _l, int _r) : l(_l), r(_r), d(0) {} } tr[N << 2]; diff --git a/S2OJ/1199/1199.cpp b/S2OJ/1199/1199.cpp index bd50c82f..52564c7e 100644 --- a/S2OJ/1199/1199.cpp +++ b/S2OJ/1199/1199.cpp @@ -77,6 +77,7 @@ struct node { node() : l(0), r(0), id(0) {} + node(int _l, int _r) : l(_l), r(_r), id(0) {} } tr[N << 2]; diff --git a/S2OJ/1224/1224.cpp b/S2OJ/1224/1224.cpp index 84e69165..3dd81dd0 100644 --- a/S2OJ/1224/1224.cpp +++ b/S2OJ/1224/1224.cpp @@ -206,6 +206,7 @@ class BigInt { return os; } }; + /* ---------- */ using std::cin; diff --git a/S2OJ/1256/1256.cpp b/S2OJ/1256/1256.cpp index 8ba9c5ec..ddbe3b6c 100644 --- a/S2OJ/1256/1256.cpp +++ b/S2OJ/1256/1256.cpp @@ -33,6 +33,7 @@ struct segment { segment() : x(0), y1(0), y2(0), k(0) {} + segment(int _x, int _y1, int _y2, int _k) : x(_x), y1(_y1), y2(_y2), k(_k) {} @@ -51,6 +52,7 @@ struct node { node() : l(0), r(0), cnt(0), len(0) {} + node(int _l, int _r) : l(_l), r(_r), cnt(0), len(0) {} } tr[N << 3]; diff --git a/S2OJ/1266/1266.cpp b/S2OJ/1266/1266.cpp index 514fc19e..6f4f43e8 100644 --- a/S2OJ/1266/1266.cpp +++ b/S2OJ/1266/1266.cpp @@ -15,6 +15,7 @@ std::vector> g[N]; // Dijkstra - Shortest Path long long dist[N]; bool vis[N]; + void dijkstra() { memset(dist, 0x3f, sizeof(dist)); dist[1] = 0; diff --git a/S2OJ/438/438.cpp b/S2OJ/438/438.cpp index b03d2035..dda6d458 100644 --- a/S2OJ/438/438.cpp +++ b/S2OJ/438/438.cpp @@ -13,9 +13,11 @@ double dis3d(int x1, int y1, int z1, int x2, int y2, int z2) { int main() { int n, r, d, v; double s = 9999999.00, f[1005][1005]; + struct { int x, y, z; } a[1005]; + cin >> n >> r >> d >> v; for (int i = 1; i <= n; i++) { cin >> a[i].x >> a[i].y >> a[i].z; diff --git a/S2OJ/790/790.cpp b/S2OJ/790/790.cpp index bfd89666..3e1b5473 100644 --- a/S2OJ/790/790.cpp +++ b/S2OJ/790/790.cpp @@ -9,6 +9,7 @@ struct node { long long p; node() {} + node(int _t, long long _p) : t(_t), p(_p) {} }; diff --git a/S2OJ/99/99.cpp b/S2OJ/99/99.cpp index 09d9cadc..00cd78b2 100644 --- a/S2OJ/99/99.cpp +++ b/S2OJ/99/99.cpp @@ -61,6 +61,7 @@ int main() { Treap::node::node() : l(0), r(0), s(0), v(0), k(rand()) {} + Treap::node::node(int _v) : l(0), r(0), s(1), v(_v), k(rand()) {}