From e1d8fac250f5b6cc6c4d8716ebd8afd8bf24a6d2 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Fri, 4 Oct 2024 21:04:02 +0800 Subject: [PATCH] update --- P1020/P1020.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/P1020/P1020.cpp b/P1020/P1020.cpp index b3efac0..a0d7269 100644 --- a/P1020/P1020.cpp +++ b/P1020/P1020.cpp @@ -1,16 +1,35 @@ +#include #include -using std::cin, std::cout, std::iostream; +using std::cin, std::cout, std::iostream, std::max, std::for_each_n; constexpr size_t MAX_N {(size_t)5e4+5}; -int n, arr[MAX_N], len[MAX_N], ans1, ans2; +int arr[MAX_N], len[MAX_N], ans1, ans2{1}, n, last_max; int main(){ iostream::sync_with_stdio(false), cin.tie(0), cout.tie(0); - cin>>n; - for(size_t i=0;i>arr[i]; - } + while(cin>>arr[n++]); + for(int i=0;i=0;j--){ //j=arr[i] && len[i]