Submission #734604

#TimeUsernameProblemLanguageResultExecution timeMemory
7346041075508020060209tcSandcastle 2 (JOI22_ho_t5)C++14
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int n;int m; int ar[200005]; int dp[200005]; int dp2[200005]; signed main(){ cin>>m>>n; for(int i=1;i<=n;i++){ cin>>ar[i]; } for(int i=n;i>=1;i--){ dp[i]=1; if(ar[i+1]<ar[i]){ dp[i]=dp[i+1]+1; } } reverse(ar+1,ar+n+1); for(int i=n;i>=1;i--){ dp2[i]=1; if(ar[i+1]<ar[i]){ dp2[i]=dp2[i+1]+1; } } int ans=0; for(int i=1;i<=n;i++){ ans+=dp[i]+dp2[i]; } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...