QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#68208#5176. 多控制反转Chinese_zjc_0 2ms3484kbC++141.6kb2022-12-15 10:38:162022-12-15 10:38:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-15 10:38:17]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:3484kb
  • [2022-12-15 10:38:16]
  • 提交

answer

// This Code was made by Chinese_zjc_.
#include <bits/stdc++.h>
// #define debug
int n, m, q, c;
typedef std::vector<std::vector<int>> string;
string &operator+=(string &A, const string &B)
{
    A.insert(A.end(), B.begin(), B.end());
    return A;
}
string &operator+=(string &A, const std::vector<int> &B)
{
    A.push_back(B);
    return A;
}
string f(std::vector<int> A, std::vector<int> B, int C)
{
    if (A.size() == 0)
        return {{1, C}};
    if (A.size() == 1)
        return {{2, A[0], C}};
    if (A.size() == 2)
        return {{3, A[0], A[1], C}};
    int ta = A.back(), tb = B.back();
    A.pop_back();
    B.pop_back();
    string res;
    res += {3, ta, tb, C};
    res += f(A, B, tb);
    res += {3, ta, tb, C};
    return res;
}
string work(std::vector<int> A, std::vector<int> B, int C)
{
    string res = f(A, B, C);
    for (int i = res.size(); i--;)
        if (res[i].back() != C)
            res.push_back(res[i]);
    return res;
}
signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin >> n >> m >> q >> c;
    std::vector<int> a(n >> 1), b((n + 1) >> 1);
    std::iota(a.begin(), a.end(), 0);
    std::iota(b.begin(), b.end(), a.size());
    string ans;
    b.push_back(n + 1);
    ans += work(b, a, n);
    b.pop_back();
    ans += work(a, b, n + 1);
    b.push_back(n + 1);
    ans += work(b, a, n);
    b.pop_back();
    ans += work(a, b, n + 1);
    std::cout << ans.size() << std::endl;
    for (auto i : ans)
        for (std::size_t j = 0; j != i.size(); ++j)
            std::cout << i[j] << " \n"[j + 1 == i.size()];
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3332kb

input:

0 2 1 1

output:

4
2 1 0
1 1
2 1 0
1 1

result:

wrong answer Integer 4 violates the range [0, 1]

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #13:

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

input:

0 2 1 4

output:

4
2 1 0
1 1
2 1 0
1 1

result:

wrong answer Integer 4 violates the range [0, 1]

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Wrong Answer

Test #20:

score: 10
Accepted
time: 2ms
memory: 3344kb

input:

14 16 393 6

output:

88
3 15 6 14
3 13 5 6
3 12 4 5
3 11 3 4
3 10 2 3
3 9 1 2
3 7 8 1
3 9 1 2
3 10 2 3
3 11 3 4
3 12 4 5
3 13 5 6
3 15 6 14
3 13 5 6
3 12 4 5
3 11 3 4
3 10 2 3
3 9 1 2
3 7 8 1
3 9 1 2
3 10 2 3
3 11 3 4
3 12 4 5
3 13 5 6
3 6 13 15
3 5 12 13
3 4 11 12
3 3 10 11
3 2 9 10
3 0 1 9
3 2 9 10
3 3 10 11
3 4 11 12...

result:

ok OK.

Test #21:

score: 0
Accepted
time: 2ms
memory: 3484kb

input:

39 41 1093 6

output:

288
3 40 18 39
3 38 17 18
3 37 16 17
3 36 15 16
3 35 14 15
3 34 13 14
3 33 12 13
3 32 11 12
3 31 10 11
3 30 9 10
3 29 8 9
3 28 7 8
3 27 6 7
3 26 5 6
3 25 4 5
3 24 3 4
3 23 2 3
3 22 1 2
3 21 0 1
3 19 20 0
3 21 0 1
3 22 1 2
3 23 2 3
3 24 3 4
3 25 4 5
3 26 5 6
3 27 6 7
3 28 7 8
3 29 8 9
3 30 9 10
3 31 ...

result:

ok OK.

Test #22:

score: -10
Wrong Answer
time: 2ms
memory: 3324kb

input:

0 2 1 6

output:

4
2 1 0
1 1
2 1 0
1 1

result:

wrong answer Integer 4 violates the range [0, 1]

Subtask #7:

score: 0
Skipped

Dependency #2:

0%

Subtask #8:

score: 0
Skipped

Dependency #3:

0%