QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#68207 | #5176. 多控制反转 | Chinese_zjc_ | 0 | 0ms | 3524kb | C++14 | 1.6kb | 2022-12-15 10:35:13 | 2022-12-15 10:35:16 |
Judging History
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() == 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 += {1, ta};
res += {3, ta, tb, C};
res += {1, ta};
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
Runtime Error
Test #1:
score: 0
Runtime Error
input:
0 2 1 1
output:
result:
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Runtime Error
Test #13:
score: 0
Runtime Error
input:
0 2 1 4
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Wrong Answer
Test #20:
score: 0
Wrong Answer
time: 0ms
memory: 3524kb
input:
14 16 393 6
output:
176 1 15 3 15 6 14 1 15 1 13 3 13 5 6 1 13 1 12 3 12 4 5 1 12 1 11 3 11 3 4 1 11 1 10 3 10 2 3 1 10 1 9 3 9 1 2 1 9 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 1 9 3 9 1 2 1 9 1 10 3 10 2 3 1 10 1 11 3 11 3 4 1 11 1 12 3 12 4 5 1 ...
result:
wrong answer Wrong solution.
Subtask #7:
score: 0
Skipped
Dependency #2:
0%
Subtask #8:
score: 0
Skipped
Dependency #3:
0%