QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202881#5532. KangarooCamillus#0 1ms3472kbC++201.2kb2023-10-06 13:55:472024-07-04 02:16:58

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 02:16:58]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3472kb
  • [2023-10-06 13:55:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

signed main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#else
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, s, f;
    cin >> n >> s >> f;
    s--, f--;
    vector<int> p(n);
    iota(p.begin(), p.end(), 0);
    int cnt = 0;
    do {
        bool ok = true;
        for (int i = 0; i < n; i++) {
            if (p[i] == i) {
                ok = false;
            }
        }
        if (!ok) {
            continue;
        }

        int x = 0;
        int y = p[x];
        int c = 1;
        while (y != x) {
            y = p[y];
            c++;
        }
        
        if (c != n) {
            continue;
        }

        for (int i = 0; i < n; i++) {
            if (i == f) {
                continue;
            }
            if (p[i] < i) {
                ok &= p[p[i]] > p[i];
            }
            if (p[i] > i) {
                ok &= p[p[i]] < p[i];
            }
        }
        cnt += ok;
    } while (next_permutation(p.begin(), p.end()));

    cout << cnt << '\n';
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3472kb

input:

7 3 6

output:

45

result:

wrong answer 1st numbers differ - expected: '14', found: '45'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%