Submission #645876

# Submission time Handle Problem Language Result Execution time Memory
645876 2022-09-28T08:38:16 Z TimDee NoM (RMI21_nom) C++17
0 / 100
0 ms 212 KB
#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>s;
	forn(i,2*n) s.push_back(i+1);
	int steps=0;
	int ans=0;

	//next_permutation(s.begin(), s.end());
	int need=1;

	bitset<6> a[5];

	forn(i,2*n) need*=i+1;
	while (need--) {
		++steps;
		int paiu=1;
		
		forn(i,5) a[i].reset();
		forn(i,2*n) {
			if (a[i%m][s[i]%n]) paiu=0;
			a[i%m].set(s[i]%n);
		}

		ans+=paiu;
		next_permutation(s.begin(), s.end());
	}
	cout<<ans;
	cout<<" !"<<steps;
}

int32_t main() {
	solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -