답안 #786438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
786438 2023-07-18T07:48:01 Z 이성호(#10028) NoM (RMI21_nom) C++17
9 / 100
500 ms 284 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> p;
int N, M;
bool sorted(vector<int> &v)
{
    for (int i = 0; i < (int)v.size() - 1; i++) {
        if (v[i] > v[i+1]) return false;
    }
    return true;
}
int pos[11];
int main()
{
    cin >> N >> M;
    for (int i = 1; i <= 2 * N; i++) p.push_back(i);
    int ans = 0;
    while (1) {
        for (int i = 0; i < 2 * N; i++) pos[p[i]] = i;
        bool ok = true;
        for (int i = 1; i <= N; i++) {
            ok &= (bool)((pos[i] - pos[i+N]) % M);
            if (!ok) break;
        }
        ans += ok;
        next_permutation(p.begin(), p.end());
        if (sorted(p)) {
            cout << ans << '\n';
            return 0;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 49 ms 236 KB Output is correct
10 Correct 100 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 49 ms 236 KB Output is correct
10 Correct 100 ms 284 KB Output is correct
11 Execution timed out 1083 ms 212 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 49 ms 236 KB Output is correct
10 Correct 100 ms 284 KB Output is correct
11 Execution timed out 1083 ms 212 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 49 ms 236 KB Output is correct
10 Correct 100 ms 284 KB Output is correct
11 Execution timed out 1083 ms 212 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 49 ms 236 KB Output is correct
10 Correct 100 ms 284 KB Output is correct
11 Execution timed out 1083 ms 212 KB Time limit exceeded
12 Halted 0 ms 0 KB -