This commit is contained in:
Zengtudor 2024-10-04 21:17:44 +08:00
parent e1d8fac250
commit 1768e7d6ef

View File

@ -3,7 +3,7 @@
using std::cin, std::cout, std::iostream, std::max, std::for_each_n; 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 arr[MAX_N], len[MAX_N], ans1, ans2{1}, n, last_max;
int main(){ int main(){
@ -25,11 +25,8 @@ int main(){
for_each_n(arr+1,n,[](decltype(*arr) e){ for_each_n(arr+1,n,[](decltype(*arr) e){
if(last_max < e){ if(last_max < e){
ans2++; ans2++;
last_max = e;
}else{
last_max = e;
} }
last_max = e;
}); });
cout<<ans1<<'\n'<<ans2<<'\n'; cout<<ans1<<'\n'<<ans2<<'\n';
} }