Submission #645866

#TimeUsernameProblemLanguageResultExecution timeMemory
645866TimDeeNoM (RMI21_nom)C++17
0 / 100
1053 ms255952 KiB
#include <bits/stdc++.h> using namespace std; #define forn(i,n) for (int i=0; i<n; ++i) vector<vector<int>>v; void bf(vector<int>&vis, int n, vector<int>&s) { if (s.size()>=n) { v.push_back(s); return; } for (int i=1; i<=n; ++i) { if (vis[i]) continue; vis[i]=1; s.push_back(i); bf(vis,n,s); vis[i]=0; s.pop_back(); } } void solve() { int n,m; cin>>n>>m; if (n>5) return; vector<int>vis(2*n+1,0); vector<int>s; bf(vis,2*n,s); int ans=0; for (auto a:v) { int paiu=1; forn(i,2*n) { for (int k=i%m; k<2*n; k+=m) { if (k==i) continue; if (abs(a[k]-a[i])==n) paiu=0; } } ans+=paiu; } cout<<ans; } int32_t main() { solve(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'void bf(std::vector<int>&, int, std::vector<int>&)':
Main.cpp:8:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |  if (s.size()>=n) {
      |      ~~~~~~~~^~~
#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...