Meaning of the questions:
N a situation you long to full array, divided into k parts, each take the maximum value of the sum, and the output of the maximum value and how many points equal to the maximum method.
Ideas:
K takes a large value before the storage index, between every two large k values are k I +. 1 - k I +. 1 seeded process, can be multiplied.
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=998244353; int main() { int n,k;cin>>n>>k; int p[n];for(int &i:p) cin>>i; int pos[n+n]={0}; for(int i=0;i<n;i++) pos[p[i]]=i; vector<int> v; ll sum=0; for(int i=k,t=n;i>=1;i--){ sum+=t; v.push_back(pos[t--]); } sort(v.begin(),v.end()); ll ans=1; for(int i=0;i<int(v.size())-1;i++) ans=ans*(v[i+1]-v[i])%mod; cout<<sum<<' '<<ans<<"\n"; return 0; }