QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#312047#6319. Parallel Processing (Easy)PlentyOfPenalty#WA 1ms3720kbC++202.5kb2024-01-23 11:28:542024-01-23 11:28:54

Judging History

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

  • [2024-01-23 11:28:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3720kb
  • [2024-01-23 11:28:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 9;
struct atom {
    int l, r;
    atom operator+(const atom &rhs) const {
        assert(r + 1 == rhs.l);
        return {l, rhs.r};
    }
} a[N], c[4];
int n;
struct oper {
    int a, b, c;
    bool ok() const { return a && b && c && a <= n && b <= n && c <= n; }
};
vector<array<oper, 4>> ans;
void take(const array<oper, 4> &op) {
    // cerr << "! " << op[0].a << " " << op[0].b << " " << op[0].c << endl;
    for (int i = 0; i < 4; i++)
        if (op[i].ok()) c[i] = a[op[i].a] + a[op[i].b];
    for (int i = 0; i < 4; i++)
        if (op[i].ok()) a[op[i].c] = c[i];
    ans.push_back(op);
}
int main() {
#ifdef popteam
    freopen("C.in", "r", stdin);
#endif
    for (int i = 0; i < N; i++)
        a[i].l = a[i].r = i;
    cin.tie(0)->sync_with_stdio(0);
    cin >> n;
    array<oper, 4> ops[] = {
        {
            oper{1, 2, 2},
            oper{3, 4, 4},
            oper{5, 6, 6},
            oper{7, 8, 8},
        },
        {
            oper{2, 3, 3},
            oper{2, 4, 4},
            oper{6, 7, 7},
            oper{6, 8, 8},
        },
        {
            oper{4, 5, 5},
            oper{4, 6, 6},
            oper{4, 7, 7},
            oper{4, 8, 8},
        },
    };
    if (n >= 2) take(ops[0]);
    if (n >= 3) take(ops[1]);
    if (n >= 5) take(ops[2]);
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 4; j++) {
            ops[i][j].a += 8;
            ops[i][j].b += 8;
            ops[i][j].c += 8;
        }
    if (n >= 9) {
        if (n >= 2 + 8) take(ops[0]);
        if (n >= 3 + 8) take(ops[1]);
        if (n >= 5 + 8) take(ops[2]);
        take({
            oper{8, 9, 9},
            oper{8, 10, 10},
            oper{8, 11, 11},
            oper{8, 12, 12},
        });
        if (n >= 13) {
            take({
                oper{8, 13, 13},
                oper{8, 14, 14},
                oper{8, 15, 15},
                oper{8, 16, 16},
            });
        }
    }
    cout << ans.size() << endl;
    for (const auto &op : ans)
        for (int i = 0; i < 4; i++)
            if (op[i].ok()) {
                cout << op[i].b << " " << op[i].a << " " << op[i].c << endl;
            } else {
                cout << "2000 2000 2000" << endl;
            }
    for (int i = 1; i <= n; i++) {
        assert(a[i].l == 1 && a[i].r == i);
    }
    cerr << "size = " << ans.size() << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3656kb

input:

2

output:

1
2 1 2
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #2:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

4

output:

2
2 1 2
4 3 4
2000 2000 2000
2000 2000 2000
3 2 3
4 2 4
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #3:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

3

output:

2
2 1 2
2000 2000 2000
2000 2000 2000
2000 2000 2000
3 2 3
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #4:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

5

output:

3
2 1 2
4 3 4
2000 2000 2000
2000 2000 2000
3 2 3
4 2 4
2000 2000 2000
2000 2000 2000
5 4 5
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #5:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

6

output:

3
2 1 2
4 3 4
6 5 6
2000 2000 2000
3 2 3
4 2 4
2000 2000 2000
2000 2000 2000
5 4 5
6 4 6
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #6:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

7

output:

3
2 1 2
4 3 4
6 5 6
2000 2000 2000
3 2 3
4 2 4
7 6 7
2000 2000 2000
5 4 5
6 4 6
7 4 7
2000 2000 2000

result:

ok AC

Test #7:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

8

output:

3
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

result:

ok AC

Test #8:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

9

output:

4
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
9 8 9
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #9:

score: -100
Wrong Answer
time: 1ms
memory: 3656kb

input:

10

output:

5
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
10 9 10
2000 2000 2000
2000 2000 2000
2000 2000 2000
9 8 9
10 8 10
2000 2000 2000
2000 2000 2000

result:

wrong answer L = 5 is larger than 4