This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
# include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
int n, k, a[N], ans;
int main(){
cin >> n >> k;
for(int i = 1; i <= n; i ++)
a[i] = i;
do{
int cn = 1;
for(int i = 2; i <= n; i ++){
if(a[i] < a[i - 1]) cn ++;
}
if(cn == k) ans ++;
} while(next_permutation(a + 1, a + n + 1));
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |