Submission #645865

# Submission time Handle Problem Language Result Execution time Memory
645865 2022-09-28T08:18:23 Z TimDee NoM (RMI21_nom) C++17
Compilation error
0 ms 0 KB
#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() {
	if (n>5) return;
	int n,m; cin>>n>>m;
	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

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) {
      |      ~~~~~~~~^~~
Main.cpp: In function 'void solve()':
Main.cpp:23:6: error: 'n' was not declared in this scope
   23 |  if (n>5) return;
      |      ^