QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#99535#6320. Parallel Processing (Hard)SortingAC ✓2ms3516kbC++1.8kb2023-04-22 23:10:352023-04-22 23:10:37

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-22 23:10:37]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3516kb
  • [2023-04-22 23:10:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const ll mod=998244353;
typedef vector<ll> poly;
const int mb=18;//can change !!!!
int n,z;
pair<int,int>a[1000][4];
vector<int>frogs;
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	while(n%5!=1 && n%5!=3) n++;
	frogs.push_back(1);
	frogs.push_back(2);frogs.push_back(4);frogs.push_back(7);
	int cur=7;
	while(cur<=1000){
		cur+=4;
		frogs.push_back(cur);
	}
	if(n%5==1){
		int m=(n+9)/5;
		for(int i=1; i<=m ;i++){
			for(int j=1; j<min(i,4) ;j++){
				a[i-j][j]={frogs[i]-j,frogs[i]-j+1};
			}
			a[i][0]={frogs[i-1],frogs[i]};
		}
		a[m-2][3]={2,3};
		a[m-1][2]={4,5};
		a[m-1][3]={4,6};
		a[m][1]={7,8};
		a[m][2]={7,9};
		a[m][3]={7,10};
		int cur=a[m][0].se;
		for(int i=4; i<m ;i++){
			a[m+i-3][0]={cur,cur+1};cur++;
			for(int j=1; j<=3 ;j++){
				a[m+i-3][j]={frogs[i],frogs[i]+j};
			}
		}
		z=2*m-4;
	}
	else{
		int m=(n+12)/5;
		for(int i=1; i<=m ;i++){
			for(int j=1; j<min(i,4) ;j++){
				a[i-j][j]={frogs[i]-j,frogs[i]-j+1};
			}
			a[i][0]={frogs[i-1],frogs[i]};
		}
		a[m-2][3]={2,3};
		a[m-1][1]={7,8};
		a[m-1][2]={4,5};
		a[m-1][3]={4,6};
		a[m][1]={11,12};
		a[m][2]={7,9};
		a[m][3]={7,10};
		a[m][0].se--;
		a[m+1][1]={frogs[m-1],frogs[m-1]+1};
		a[m+1][0]={frogs[m-1],frogs[m-1]+2};
		a[m+1][2]={11,13};
		a[m+1][3]={11,14};
		int cur=a[m][0].se;
		for(int i=5; i<m-1 ;i++){
			a[m+i-3][0]={cur,cur+1};cur++;
			for(int j=1; j<=3 ;j++){
				a[m+i-3][j]={frogs[i],frogs[i]+j};
			}
		}
		z=2*m-5;
		
		
	}
	cout << z << '\n';
	for(int i=1; i<=z ;i++){
		for(int j=0; j<4 ;j++){
			cout << a[i][j].se << ' ' << a[i][j].fi << ' ' << a[i][j].se << '\n';
		}
		//cout << endl;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

17

output:

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

result:

ok AC

Test #2:

score: 0
Accepted
time: 2ms
memory: 3348kb

input:

18

output:

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

result:

ok AC

Test #3:

score: 0
Accepted
time: 2ms
memory: 3280kb

input:

19

output:

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

result:

ok AC

Test #4:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

20

output:

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

result:

ok AC

Test #5:

score: 0
Accepted
time: 2ms
memory: 3464kb

input:

21

output:

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

result:

ok AC

Test #6:

score: 0
Accepted
time: 2ms
memory: 3288kb

input:

120

output:

48
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 40...

result:

ok AC

Test #7:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

421

output:

168
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #8:

score: 0
Accepted
time: 2ms
memory: 3332kb

input:

464

output:

186
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #9:

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

input:

812

output:

325
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #10:

score: 0
Accepted
time: 2ms
memory: 3348kb

input:

862

output:

345
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #11:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

996

output:

398
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #12:

score: 0
Accepted
time: 2ms
memory: 3476kb

input:

997

output:

399
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #13:

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

input:

998

output:

399
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #14:

score: 0
Accepted
time: 2ms
memory: 3516kb

input:

999

output:

400
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC

Test #15:

score: 0
Accepted
time: 2ms
memory: 3420kb

input:

1000

output:

400
2 1 2
4 3 4
6 5 6
9 8 9
4 2 4
7 6 7
10 9 10
13 12 13
7 4 7
11 10 11
14 13 14
17 16 17
11 7 11
15 14 15
18 17 18
21 20 21
15 11 15
19 18 19
22 21 22
25 24 25
19 15 19
23 22 23
26 25 26
29 28 29
23 19 23
27 26 27
30 29 30
33 32 33
27 23 27
31 30 31
34 33 34
37 36 37
31 27 31
35 34 35
38 37 38
41 4...

result:

ok AC