Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteafd45a

Browse files
Inconsistent inequality in segment_tree.md
The condition `l < tl` and `tr < r` will never be true in `query`. So only `==` can be checked.
1 parent6022c10 commiteafd45a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/data_structures/segment_tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ void update(int v, int tl, int tr, int l, int r, int addend) {
842842
int query(int v, int tl, int tr, int l, int r) {
843843
if (l > r)
844844
return -INF;
845-
if (l<= tl && tr<= r)
845+
if (l== tl && tr== r)
846846
return t[v];
847847
push(v);
848848
int tm = (tl + tr) / 2;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp