\hypertarget{classmeow_1_1SegmentTree}{\section{meow\-:\-:Segment\-Tree$<$ Value $>$ Class Template Reference} \label{classmeow_1_1SegmentTree}\index{meow\-::\-Segment\-Tree$<$ Value $>$@{meow\-::\-Segment\-Tree$<$ Value $>$}} } 中文名 {\ttfamily 線段樹} {\ttfamily \#include \char`\"{}Segment\-Tree.\-h\char`\"{}} \subsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \hyperlink{classmeow_1_1SegmentTree_a8e8365f0440c68f3c0853b94a7de3ccb}{Segment\-Tree} () \begin{DoxyCompactList}\small\item\em constructor \end{DoxyCompactList}\item \hyperlink{classmeow_1_1SegmentTree_a1fe904372d3cdd01f07a1c88f86b14a1}{Segment\-Tree} (size\-\_\-t \hyperlink{classmeow_1_1SegmentTree_a8985a196cfb954bc469e7dae146ad4ed}{size}) \begin{DoxyCompactList}\small\item\em constructor, with {\ttfamily size} gived \end{DoxyCompactList}\item \hyperlink{classmeow_1_1SegmentTree_a12a47cdf24eacb80d0bad4010f6a2953}{Segment\-Tree} (\hyperlink{classmeow_1_1SegmentTree}{Segment\-Tree} const \&tree2) \begin{DoxyCompactList}\small\item\em constructor, 並且複製資料 \end{DoxyCompactList}\item \hyperlink{classmeow_1_1SegmentTree}{Segment\-Tree} \hyperlink{classmeow_1_1SegmentTree_a889f38048ffe08ce3c80911878faac44}{copy\-From} (\hyperlink{classmeow_1_1SegmentTree}{Segment\-Tree} const \&b) \begin{DoxyCompactList}\small\item\em 複製 \end{DoxyCompactList}\item size\-\_\-t \hyperlink{classmeow_1_1SegmentTree_a8985a196cfb954bc469e7dae146ad4ed}{size} () const \begin{DoxyCompactList}\small\item\em 回傳size \end{DoxyCompactList}\item void \hyperlink{classmeow_1_1SegmentTree_a80c550b0a3b997bc541ae0947ae2f55d}{reset} (size\-\_\-t \hyperlink{classmeow_1_1SegmentTree_a8985a196cfb954bc469e7dae146ad4ed}{size}) \begin{DoxyCompactList}\small\item\em 將資料清空且設定維護範圍是 {\ttfamily 0$\sim$size-\/1} \end{DoxyCompactList}\item Value \hyperlink{classmeow_1_1SegmentTree_a18bb3667abd9810ce3534af3d70b14d5}{query} (ssize\-\_\-t first, ssize\-\_\-t last) const \begin{DoxyCompactList}\small\item\em 回傳區間 {\ttfamily }\mbox{[}first,last\mbox{]} (邊界都含) 的區間值 \end{DoxyCompactList}\item void \hyperlink{classmeow_1_1SegmentTree_a2f300a5fd5ffdd19e4b3efc6899a7439}{override} (ssize\-\_\-t first, ssize\-\_\-t last, Value const \&value) \begin{DoxyCompactList}\small\item\em 將區間 {\ttfamily }\mbox{[}first,last\mbox{]} 全部都設定成 {\ttfamily value} \end{DoxyCompactList}\item void \hyperlink{classmeow_1_1SegmentTree_aaeca3de355dc367e2664e83800ee6aa5}{offset} (ssize\-\_\-t first, ssize\-\_\-t last, Value const \&delta) \begin{DoxyCompactList}\small\item\em 將區間 {\ttfamily }\mbox{[}first,last\mbox{]} 全部都加上 {\ttfamily delta} \end{DoxyCompactList}\item \hyperlink{classmeow_1_1SegmentTree}{Segment\-Tree} \& \hyperlink{classmeow_1_1SegmentTree_a765e794af604ab7c20a4245dfafcf14c}{operator=} (\hyperlink{classmeow_1_1SegmentTree}{Segment\-Tree} const \&b) \begin{DoxyCompactList}\small\item\em same as copy\-From(b) \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection{Detailed Description} \subsubsection*{template$<$class Value$>$class meow\-::\-Segment\-Tree$<$ Value $>$} 中文名 {\ttfamily 線段樹} 維護一個陣列, 並且讓user可以有區間查詢, 區間修改的小東東 \subsubsection*{Template Class Operators Request } \begin{TabularC}{6} \hline \rowcolor{lightgray}\PBS\raggedleft {\bf const?}&\PBS\centering {\bf Typename}&\PBS\raggedleft {\bf Operator }&{\bf Parameters }&\PBS\centering {\bf Return Type }&{\bf Description }\\\cline{1-6} \PBS\raggedleft const &\PBS\centering \hyperlink{classmeow_1_1Vector}{Vector} &\PBS\raggedleft operator\mbox{[}\mbox{]} &(size\-\_\-t {\ttfamily n}) &\PBS\centering Scalar &取得第 {\ttfamily n} 維度量 \\\cline{1-6} \PBS\raggedleft const &\PBS\centering \hyperlink{classmeow_1_1Vector}{Vector} &\PBS\raggedleft operator$<$ &(\hyperlink{classmeow_1_1Vector}{Vector} {\ttfamily v}) &\PBS\centering bool &權重比較 \\\cline{1-6} \PBS\raggedleft const &\PBS\centering Scalar &\PBS\raggedleft operator$\ast$ &(Scalar {\ttfamily s}) &\PBS\centering Scalar &相乘 \\\cline{1-6} \PBS\raggedleft const &\PBS\centering Scalar &\PBS\raggedleft operator+ &(Scalar {\ttfamily s}) &\PBS\centering Scalar &相加 \\\cline{1-6} \PBS\raggedleft const &\PBS\centering Scalar &\PBS\raggedleft operator-\/ &(Scalar {\ttfamily s}) &\PBS\centering Scalar &相差 \\\cline{1-6} \PBS\raggedleft const &\PBS\centering Scalar &\PBS\raggedleft operator$<$ &(Scalar {\ttfamily s}) &\PBS\centering bool &大小比較 \\\cline{1-6} \PBS\raggedleft const &\PBS\centering Value &\PBS\raggedleft operator+ &(Value {\ttfamily v}) &\PBS\centering Value &相加(位移) \\\cline{1-6} \PBS\raggedleft const &\PBS\centering Value &\PBS\raggedleft operator$\ast$ &(size\-\_\-t {\ttfamily n}) &\PBS\centering Value &每個\-Value都一樣, \\\cline{1-6} \end{TabularC} 長為 {\ttfamily n} 的區間的值$\vert$ $\vert$const $\vert$\-Value $\vert$operator\{b\}$\vert$(Value {\ttfamily v}) $\vert$\-Value $\vert$ 區間合併後的值 $\vert$ \begin{DoxyItemize} \item 若要維護區間最小值, 即每次都是詢問範圍 {\ttfamily \mbox{[}a, b\mbox{]}} 的最小值, 則可以定義 \begin{DoxyItemize} \item {\ttfamily operator+} 為 '回傳相加值' \item {\ttfamily operator$\ast$} 為 '回傳$\ast$this' \item {\ttfamily operator$\vert$} 為 '回傳std\-::min($\ast$this, v)' \end{DoxyItemize} \item 若要維護區間最總和, 即每次都是詢問範圍 {\ttfamily \mbox{[}a, b\mbox{]}} 的總和, 則可以定義 \begin{DoxyItemize} \item {\ttfamily operator+} 為 '回傳相加值' \item {\ttfamily operator$\ast$} 為 '回傳($\ast$this) $\ast$ n' \item {\ttfamily operator$\vert$} 為 '回傳相加值' \end{DoxyItemize} \end{DoxyItemize} \begin{DoxyAuthor}{Author} cat\-\_\-leopard \end{DoxyAuthor} Definition at line 45 of file Segment\-Tree.\-h. \subsection{Constructor \& Destructor Documentation} \hypertarget{classmeow_1_1SegmentTree_a8e8365f0440c68f3c0853b94a7de3ccb}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!Segment\-Tree@{Segment\-Tree}} \index{Segment\-Tree@{Segment\-Tree}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{Segment\-Tree}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::{\bf Segment\-Tree} ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a8e8365f0440c68f3c0853b94a7de3ccb} constructor Definition at line 121 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_a1fe904372d3cdd01f07a1c88f86b14a1}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!Segment\-Tree@{Segment\-Tree}} \index{Segment\-Tree@{Segment\-Tree}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{Segment\-Tree}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::{\bf Segment\-Tree} ( \begin{DoxyParamCaption} \item[{size\-\_\-t}]{size} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a1fe904372d3cdd01f07a1c88f86b14a1} constructor, with {\ttfamily size} gived Definition at line 126 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_a12a47cdf24eacb80d0bad4010f6a2953}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!Segment\-Tree@{Segment\-Tree}} \index{Segment\-Tree@{Segment\-Tree}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{Segment\-Tree}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::{\bf Segment\-Tree} ( \begin{DoxyParamCaption} \item[{{\bf Segment\-Tree}$<$ Value $>$ const \&}]{tree2} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a12a47cdf24eacb80d0bad4010f6a2953} constructor, 並且複製資料 Definition at line 131 of file Segment\-Tree.\-h. \subsection{Member Function Documentation} \hypertarget{classmeow_1_1SegmentTree_a889f38048ffe08ce3c80911878faac44}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!copy\-From@{copy\-From}} \index{copy\-From@{copy\-From}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{copy\-From}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ {\bf Segment\-Tree} {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::copy\-From ( \begin{DoxyParamCaption} \item[{{\bf Segment\-Tree}$<$ Value $>$ const \&}]{b} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a889f38048ffe08ce3c80911878faac44} 複製 Definition at line 138 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_aaeca3de355dc367e2664e83800ee6aa5}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!offset@{offset}} \index{offset@{offset}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{offset}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ void {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::offset ( \begin{DoxyParamCaption} \item[{ssize\-\_\-t}]{first, } \item[{ssize\-\_\-t}]{last, } \item[{Value const \&}]{delta} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_aaeca3de355dc367e2664e83800ee6aa5} 將區間 {\ttfamily }\mbox{[}first,last\mbox{]} 全部都加上 {\ttfamily delta} Definition at line 181 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_a765e794af604ab7c20a4245dfafcf14c}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!operator=@{operator=}} \index{operator=@{operator=}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{operator=}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ {\bf Segment\-Tree}\& {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::operator= ( \begin{DoxyParamCaption} \item[{{\bf Segment\-Tree}$<$ Value $>$ const \&}]{b} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a765e794af604ab7c20a4245dfafcf14c} same as copy\-From(b) Definition at line 187 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_a2f300a5fd5ffdd19e4b3efc6899a7439}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!override@{override}} \index{override@{override}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{override}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ void {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::override ( \begin{DoxyParamCaption} \item[{ssize\-\_\-t}]{first, } \item[{ssize\-\_\-t}]{last, } \item[{Value const \&}]{value} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a2f300a5fd5ffdd19e4b3efc6899a7439} 將區間 {\ttfamily }\mbox{[}first,last\mbox{]} 全部都設定成 {\ttfamily value} Definition at line 173 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_a18bb3667abd9810ce3534af3d70b14d5}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!query@{query}} \index{query@{query}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{query}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ Value {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::query ( \begin{DoxyParamCaption} \item[{ssize\-\_\-t}]{first, } \item[{ssize\-\_\-t}]{last} \end{DoxyParamCaption} ) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a18bb3667abd9810ce3534af3d70b14d5} 回傳區間 {\ttfamily }\mbox{[}first,last\mbox{]} (邊界都含) 的區間值 Definition at line 165 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_a80c550b0a3b997bc541ae0947ae2f55d}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!reset@{reset}} \index{reset@{reset}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{reset}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ void {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::reset ( \begin{DoxyParamCaption} \item[{size\-\_\-t}]{size} \end{DoxyParamCaption} )\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a80c550b0a3b997bc541ae0947ae2f55d} 將資料清空且設定維護範圍是 {\ttfamily 0$\sim$size-\/1} Definition at line 154 of file Segment\-Tree.\-h. \hypertarget{classmeow_1_1SegmentTree_a8985a196cfb954bc469e7dae146ad4ed}{\index{meow\-::\-Segment\-Tree@{meow\-::\-Segment\-Tree}!size@{size}} \index{size@{size}!meow::SegmentTree@{meow\-::\-Segment\-Tree}} \subsubsection[{size}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Value $>$ size\-\_\-t {\bf meow\-::\-Segment\-Tree}$<$ Value $>$\-::size ( \begin{DoxyParamCaption} {} \end{DoxyParamCaption} ) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1SegmentTree_a8985a196cfb954bc469e7dae146ad4ed} 回傳size Definition at line 147 of file Segment\-Tree.\-h. The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize} \item meowpp/dsa/\hyperlink{SegmentTree_8h}{Segment\-Tree.\-h}\end{DoxyCompactItemize}