This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
int main() {
int n,m;
cin >> n >> m;
vector <int> v(2 * n);
for (int i = 0; i < n * 2; i++){
v[i] = i;
}
int rs = 0;
do {
bool f = 1;
int p[2 * n] = {};
for (int i = 0; i < n * 2; i++){
p[v[i]] = i;
}
for (int i = 0; i < n; i++){
if (abs(p[i] - p[i + n]) % m == 0) f = 0;
}
rs+=f;
} while (next_permutation(v.begin(), v.end()));
cout << rs << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |