Submission #420747

#TimeUsernameProblemLanguageResultExecution timeMemory
420747qwerasdfzxclAsceticism (JOI18_asceticism)C++14
4 / 100
1085 ms284 KiB
#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)

asceticism.cpp: In function 'int main()':
asceticism.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...