From d71f85a7cd64f8161c096342a0865f601c62ddf6 Mon Sep 17 00:00:00 2001 From: wu-kan Date: Sun, 24 Feb 2019 16:43:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=9A=E6=96=87=E5=86=85=E5=AE=B9=E9=87=8C?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=E5=8A=A0=E4=B8=8Araw=E6=A0=87?= =?UTF-8?q?=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _posts/2019-02-24-CodeForces-641E.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/_posts/2019-02-24-CodeForces-641E.md b/_posts/2019-02-24-CodeForces-641E.md index 51b4793de..c501e265d 100644 --- a/_posts/2019-02-24-CodeForces-641E.md +++ b/_posts/2019-02-24-CodeForces-641E.md @@ -45,9 +45,10 @@ int main() } } ``` -时间最优解当然是动态开点线段树啦,比上面的代码快了一倍(170ms:342ms),空间也小了一些(45300kB:52676kB)。 +时间最优解当然是动态开点线段树啦,比上面的代码快了正好一倍(171ms:342ms),空间也小了一些(45344kB:52676kB)。 启示是,假如题目空间给的足够大的话,可以用建在map上的树状数组来偷懒代替线段树来维护区间和。 +{% raw %} ```cpp #include using namespace std; @@ -101,7 +102,7 @@ struct SegmentTree return ask(l, m, v[rt].lc) + ask(m + 1, r, v[rt].rc); } }; -unordered_map mp; +map mp; int n, a, t, x; int main() { @@ -115,3 +116,4 @@ int main() } } ``` +{% endraw %}