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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
signed main() {
int n, m;
cin >> n >> m;
vector<int> a(n * 2);
for (int i = 0; i < n * 2; ++i)
a[i] = i;
vector<int> ca = a;
int ans = 0;
do {
++ans;
for (int i = 0; i < 2 * n; i += 2) {
if (a[i] % m == a[i + 1] % m) {
//for (auto x : a)
//cout << x << ' ';
//cout << endl;
--ans;
break;
}
}
next_permutation(a.begin(), a.end());
} while (ca != a);
cout << ans << endl;
}
# | 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... |