From 30c538bf91d990c4363c20d839deea80f6f361a1 Mon Sep 17 00:00:00 2001 From: pnuth <85662273+radicalparty@users.noreply.github.com> Date: Fri, 12 Jul 2024 22:18:46 +0900 Subject: [PATCH] Update dynamic.cpp --- data_structure/segtree/dynamic.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data_structure/segtree/dynamic.cpp b/data_structure/segtree/dynamic.cpp index 7574f3f..033d409 100644 --- a/data_structure/segtree/dynamic.cpp +++ b/data_structure/segtree/dynamic.cpp @@ -1,7 +1,7 @@ //reference: https://justicehui.github.io/medium-algorithm/2020/02/28/DynamicSeg/ struct Node{ Node *l, *r; - ll tsum; + ll tsum;//구간 합 Node(): l(nullptr), r(nullptr), tsum(0) {} }; void update(Node *node, int s, int e, int p, ll val){ @@ -9,7 +9,7 @@ void update(Node *node, int s, int e, int p, ll val){ node->tsum = val; return; } int m = (s + e) >> 1; - if (p <= m){ + if (p <= m){//l, r을 반으로 나눠서 구간 선택, 나머지는 일반적인 세그와 동일 if (!node->l) node->l = new Node(); update(node->l, s, m, p, val); }