Submission #597761

#TimeUsernameProblemLanguageResultExecution timeMemory
597761ThegeekKnight16NoM (RMI21_nom)C++14
9 / 100
1077 ms308 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 4e3 + 10; vector<int> v; int pos[MAXN]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N, M; cin >> N >> M; for (int i = 1; i <= 2*N; i++) v.push_back(i); int resp = 0; do { bool b = true; for (int i = 0; i < 2*N; i++) pos[v[i]] = i; for (int i = 1; i <= N; i++) if (abs(pos[i] - pos[i+N]) % M == 0) b = false; resp += b; } while (next_permutation(v.begin(), v.end())); cout << resp; //cerr << 50*(10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...