#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<<dp[i]<<" "<<dp2[i]<<endl;
}
ans-=n;
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |