QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426496#6319. Parallel Processing (Easy)by_chanceAC ✓1ms3976kbC++172.1kb2024-05-31 13:00:322024-05-31 13:00:33

Judging History

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

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

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: 1ms
memory: 3972kb

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: 3844kb

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: 0ms
memory: 3936kb

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: 3928kb

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: 3940kb

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: 3972kb

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: 3916kb

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: 0ms
memory: 3976kb

input:

9

output:

4
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

result:

ok AC

Test #9:

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

input:

10

output:

4
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

result:

ok AC

Test #10:

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

input:

11

output:

4
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

result:

ok AC

Test #11:

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

input:

12

output:

5
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

result:

ok AC

Test #12:

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

input:

13

output:

5
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
13 12 13
5 4 5
7 6 7
9 8 9
10 8 10
11 10 11
12 10 12
13 10 13
2000 2000 2000

result:

ok AC

Test #13:

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

input:

14

output:

6
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

result:

ok AC

Test #14:

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

input:

15

output:

6
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
15 14 15
2000 2000 2000

result:

ok AC

Test #15:

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

input:

16

output:

6
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

result:

ok AC