Submission #597761

# Submission time Handle Problem Language Result Execution time Memory
597761 2022-07-16T20:11:39 Z ThegeekKnight16 NoM (RMI21_nom) C++14
9 / 100
500 ms 308 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e3 + 10;
vector<int> v;
int pos[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    for (int i = 1; i <= 2*N; i++) v.push_back(i);
    
    int resp = 0; 
    do
    {
        bool b = true;
        
        for (int i = 0; i < 2*N; i++) pos[v[i]] = i;
        
        for (int i = 1; i <= N; i++) if (abs(pos[i] - pos[i+N]) % M == 0) b = false;
        
        resp += b;
    }
    while (next_permutation(v.begin(), v.end()));
    cout << resp;
    //cerr << 50*(10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1);
}
# 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 1 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 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 122 ms 308 KB Output is correct
10 Correct 115 ms 212 KB Output is correct
# 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 1 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 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 122 ms 308 KB Output is correct
10 Correct 115 ms 212 KB Output is correct
11 Execution timed out 1077 ms 212 KB Time limit exceeded
12 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 1 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 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 122 ms 308 KB Output is correct
10 Correct 115 ms 212 KB Output is correct
11 Execution timed out 1077 ms 212 KB Time limit exceeded
12 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 1 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 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 122 ms 308 KB Output is correct
10 Correct 115 ms 212 KB Output is correct
11 Execution timed out 1077 ms 212 KB Time limit exceeded
12 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 1 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 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 122 ms 308 KB Output is correct
10 Correct 115 ms 212 KB Output is correct
11 Execution timed out 1077 ms 212 KB Time limit exceeded
12 Halted 0 ms 0 KB -