#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define pb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
const int mod = 1e6+3;
int n,k;
int a[mod];
void inp(){
ios_base::sync_with_stdio(0);
cin.tie(NULL); cout.tie(NULL);
cin>>n>>k;
for(int i=1;i<=n-k+1;i++){
cin>>a[i];
}
}
int v[mod];
signed main(){
inp();
v[1]=1;
for(int i=2;i<=n-k+1;i++){
if(a[i]==a[i-1]){
v[i+k-1]= v[i-1];
}
else if(a[i]>a[i-1]){
v[i+k-1]=1;
}
else {
v[i+k-1]= 0;
}
}
long long total=0, pos =0;
for(int i=1;i<=k;i++){
total+=v[i];
pos += (v[i]==0);
}
total = a[1] - total;
// cerr<<pos<<" "<<total<<"\n";
double sum=1;
for(int i=1;i<=total;i++){
sum= sum* (pos-total+i)/i;
}
cout<<sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2512 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2512 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2512 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2512 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2512 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2512 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |