Submission #1038869

#TimeUsernameProblemLanguageResultExecution timeMemory
1038869vjudge1Binaria (CCO23_day1problem1)C++17
0 / 25
1 ms2512 KiB
#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; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...