Submission #420747

# Submission time Handle Problem Language Result Execution time Memory
420747 2021-06-08T13:43:07 Z qwerasdfzxcl Asceticism (JOI18_asceticism) C++14
4 / 100
600 ms 284 KB
#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

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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 80 ms 284 KB Output is correct
3 Correct 73 ms 272 KB Output is correct
4 Correct 74 ms 204 KB Output is correct
5 Correct 74 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 7 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 80 ms 284 KB Output is correct
3 Correct 73 ms 272 KB Output is correct
4 Correct 74 ms 204 KB Output is correct
5 Correct 74 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 7 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Execution timed out 1085 ms 204 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 80 ms 284 KB Output is correct
3 Correct 73 ms 272 KB Output is correct
4 Correct 74 ms 204 KB Output is correct
5 Correct 74 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 7 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Execution timed out 1085 ms 204 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 80 ms 284 KB Output is correct
3 Correct 73 ms 272 KB Output is correct
4 Correct 74 ms 204 KB Output is correct
5 Correct 74 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 7 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Execution timed out 1085 ms 204 KB Time limit exceeded
12 Halted 0 ms 0 KB -