Submission #645869

#TimeUsernameProblemLanguageResultExecution timeMemory
645869TimDeeNoM (RMI21_nom)C++17
0 / 100
522 ms276 KiB
#include <bits/stdc++.h> using namespace std; #define forn(i,n) for (int i=0; i<n; ++i) void solve() { int n,m; cin>>n>>m; if (n>5) return; vector<int>vis(2*n+1,0); vector<int>s; forn(i,2*n) s.push_back(i+1); int steps=0; int ans=0; next_permutation(s.begin(), s.end()); while (1) { int paiu=1; forn(i,2*n) { for (int k=i%m; k<2*n; k+=m) { if (k==i) continue; if (abs(s[k]-s[i])==n) paiu=0; } } ans+=paiu; int scuza=1; for (int i=0; i<2*n; ++i) { scuza&=(i+1)==s[i]; } if (scuza) break; next_permutation(s.begin(), s.end()); } cout<<ans; //cout<<" !"<<steps; } int32_t main() { solve(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:12:6: warning: unused variable 'steps' [-Wunused-variable]
   12 |  int steps=0;
      |      ^~~~~
#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...