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;
typedef long long ll;
int a[20];
int main(){
ios_base::sync_with_stdio(false);
int n, k;
cin >> n >> k;
for (int i = 1; i <= n; i++)
a[i] = i;
int cnt = 0;
do{
int p = 1;
for (int i = 2; i <= n; i++)
p += (a[i] < a[i - 1]);
cnt += (p == k);
}while (next_permutation(a + 1, a + n + 1));
cout << cnt << 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... |