# 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
51 ms |
488 KB |
Output is correct |
3 |
Correct |
50 ms |
488 KB |
Output is correct |
4 |
Correct |
50 ms |
488 KB |
Output is correct |
5 |
Correct |
52 ms |
520 KB |
Output is correct |
6 |
Correct |
2 ms |
536 KB |
Output is correct |
7 |
Correct |
7 ms |
536 KB |
Output is correct |
8 |
Correct |
2 ms |
672 KB |
Output is correct |
9 |
Correct |
2 ms |
672 KB |
Output is correct |
10 |
Correct |
2 ms |
672 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
51 ms |
488 KB |
Output is correct |
3 |
Correct |
50 ms |
488 KB |
Output is correct |
4 |
Correct |
50 ms |
488 KB |
Output is correct |
5 |
Correct |
52 ms |
520 KB |
Output is correct |
6 |
Correct |
2 ms |
536 KB |
Output is correct |
7 |
Correct |
7 ms |
536 KB |
Output is correct |
8 |
Correct |
2 ms |
672 KB |
Output is correct |
9 |
Correct |
2 ms |
672 KB |
Output is correct |
10 |
Correct |
2 ms |
672 KB |
Output is correct |
11 |
Execution timed out |
1071 ms |
672 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
51 ms |
488 KB |
Output is correct |
3 |
Correct |
50 ms |
488 KB |
Output is correct |
4 |
Correct |
50 ms |
488 KB |
Output is correct |
5 |
Correct |
52 ms |
520 KB |
Output is correct |
6 |
Correct |
2 ms |
536 KB |
Output is correct |
7 |
Correct |
7 ms |
536 KB |
Output is correct |
8 |
Correct |
2 ms |
672 KB |
Output is correct |
9 |
Correct |
2 ms |
672 KB |
Output is correct |
10 |
Correct |
2 ms |
672 KB |
Output is correct |
11 |
Execution timed out |
1071 ms |
672 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
51 ms |
488 KB |
Output is correct |
3 |
Correct |
50 ms |
488 KB |
Output is correct |
4 |
Correct |
50 ms |
488 KB |
Output is correct |
5 |
Correct |
52 ms |
520 KB |
Output is correct |
6 |
Correct |
2 ms |
536 KB |
Output is correct |
7 |
Correct |
7 ms |
536 KB |
Output is correct |
8 |
Correct |
2 ms |
672 KB |
Output is correct |
9 |
Correct |
2 ms |
672 KB |
Output is correct |
10 |
Correct |
2 ms |
672 KB |
Output is correct |
11 |
Execution timed out |
1071 ms |
672 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |