Open
Conversation
Open
Member
|
テストできるようになったと思います |
Contributor
Author
|
buildが変わっていないみたいでダメでした. と出ます. |
Member
|
|
Contributor
Author
|
Member
|
|
Contributor
Author
798aec0 |
Member
|
あー本当だ、申し訳ない 🙇 |
odanado
reviewed
Jun 26, 2018
| SegmentTree(vector<Monoid> vec, const Func f, const Monoid identityElement); | ||
| void Update(int idx, Monoid val); | ||
| Monoid Query(int a, int b, int k = 0, int l = 0, | ||
| int r = -1); // 使う時は区間[a, b)のみ指定すれば良い |
Member
There was a problem hiding this comment.
あれここ r=-1 でよかったっけと思ったら47行目で r=n;してるのか
| }; | ||
|
|
||
| template <typename Monoid> | ||
| SegmentTree<Monoid>::SegmentTree(vector<Monoid> vec, const Func f, |
Member
There was a problem hiding this comment.
単純な疑問で、なんで第一引数にvecと受け取るようにしたか知りたいです
特に配列の大きさNを渡すだけと比べて何が違うのか
Contributor
Author
There was a problem hiding this comment.
事前に生成された配列の区間に対するQueryが高速に欲しい場合に,Update関数を用いてセグ木を作るより,配列からセグ木を作るほうが手間が省けると考えたためです.
odanado
reviewed
Jun 27, 2018
|
|
||
| template <typename Monoid> | ||
| Monoid SegmentTree<Monoid>::Query(int a, int b, int k, int l, int r) { | ||
| if (r < 0) r = n; |
Member
There was a problem hiding this comment.
ここは写経するときに見落としてバグりそうな気がするので、 Query(int, int, int, int, int) を query(int, int, int, int, int) としてprivateに移動し、 publicに Query(int, int) という関数を新しく用意するのはどうでしょうか?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.