From 1768e7d6ef2a396aee72b36cc9f7ce05b477758d Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Fri, 4 Oct 2024 21:17:44 +0800 Subject: [PATCH] update --- P1020/P1020.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/P1020/P1020.cpp b/P1020/P1020.cpp index a0d7269..393d245 100644 --- a/P1020/P1020.cpp +++ b/P1020/P1020.cpp @@ -3,7 +3,7 @@ using std::cin, std::cout, std::iostream, std::max, std::for_each_n; -constexpr size_t MAX_N {(size_t)5e4+5}; +constexpr size_t MAX_N {(size_t)5e5+5}; int arr[MAX_N], len[MAX_N], ans1, ans2{1}, n, last_max; int main(){ @@ -25,11 +25,8 @@ int main(){ for_each_n(arr+1,n,[](decltype(*arr) e){ if(last_max < e){ ans2++; - last_max = e; - }else{ - last_max = e; } + last_max = e; }); - cout<