# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
597786 |
2022-07-16T21:22:13 Z |
ThegeekKnight16 |
NoM (RMI21_nom) |
C++14 |
|
500 ms |
2304 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 10;
vector<int> v;
int grupo[MAXN];
int resp = 0;
int modulo = 1e9 + 7;
int fat(int x)
{
if (x == 0) return 1;
if (x == 1) return 1;
cerr << "E" << '\n';
return ((x * fat(x-1)) % modulo);
}
void bt(int id, int N, int M)
{
cerr << "Inicio de " << id << '\n';
if (id == N+1)
{
int aux = 1;
for (int i = 1; i <= M; i++)
{
if (grupo[i] > ((2*N) / M) + ((2*N) % M >= i)) {cerr << "fim de " << id << '\n';return;}
aux *= fat(grupo[i]);
aux = aux % modulo;
cerr << aux << '\n';
}
resp += aux;
resp = resp % modulo;
cerr << "resp: " << resp << '\n';
cerr << "Fim de " << id << '\n';
return;
}
for (int i = 1; i <= M; i++)
{
for (int j = 1; j <= M; j++)
{
if (i == j) continue;
if (grupo[i] >= ((2*N) / M) + ((2*N) % M >= i)) continue;
if (grupo[j] >= ((2*N) / M) + ((2*N) % M >= j)) continue;
grupo[i]++; grupo[j]++;
bt(id+1, N, M);
grupo[i]--; grupo[j]--;
}
}
cerr << "Fim de " << id << '\n';
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, M;
cin >> N >> M;
bt(1, N, M);
cout << resp;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
324 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
10 ms |
332 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
2304 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
324 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
10 ms |
332 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
2304 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
324 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
10 ms |
332 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
2304 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
324 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
10 ms |
332 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
2304 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
324 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
10 ms |
332 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
2304 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |