QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#123788 | #5176. 多控制反转 | pandapythoner# | 0 | 1ms | 3780kb | C++14 | 2.2kb | 2023-07-13 17:20:54 | 2024-07-04 00:37:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define flt double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#ifdef LOCAL
// #define _GLIBCXX_DEBUG
bool local = true;
#else
bool local = false;
#endif
mt19937 rnd(234);
const ll inf = 1e18;
struct operation{
int t, x, y, z;
operation(){}
operation(int t, int x, int y, int z) : t(t), x(x), y(y), z(z) {}
};
ostream& operator<<(ostream &out, operation &op){
out << op.t << " " << op.x;
if(op.t >= 2){
out << " " << op.y;
}
if(op.t >= 3){
out << " " << op.z;
}
return out;
}
int n, m, Q, subgroup;
vector<operation> rs;
void add_op(int t, int x, int y = 0, int z = 0){
rs.emplace_back(t, x, y, z);
}
void solve_12(){
rs.clear();
add_op(2, 0, n + 1);
for(int i = 1; i < n; i += 1){
add_op(3, i, n + i, n + i + 1);
}
add_op(2, 2 * n, n);
for(int i = n - 1; i >= 1; i -= 1){
add_op(3, i, n + i, n + i + 1);
}
add_op(2, 0, n + 1);
}
vector<int> make_operations(vector<int> t){
for(auto op: rs){
if(op.t == 1){
t[op.x] ^= 1;
} else if(op.t == 2 && t[op.x]){
t[op.y] ^= 1;
} else if(op.t == 3 && t[op.x] && t[op.y]){
t[op.z] ^= 1;
}
}
return t;
}
int32_t main(){
if(!local){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int t = 1;
if(local){
t = 1000;
}
while(t--){
cin >> n >> m >> Q >> subgroup;
vector<int> t(m);
if(local){
for(int i = 0; i < m; i += 1){
cin >> t[i];
}
}
if(subgroup == 1 || subgroup == 2){
solve_12();
}
cout << rs.size() << "\n";
for(auto x: rs){
cout << x << "\n";
}
if(local){
auto nt = make_operations(t);
for(int i = 0; i < m; i += 1){
cout << nt[i] << " ";
}
cout << "\n";
}
}
return 0;
}
/*
2 6 100 1
0 1 1 0 0 0
*/
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3780kb
input:
0 2 1 1
output:
3 2 0 1 2 0 0 2 0 1
result:
wrong answer Integer 3 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: 3596kb
input:
0 2 1 4
output:
0
result:
wrong answer Wrong solution.
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Wrong Answer
Test #20:
score: 0
Wrong Answer
time: 1ms
memory: 3484kb
input:
14 16 393 6
output:
0
result:
wrong answer Wrong solution.
Subtask #7:
score: 0
Skipped
Dependency #2:
0%
Subtask #8:
score: 0
Skipped
Dependency #3:
0%