#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
//4 pts: N <= 10
int main()
{
int N, K;
cin >> N >> K;
vector<int> X(N);
for(int i = 1; i <= N; i++) X[i-1] = i;
int res = 0;
int a;
do
{
a = 1;
for(int i = 1; i < N; i++) if(X[i-1] > X[i]) a++;
if(a == K) res++;
} while(next_permutation(X.begin(), X.end()));
cout << res << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
54 ms |
384 KB |
Output is correct |
3 |
Correct |
45 ms |
256 KB |
Output is correct |
4 |
Correct |
43 ms |
256 KB |
Output is correct |
5 |
Correct |
42 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
4 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
54 ms |
384 KB |
Output is correct |
3 |
Correct |
45 ms |
256 KB |
Output is correct |
4 |
Correct |
43 ms |
256 KB |
Output is correct |
5 |
Correct |
42 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
4 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Execution timed out |
1048 ms |
256 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
54 ms |
384 KB |
Output is correct |
3 |
Correct |
45 ms |
256 KB |
Output is correct |
4 |
Correct |
43 ms |
256 KB |
Output is correct |
5 |
Correct |
42 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
4 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Execution timed out |
1048 ms |
256 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
54 ms |
384 KB |
Output is correct |
3 |
Correct |
45 ms |
256 KB |
Output is correct |
4 |
Correct |
43 ms |
256 KB |
Output is correct |
5 |
Correct |
42 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
4 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Execution timed out |
1048 ms |
256 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |