QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426497#6320. Parallel Processing (Hard)by_chanceAC ✓1ms3976kbC++172.1kb2024-05-31 13:00:442024-05-31 13:00:44

Judging History

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

  • [2024-05-31 13:00:44]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3976kb
  • [2024-05-31 13:00:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2000;
int n,k;tuple<int,int,int> ans[N];
void solve(int n){
    if(n>=17){
        solve(n-10);
        auto add=[&](int a,int b,int c){
            ans[++k]={n+a-11,n+b-11,n+c-11};
        };
        add(2,1,2);add(4,3,4);add(6,5,6);add(8,7,8);
        add(10,9,10);add(3,2,3);add(4,2,4);add(8,6,8);
        add(5,4,5);add(6,4,6);add(8,4,8);add(11,10,11);
        add(7,6,7);add(9,8,9);add(10,8,10);add(11,8,11);
        return;
    }
    auto add=[&](int a,int b,int c){
        if(a>n||b>n||c>n)ans[++k]={N,N,N};
        else ans[++k]={a,b,c};
    };
    if(n==1);
    else if(n==2){add(2,1,2);add(N,N,N);add(N,N,N);add(N,N,N);}
    else if(n<=4){
        add(2,1,2);add(4,3,4);add(N,N,N);add(N,N,N);
        add(3,2,3);add(4,2,4);add(N,N,N);add(N,N,N);
    }
    else if(n<=8){
        add(2,1,2);add(4,3,4);add(6,5,6);add(8,7,8);
        add(3,2,3);add(4,2,4);add(7,6,7);add(8,6,8);
        add(5,4,5);add(6,4,6);add(7,4,7);add(8,4,8);
    }
    else if(n<=11){
        add(2,1,2);add(4,3,4);add(6,5,6);add(8,7,8);
        add(10,9,10);add(3,2,3);add(4,2,4);add(8,6,8);
        add(5,4,5);add(6,4,6);add(8,4,8);add(11,10,11);
        add(7,6,7);add(9,8,9);add(10,8,10);add(11,8,11);
    }
    else if(n<=13){
        add(2,1,2);add(4,3,4);add(6,5,6);add(8,7,8);
        add(4,2,4);add(8,6,8);add(10,9,10);add(12,11,12);
        add(3,2,3);add(6,4,6);add(8,4,8);add(13,12,13);
        add(5,4,5);add(7,6,7);add(9,8,9);add(10,8,10);
        add(11,10,11);add(12,10,12);add(13,10,13);add(N,N,N);
    }
    else if(n<=16){
        add(2,1,2);add(4,3,4);add(6,5,6);add(8,7,8);
        add(4,2,4);add(8,6,8);add(10,9,10);add(12,11,12);
        add(6,4,6);add(8,4,8);add(14,13,14);add(16,15,16);
        add(3,2,3);add(5,4,5);add(10,8,10);add(14,12,14);
        add(7,6,7);add(9,8,9);add(12,10,12);add(14,10,14);
        add(11,10,11);add(13,12,13);add(15,14,15);add(16,14,16);
    }
}
int main(){
    scanf("%d",&n);solve(n);
    printf("%d\n",k/4);
    for(int i=1;i<=k;i++)
        printf("%d %d %d\n",get<0>(ans[i]),get<1>(ans[i]),get<2>(ans[i]));
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3744kb

input:

17

output:

7
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
8 7 8
10 9 10
12 11 12
14 13 14
16 15 16
9 8 9
10 8 10
14 12 14
11 10 11
12 10 12
14 10 14
17 16 17
13 12 13
15 14 15
16 14 16
17 14 17

result:

ok AC

Test #2:

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

input:

18

output:

7
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
11 10 11
13 12 13
15 14 15
17 16 17
10 9 10
11 9 11
15 13 15
12 11 12
13 11 13
15 11 15
18 17 18
14 13 14
16 15 16
17 15 17
18 15 18

result:

ok AC

Test #3:

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

input:

19

output:

8
2 1 2
4 3 4
6 5 6
8 7 8
2000 2000 2000
3 2 3
4 2 4
8 6 8
5 4 5
6 4 6
8 4 8
2000 2000 2000
7 6 7
9 8 9
2000 2000 2000
2000 2000 2000
10 9 10
12 11 12
14 13 14
16 15 16
18 17 18
11 10 11
12 10 12
16 14 16
13 12 13
14 12 14
16 12 16
19 18 19
15 14 15
17 16 17
18 16 18
19 16 19

result:

ok AC

Test #4:

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

input:

20

output:

8
2 1 2
4 3 4
6 5 6
8 7 8
10 9 10
3 2 3
4 2 4
8 6 8
5 4 5
6 4 6
8 4 8
2000 2000 2000
7 6 7
9 8 9
10 8 10
2000 2000 2000
11 10 11
13 12 13
15 14 15
17 16 17
19 18 19
12 11 12
13 11 13
17 15 17
14 13 14
15 13 15
17 13 17
20 19 20
16 15 16
18 17 18
19 17 19
20 17 20

result:

ok AC

Test #5:

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

input:

21

output:

8
2 1 2
4 3 4
6 5 6
8 7 8
10 9 10
3 2 3
4 2 4
8 6 8
5 4 5
6 4 6
8 4 8
11 10 11
7 6 7
9 8 9
10 8 10
11 8 11
12 11 12
14 13 14
16 15 16
18 17 18
20 19 20
13 12 13
14 12 14
18 16 18
15 14 15
16 14 16
18 14 18
21 20 21
17 16 17
19 18 19
20 18 20
21 18 21

result:

ok AC

Test #6:

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

input:

120

output:

48
2 1 2
4 3 4
6 5 6
8 7 8
10 9 10
3 2 3
4 2 4
8 6 8
5 4 5
6 4 6
8 4 8
2000 2000 2000
7 6 7
9 8 9
10 8 10
2000 2000 2000
11 10 11
13 12 13
15 14 15
17 16 17
19 18 19
12 11 12
13 11 13
17 15 17
14 13 14
15 13 15
17 13 17
20 19 20
16 15 16
18 17 18
19 17 19
20 17 20
21 20 21
23 22 23
25 24 25
27 26 27...

result:

ok AC

Test #7:

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

input:

421

output:

168
2 1 2
4 3 4
6 5 6
8 7 8
10 9 10
3 2 3
4 2 4
8 6 8
5 4 5
6 4 6
8 4 8
11 10 11
7 6 7
9 8 9
10 8 10
11 8 11
12 11 12
14 13 14
16 15 16
18 17 18
20 19 20
13 12 13
14 12 14
18 16 18
15 14 15
16 14 16
18 14 18
21 20 21
17 16 17
19 18 19
20 18 20
21 18 21
22 21 22
24 23 24
26 25 26
28 27 28
30 29 30
23...

result:

ok AC

Test #8:

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

input:

464

output:

186
2 1 2
4 3 4
6 5 6
8 7 8
4 2 4
8 6 8
10 9 10
12 11 12
6 4 6
8 4 8
14 13 14
2000 2000 2000
3 2 3
5 4 5
10 8 10
14 12 14
7 6 7
9 8 9
12 10 12
14 10 14
11 10 11
13 12 13
2000 2000 2000
2000 2000 2000
15 14 15
17 16 17
19 18 19
21 20 21
23 22 23
16 15 16
17 15 17
21 19 21
18 17 18
19 17 19
21 17 21
2...

result:

ok AC

Test #9:

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

input:

812

output:

325
2 1 2
4 3 4
6 5 6
8 7 8
4 2 4
8 6 8
10 9 10
12 11 12
3 2 3
6 4 6
8 4 8
2000 2000 2000
5 4 5
7 6 7
9 8 9
10 8 10
11 10 11
12 10 12
2000 2000 2000
2000 2000 2000
13 12 13
15 14 15
17 16 17
19 18 19
21 20 21
14 13 14
15 13 15
19 17 19
16 15 16
17 15 17
19 15 19
22 21 22
18 17 18
20 19 20
21 19 21
2...

result:

ok AC

Test #10:

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

input:

862

output:

345
2 1 2
4 3 4
6 5 6
8 7 8
4 2 4
8 6 8
10 9 10
12 11 12
3 2 3
6 4 6
8 4 8
2000 2000 2000
5 4 5
7 6 7
9 8 9
10 8 10
11 10 11
12 10 12
2000 2000 2000
2000 2000 2000
13 12 13
15 14 15
17 16 17
19 18 19
21 20 21
14 13 14
15 13 15
19 17 19
16 15 16
17 15 17
19 15 19
22 21 22
18 17 18
20 19 20
21 19 21
2...

result:

ok AC

Test #11:

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

input:

996

output:

398
2 1 2
4 3 4
6 5 6
8 7 8
4 2 4
8 6 8
10 9 10
12 11 12
6 4 6
8 4 8
14 13 14
16 15 16
3 2 3
5 4 5
10 8 10
14 12 14
7 6 7
9 8 9
12 10 12
14 10 14
11 10 11
13 12 13
15 14 15
16 14 16
17 16 17
19 18 19
21 20 21
23 22 23
25 24 25
18 17 18
19 17 19
23 21 23
20 19 20
21 19 21
23 19 23
26 25 26
22 21 22
2...

result:

ok AC

Test #12:

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

input:

997

output:

399
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
8 7 8
10 9 10
12 11 12
14 13 14
16 15 16
9 8 9
10 8 10
14 12 14
11 10 11
12 10 12
14 10 14
17 16 17
13 12 13
15 14 15
16 14 16
17 14 17
18 17 18
20 19 20
22 21 22
24 23 24
26 25 26
19 18 19
20 18 2...

result:

ok AC

Test #13:

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

input:

998

output:

399
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
11 10 11
13 12 13
15 14 15
17 16 17
10 9 10
11 9 11
15 13 15
12 11 12
13 11 13
15 11 15
18 17 18
14 13 14
16 15 16
17 15 17
18 15 18
19 18 19
21 20 21
23 22 23
25 24 25
27 26 27
20 19 20
21 19 21
25 23 25
22 21 22
23 2...

result:

ok AC

Test #14:

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

input:

999

output:

400
2 1 2
4 3 4
6 5 6
8 7 8
2000 2000 2000
3 2 3
4 2 4
8 6 8
5 4 5
6 4 6
8 4 8
2000 2000 2000
7 6 7
9 8 9
2000 2000 2000
2000 2000 2000
10 9 10
12 11 12
14 13 14
16 15 16
18 17 18
11 10 11
12 10 12
16 14 16
13 12 13
14 12 14
16 12 16
19 18 19
15 14 15
17 16 17
18 16 18
19 16 19
20 19 20
22 21 22
24 ...

result:

ok AC

Test #15:

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

input:

1000

output:

400
2 1 2
4 3 4
6 5 6
8 7 8
10 9 10
3 2 3
4 2 4
8 6 8
5 4 5
6 4 6
8 4 8
2000 2000 2000
7 6 7
9 8 9
10 8 10
2000 2000 2000
11 10 11
13 12 13
15 14 15
17 16 17
19 18 19
12 11 12
13 11 13
17 15 17
14 13 14
15 13 15
17 13 17
20 19 20
16 15 16
18 17 18
19 17 19
20 17 20
21 20 21
23 22 23
25 24 25
27 26 2...

result:

ok AC