QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#151850 | #6320. Parallel Processing (Hard) | Forever_Young# | WA | 1ms | 3920kb | C++14 | 2.7kb | 2023-08-27 14:47:13 | 2023-08-27 14:47:14 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
vector<array<int, 3> > ops;
const int L = 2000;
void _() {
ops.pb({L - 1, L, L});
}
int i;
void _(int c, int a, int b) {
ops.pb({i + c, i + a, i + b});
}
const bool debug = false;
int main() {
int n;
scanf("%d", &n);
for(i = 0; i < n; i += 16) {
int len = min(n, i + 16) - i;
if(i != 0) {
_(i, i - 1, i);
_();
_();
_();
}
if(len == 1) {
}else if(len == 2) {
_(2, 1, 2);
}else if(len <= 4) {
_(2, 1, 2);
_(4, 3, 4);
_();
_();
_(3, 2, 3);
_(4, 2, 4);
}else if(len <= 8) {
_(2, 1, 2);
_(4, 3, 4);
_(6, 5, 6);
_(8, 7, 8);
_(3, 2, 3);
_(4, 2, 4);
_(7, 6, 7);
_(8, 6, 8);
_(5, 4, 5);
_(6, 4, 6);
_(7, 4, 7);
_(8, 4, 8);
}else if(len <= 11) {
_(2, 1, 2);
_(4, 3, 4);
_(6, 5, 6);
_(9, 8, 9);
_(3, 2, 3);
_(4, 2, 4);
_(7, 6, 7);
_(10, 9, 10);
_(5, 4, 5);
_(6, 4, 6);
_(7, 4, 7);
_(11, 10, 11);
_(8, 7, 8);
_(9, 7, 9);
_(10, 7, 10);
_(11, 7, 11);
}else if(len <= 13) {
_(2, 1, 2);
_(5, 4, 5);
_(8, 7, 8);
_(11, 10, 11);
_(3, 2, 3);
_(6, 5, 6);
_(9, 8, 9);
_(12, 11, 12);
_(4, 3, 4);
_(5, 3, 5);
_(6, 3, 6);
_(13, 12, 13);
_(7, 6, 7);
_(8, 6, 8);
_(9, 6, 9);
_();
_(10, 9, 10);
_(11, 9, 11);
_(12, 9, 12);
_(13, 9, 13);
}else {
for(int d = 0; d < 3; d++) {
for(int e = 0; e < 4; e++) {
_(e * 4 + d + 2, e * 4 + d + 1, e * 4 + d + 2);
}
}
for(int d = 0; d < 3; d++) {
for(int e = 0; e < 4; e++) {
_((d + 1) * 4 + e + 1, (d + 1) * 4, (d + 1) * 4 + e + 1);
}
}
}
}
while(ops.size() % 4 != 0) {
_();
}
printf("%d\n", ops.size() / 4);
for(int i = 0; i < (int)ops.size(); i++) {
printf("%d %d %d\n", ops[i][0], ops[i][1], ops[i][2]);
}
if(debug) {
vector<vector<int> > vec(L);
for(int i = 0; i < L; i++) {
vec[i].pb(i);
}
printf("%d\n", vec[0].size());
for(int i = 0; i < (int)ops.size(); i += 4) {
for(int d = 0; d < 4; d++) {
for(int e = 0; e < 3; e++) {
ops[i + d][e]--;
}
}
vector<int> tmp[4];
for(int d = 0; d < 4; d++) {
if(ops[i + d][0] == L - 2) continue;
tmp[d] = vec[ops[i + d][1]];
tmp[d].insert(tmp[d].end(), all(vec[ops[i + d][2]]));
}
for(int d = 0; d < 4; d++) {
if(ops[i + d][0] == L - 2) continue;
vec[ops[i + d][0]] = move(tmp[d]);
}
}
for(int i = 0; i < n; i++) {
assert(vec[i].size() == i + 1);
for(int j = 0; j < i; j++) {
assert(vec[i][j] == j);
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3920kb
input:
17
output:
7 2 1 2 6 5 6 10 9 10 14 13 14 3 2 3 7 6 7 11 10 11 15 14 15 4 3 4 8 7 8 12 11 12 16 15 16 5 4 5 6 4 6 7 4 7 8 4 8 9 8 9 10 8 10 11 8 11 12 8 12 13 12 13 14 12 14 15 12 15 16 12 16 32 31 32 1999 2000 2000 1999 2000 2000 1999 2000 2000
result:
wrong answer A[17] is not (1, …, 17)