Submission #645557

# Submission time Handle Problem Language Result Execution time Memory
645557 2022-09-27T10:40:01 Z Vanilla NoM (RMI21_nom) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;

int main() {
    int n,m;
    cin >> n >> m;
    vector <int> v(2 * n);
    for (int i = 0; i < n * 2; i++){
        v[i] = (i / 2) + 1;
    }
    int rs = 0;
    do {
        bool f = 1;
        int p[2 * n] = {};
        for (int i = 0; i < n; i++){
            p[i] = -1;
        }
        for (int i = 0; i < n * 2; i++){
            if (p[v[i]] == -1) {
                p[v[i]] = 1;
            }
            else {
                if ((i - (p[v[i]])) % m == 0) {
                    f = 0;
                }
            }
        }
        rs+=(f * (1 << n));
    } while (next_permutation(v.begin(), v.end()));
    cout << rs << "\n";
}
# 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -