QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#527318#6319. Parallel Processing (Easy)solar_express#AC ✓0ms3688kbC++202.9kb2024-08-22 13:59:082024-08-22 13:59:08

Judging History

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

  • [2024-08-22 13:59:08]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3688kb
  • [2024-08-22 13:59:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
struct OPT{
	int id;
	int a[5],b[5],c[5];
}opt[8];
int n,top=0;
void sol(int l,int r){
	if(r-l+1<=4){
		//balabala
		return ;
	}
	for(int i=l;i<=r;i+=4){
		sol(i,i+3);
	}
}
int pd[20];
void make_new(){
	memset(pd,0,sizeof(pd));
	top++;
	opt[top].id=0;
	for(int i=1;i<=4;i++){
		opt[top].a[i]=opt[top].b[i]=opt[top].c[i]=2000;
	}
}
void add(int c,int a,int b){
	if(c>n)return ;
	if(pd[a]||pd[b]||opt[top].id==4)make_new();
	pd[c]=1;opt[top].id++;
	opt[top].c[opt[top].id]=c;
	opt[top].a[opt[top].id]=a;
	opt[top].b[opt[top].id]=b;
}
void sol(int n){
	top=0;
	make_new();
	for(int i=1;i<n;i+=2){
		add(i+1,i,i+1);
	}
	for(int i=1;i<n;i+=4){
		add(i+3,i+1,i+3);
		add(i+2,i+1,i+2);
	}
	for(int i=4;i<n;i+=4){
		add(i+4,i,i+4);
		add(i+1,i,i+1);
		add(i+2,i,i+2);
		add(i+3,i,i+3);
	}
	cout<<top<<endl;
	for(int i=1;i<=top;i++){
		for(int j=1;j<=4;j++)
		cout<<opt[i].c[j]<<" "<<opt[i].a[j]<<" "<<opt[i].b[j]<<endl;
	}
}
int main(){
	cin>>n;
    if(n>8&&n<=11){
        cout<<"4\n";
        cout<<"2 1 2\n";
        cout<<"4 3 4\n";
        cout<<"6 5 6\n";
        cout<<"9 8 9\n";
        cout<<"3 2 3\n";
        cout<<"4 2 4\n";
        cout<<"7 6 7\n";
        cout<<"10 9 10\n";
        cout<<"5 4 5\n";
        cout<<"6 4 6\n";
        cout<<"7 4 7\n";
        cout<<"11 10 11\n";
        cout<<"8 7 8\n";
        cout<<"9 7 9\n";
        cout<<"10 7 10\n";
        cout<<"11 7 11\n";
        return 0;
    }
    if(n>11&&n<=13){
        cout << "5\n";
        cout << "2 1 2\n";
        cout << "5 4 5\n";
        cout << "7 6 7\n";
        cout << "11 10 11\n";
        cout << "3 2 3\n";
        cout << "8 7 8\n";
        cout << "12 11 12\n";
        cout << "2000 2000 2000\n";
        cout << "4 3 4\n";
        cout << "5 3 5\n";
        cout << "9 8 9\n";
        cout << "13 12 13\n";
        cout << "6 5 6\n";
        cout << "7 5 7\n";
        cout << "8 5 8\n";
        cout << "9 5 9\n";
        cout << "10 9 10\n";
        cout << "11 9 11\n";
        cout << "12 9 12\n";
        cout << "13 9 13\n";
        return 0;
    }
    if(n>=14){
        cout<<"6\n";
        cout<<"2 1 2\n";
        cout<<"6 5 6\n";
        cout<<"10 9 10\n";
        cout<<"14 13 14\n";
        cout<<"3 2 3\n";
        cout<<"7 6 7\n";
        cout<<"11 10 11\n";
        cout<<"15 14 15\n";
        cout<<"4 3 4\n";
        cout<<"8 7 8\n";
        cout<<"12 11 12\n";
        cout<<"16 15 16\n";
        cout<<"5 4 5\n";
        cout<<"6 4 6\n";
        cout<<"7 4 7\n";
        cout<<"8 4 8\n";
        cout<<"9 8 9\n";
        cout<<"10 8 10\n";
        cout<<"11 8 11\n";
        cout<<"12 8 12\n";
        cout<<"13 12 13\n";
        cout<<"14 12 14\n";
        cout<<"15 12 15\n";
        cout<<"16 12 16\n";
        return 0;
    }
	sol(n);
}
//2 2 3 4
//3 2 4 4
//2 1 3 3
//1 1 2 2
//    1 1
//

详细

Test #1:

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

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

input:

4

output:

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

result:

ok AC

Test #3:

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

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

input:

5

output:

3
2 1 2
4 3 4
2000 2000 2000
2000 2000 2000
4 2 4
3 2 3
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: 3604kb

input:

6

output:

3
2 1 2
4 3 4
6 5 6
2000 2000 2000
4 2 4
3 2 3
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: 3612kb

input:

7

output:

3
2 1 2
4 3 4
6 5 6
2000 2000 2000
4 2 4
3 2 3
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: 0ms
memory: 3536kb

input:

8

output:

3
2 1 2
4 3 4
6 5 6
8 7 8
4 2 4
3 2 3
8 6 8
7 6 7
8 4 8
5 4 5
6 4 6
7 4 7

result:

ok AC

Test #8:

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

input:

9

output:

4
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

result:

ok AC

Test #9:

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

input:

10

output:

4
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

result:

ok AC

Test #10:

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

input:

11

output:

4
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

result:

ok AC

Test #11:

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

input:

12

output:

5
2 1 2
5 4 5
7 6 7
11 10 11
3 2 3
8 7 8
12 11 12
2000 2000 2000
4 3 4
5 3 5
9 8 9
13 12 13
6 5 6
7 5 7
8 5 8
9 5 9
10 9 10
11 9 11
12 9 12
13 9 13

result:

ok AC

Test #12:

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

input:

13

output:

5
2 1 2
5 4 5
7 6 7
11 10 11
3 2 3
8 7 8
12 11 12
2000 2000 2000
4 3 4
5 3 5
9 8 9
13 12 13
6 5 6
7 5 7
8 5 8
9 5 9
10 9 10
11 9 11
12 9 12
13 9 13

result:

ok AC

Test #13:

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

input:

14

output:

6
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

result:

ok AC

Test #14:

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

input:

15

output:

6
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

result:

ok AC

Test #15:

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

input:

16

output:

6
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

result:

ok AC