diff options
Diffstat (limited to 'segmenttree.c')
-rw-r--r-- | segmenttree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/segmenttree.c b/segmenttree.c index 4471369..449f8e7 100644 --- a/segmenttree.c +++ b/segmenttree.c @@ -6,7 +6,7 @@ int * seg; void build(sqlite3_stmt *stmt, int l, int r, int n) { if (l == r) { sqlite3_step(stmt); - seg[l] = sqlite3_column_int(stmt, 0); + seg[n] = sqlite3_column_int(stmt, 0); return; } int m = l + r >> 1; @@ -45,4 +45,4 @@ void query(int *res, int v, int l, int r, int n) { else { query(res, v - seg[n << 1], m + 1, r, n << 1 | 1); } -}
\ No newline at end of file +} |