Skip to content

Commit

Permalink
Update 037.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed May 1, 2022
1 parent 7f1ac27 commit 499a3f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions 037.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public:
return query(begin, end, 0, 0, m_size);
}

private:

// 対象区間 [begin, end) における最大値を求める.
// ni: 確認するノードのインデックス. そのノードの管理区間は [sBegin, sEnd)
long long query(size_t begin, size_t end, size_t ni, size_t sBegin, size_t sEnd) const
Expand All @@ -72,12 +74,10 @@ public:

// query(対象区間, 子ノード(右) のインデックス, 子ノード(右) の管理区間)
const long long m2 = query(begin, end, (ni * 2 + 2), (sBegin + sEnd) / 2, sEnd);

return std::max(m1, m2);
}

private:

size_t m_size = 1;

std::vector<long long> m_nodes;
Expand All @@ -91,7 +91,7 @@ struct Dish

// 最大で R [mg] の香辛料を消費
int R;

// 料理の価値
int V;
};
Expand Down

0 comments on commit 499a3f6

Please sign in to comment.