# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420747 | qwerasdfzxcl | Asceticism (JOI18_asceticism) | C++14 | 1085 ms | 284 KiB |
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>
typedef long long ll;
using namespace std;
vector<int> v;
int main(){
int n, k;
scanf("%d %d", &n, &k);
for (int i=1;i<=n;i++) v.push_back(i);
ll fact = 1, ans = 0;
for (int i=1;i<=n;i++) fact *= i;
for (int i=0;i<fact;i++){
int cnt = 0;
for (int j=1;j<n;j++) if (v[j]<v[j-1]) cnt++;
if (cnt+1==k) ans++;
next_permutation(v.begin(), v.end());
}
printf("%lld\n", ans);
return 0;
}
Compilation message (stderr)
# | 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... |