Submission #871106

# Submission time Handle Problem Language Result Execution time Memory
871106 2023-11-09T22:54:26 Z MinaRagy06 NoM (RMI21_nom) C++17
9 / 100
500 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n, m;
	cin >> n >> m;
	int a[2 * n];
	for (int i = 0; i < n; i++) {
		a[i] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		a[i + n] = - (i + 1);
	}
	sort(a, a + 2 * n);
	int cnt = 0;
	do {
		bool bad = 0;
		for (int i = 0; i < 2 * n; i++) {
			for (int j = i + 1; j < 2 * n; j++) {
				if (abs(a[i]) == abs(a[j])) {
					bad |= (j - i) % m == 0;
				}
			}
		}
		cnt += !bad;
	} while(next_permutation(a, a + 2 * n));
	cout << cnt << '\n';
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 452 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 355 ms 596 KB Output is correct
10 Correct 381 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 452 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 355 ms 596 KB Output is correct
10 Correct 381 ms 344 KB Output is correct
11 Execution timed out 1057 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 452 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 355 ms 596 KB Output is correct
10 Correct 381 ms 344 KB Output is correct
11 Execution timed out 1057 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 452 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 355 ms 596 KB Output is correct
10 Correct 381 ms 344 KB Output is correct
11 Execution timed out 1057 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 452 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 355 ms 596 KB Output is correct
10 Correct 381 ms 344 KB Output is correct
11 Execution timed out 1057 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -