Submission #645869

# Submission time Handle Problem Language Result Execution time Memory
645869 2022-09-28T08:24:36 Z TimDee NoM (RMI21_nom) C++17
0 / 100
500 ms 276 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>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

Main.cpp: In function 'void solve()':
Main.cpp:12:6: warning: unused variable 'steps' [-Wunused-variable]
   12 |  int steps=0;
      |      ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Execution timed out 522 ms 276 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Execution timed out 522 ms 276 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Execution timed out 522 ms 276 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Execution timed out 522 ms 276 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Execution timed out 522 ms 276 KB Time limit exceeded
10 Halted 0 ms 0 KB -