답안 #857076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
857076 2023-10-05T10:55:43 Z iulia_morariu NoM (RMI21_nom) C++17
9 / 100
500 ms 432 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    cin.tie(0);ios::sync_with_stdio(0);

    //1.
    int n, m;

    //2.
    cin >> n >> m;
    vector < pair<int, int> > v(2 * n);

    //3.
    for(int i = 0; i < n; i++){
        v[i].first = i + 1;
        v[i].second = 1;
    }

    for(int i = 0; i < n; i++){
        v[i + n].first = i + 1;
        v[i + n].second = 2;
    }
    sort(v.begin(), v.end());

    long long int f = 1;
    for(int i = 1; i <= n * 2; i++) f *= i;

    int p[n + 1];
    long long int cnt = 0;
    for(int i = 0; i < f; i++){
        bool ok = 1;
        for(int j = 0; j < n; j++) p[j + 1] = -1;
        for(int j = 0; j < 2 * n; j++){
            if(p[ v[j].first ] == -1) p[ v[j].first ] = j;
            else{
                if( (j - p[ v[j].first ]) % m == 0 ){
                    ok = 0;
                    break;
                }
            }
        }

        if(ok) cnt++;

        next_permutation(v.begin(), v.end());
    }

    cout << cnt << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 39 ms 348 KB Output is correct
10 Correct 85 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 39 ms 348 KB Output is correct
10 Correct 85 ms 432 KB Output is correct
11 Execution timed out 1050 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 39 ms 348 KB Output is correct
10 Correct 85 ms 432 KB Output is correct
11 Execution timed out 1050 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 39 ms 348 KB Output is correct
10 Correct 85 ms 432 KB Output is correct
11 Execution timed out 1050 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 39 ms 348 KB Output is correct
10 Correct 85 ms 432 KB Output is correct
11 Execution timed out 1050 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -