QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#310602#5419. TrianglesOFforest_1273AC ✓1ms3880kbC++142.2kb2024-01-21 16:01:092024-01-21 16:01:09

Judging History

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

  • [2024-01-21 16:01:09]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3880kb
  • [2024-01-21 16:01:09]
  • 提交

answer

#include<bits/stdc++.h>
#define PII pair<int,int>
#define lim 1e7
using namespace std;
inline int read(){int s=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9')s=(s<<1)+(s<<3)+(c^48),c=getchar();return s*f;}
const int N=2010;
int n,l,r;
struct Point{
    int x,y;
    friend Point operator + (Point a,Point b){return {a.x+b.x,a.y+b.y};}
    friend Point operator * (Point a,int k){return {a.x*k,a.y*k};}
    friend Point operator / (Point a,int k){return {a.x/k,a.y/k};}
};
struct Tri{
    Point a,b,c;
}q[N];
int main(){
    n=read(),l=1,r=0;
    if(n<8){printf("No\n");return 0;}
    printf("Yes\n");
    if(!(n%3)){/*构造三角形*/
        n-=9;
        q[++r]={{0,100},{42,70},{55,100}};
		q[++r]={{0,100},{70,50},{0,0}};
		q[++r]={{0,0},{70,50},{100,0}};
		q[++r]={{100,0},{70,50},{100,60}};
		q[++r]={{100,60},{70,75},{100,100}};
		q[++r]={{100,100},{55,100},{70,75}};
		q[++r]={{55,100},{70,75},{42,70}};
		q[++r]={{42,70},{70,50},{70,75}};
		q[++r]={{70,50},{100,60},{70,75}};
    }else if(n%3==1){
        n-=10;
        q[++r]={{0,0},{40,0},{30,18}};
		q[++r]={{30,18},{50,14},{40,0}};
		q[++r]={{40,0},{50,14},{60,0}};
		q[++r]={{60,0},{50,14},{70,18}};
		q[++r]={{60,0},{70,18},{100,0}};
		q[++r]={{30,18},{50,14},{50,30}};
		q[++r]={{50,30},{70,18},{50,14}};
		q[++r]={{0,0},{50,30},{0,100}};
		q[++r]={{0,100},{100,100},{50,30}};
		q[++r]={{100,100},{50,30},{100,0}};
    }else{
        n-=8;
        q[++r]={{0,0},{45,20},{50,0}};
		q[++r]={{45,20},{50,0},{55,20}};
		q[++r]={{50,0},{55,20},{100,0}};
		q[++r]={{0,0},{0,100},{45,20}};
		q[++r]={{0,100},{45,20},{50,100}};
		q[++r]={{50,100},{45,20},{55,20}};
		q[++r]={{50,100},{100,100},{55,20}};
		q[++r]={{100,100},{55,20},{100,0}};
    }
    for(int i=l;i<=r;++i)q[i].a=q[i].a*lim,q[i].b=q[i].b*lim,q[i].c=q[i].c*lim;
    while(n){
        n-=3;
        Tri hd=q[l];++l;
        Point ma=(hd.a+hd.b)/2,mb=(hd.b+hd.c)/2,mc=(hd.a+hd.c)/2;
        q[++r]={ma,mb,mc},q[++r]={hd.a,ma,mc},q[++r]={hd.b,mb,ma},q[++r]={hd.c,mb,mc};
    }
    for(int i=l;i<=r;++i)printf("%d %d %d %d %d %d\n",q[i].a.x,q[i].a.y,q[i].b.x,q[i].b.y,q[i].c.x,q[i].c.y);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

No

result:

ok no solution

Test #2:

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

input:

24

output:

Yes
1000000000 1000000000 550000000 1000000000 700000000 750000000
550000000 1000000000 700000000 750000000 420000000 700000000
420000000 700000000 700000000 500000000 700000000 750000000
700000000 500000000 1000000000 600000000 700000000 750000000
210000000 850000000 485000000 850000000 275000000 1...

result:

ok 24 acute triangles

Test #3:

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

input:

1

output:

No

result:

ok no solution

Test #4:

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

input:

3

output:

No

result:

ok no solution

Test #5:

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

input:

4

output:

No

result:

ok no solution

Test #6:

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

input:

5

output:

No

result:

ok no solution

Test #7:

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

input:

6

output:

No

result:

ok no solution

Test #8:

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

input:

7

output:

No

result:

ok no solution

Test #9:

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

input:

8

output:

Yes
0 0 450000000 200000000 500000000 0
450000000 200000000 500000000 0 550000000 200000000
500000000 0 550000000 200000000 1000000000 0
0 0 0 1000000000 450000000 200000000
0 1000000000 450000000 200000000 500000000 1000000000
500000000 1000000000 450000000 200000000 550000000 200000000
500000000 1...

result:

ok 8 acute triangles

Test #10:

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

input:

9

output:

Yes
0 1000000000 420000000 700000000 550000000 1000000000
0 1000000000 700000000 500000000 0 0
0 0 700000000 500000000 1000000000 0
1000000000 0 700000000 500000000 1000000000 600000000
1000000000 600000000 700000000 750000000 1000000000 1000000000
1000000000 1000000000 550000000 1000000000 70000000...

result:

ok 9 acute triangles

Test #11:

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

input:

10

output:

Yes
0 0 400000000 0 300000000 180000000
300000000 180000000 500000000 140000000 400000000 0
400000000 0 500000000 140000000 600000000 0
600000000 0 500000000 140000000 700000000 180000000
600000000 0 700000000 180000000 1000000000 0
300000000 180000000 500000000 140000000 500000000 300000000
5000000...

result:

ok 10 acute triangles

Test #12:

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

input:

11

output:

Yes
450000000 200000000 500000000 0 550000000 200000000
500000000 0 550000000 200000000 1000000000 0
0 0 0 1000000000 450000000 200000000
0 1000000000 450000000 200000000 500000000 1000000000
500000000 1000000000 450000000 200000000 550000000 200000000
500000000 1000000000 1000000000 1000000000 5500...

result:

ok 11 acute triangles

Test #13:

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

input:

12

output:

Yes
0 1000000000 700000000 500000000 0 0
0 0 700000000 500000000 1000000000 0
1000000000 0 700000000 500000000 1000000000 600000000
1000000000 600000000 700000000 750000000 1000000000 1000000000
1000000000 1000000000 550000000 1000000000 700000000 750000000
550000000 1000000000 700000000 750000000 4...

result:

ok 12 acute triangles

Test #14:

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

input:

13

output:

Yes
300000000 180000000 500000000 140000000 400000000 0
400000000 0 500000000 140000000 600000000 0
600000000 0 500000000 140000000 700000000 180000000
600000000 0 700000000 180000000 1000000000 0
300000000 180000000 500000000 140000000 500000000 300000000
500000000 300000000 700000000 180000000 500...

result:

ok 13 acute triangles

Test #15:

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

input:

14

output:

Yes
500000000 0 550000000 200000000 1000000000 0
0 0 0 1000000000 450000000 200000000
0 1000000000 450000000 200000000 500000000 1000000000
500000000 1000000000 450000000 200000000 550000000 200000000
500000000 1000000000 1000000000 1000000000 550000000 200000000
1000000000 1000000000 550000000 2000...

result:

ok 14 acute triangles

Test #16:

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

input:

15

output:

Yes
0 0 700000000 500000000 1000000000 0
1000000000 0 700000000 500000000 1000000000 600000000
1000000000 600000000 700000000 750000000 1000000000 1000000000
1000000000 1000000000 550000000 1000000000 700000000 750000000
550000000 1000000000 700000000 750000000 420000000 700000000
420000000 70000000...

result:

ok 15 acute triangles

Test #17:

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

input:

16

output:

Yes
400000000 0 500000000 140000000 600000000 0
600000000 0 500000000 140000000 700000000 180000000
600000000 0 700000000 180000000 1000000000 0
300000000 180000000 500000000 140000000 500000000 300000000
500000000 300000000 700000000 180000000 500000000 140000000
0 0 500000000 300000000 0 100000000...

result:

ok 16 acute triangles

Test #18:

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

input:

17

output:

Yes
0 0 0 1000000000 450000000 200000000
0 1000000000 450000000 200000000 500000000 1000000000
500000000 1000000000 450000000 200000000 550000000 200000000
500000000 1000000000 1000000000 1000000000 550000000 200000000
1000000000 1000000000 550000000 200000000 1000000000 0
225000000 100000000 475000...

result:

ok 17 acute triangles

Test #19:

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

input:

18

output:

Yes
1000000000 0 700000000 500000000 1000000000 600000000
1000000000 600000000 700000000 750000000 1000000000 1000000000
1000000000 1000000000 550000000 1000000000 700000000 750000000
550000000 1000000000 700000000 750000000 420000000 700000000
420000000 700000000 700000000 500000000 700000000 75000...

result:

ok 18 acute triangles

Test #20:

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

input:

19

output:

Yes
600000000 0 500000000 140000000 700000000 180000000
600000000 0 700000000 180000000 1000000000 0
300000000 180000000 500000000 140000000 500000000 300000000
500000000 300000000 700000000 180000000 500000000 140000000
0 0 500000000 300000000 0 1000000000
0 1000000000 1000000000 1000000000 5000000...

result:

ok 19 acute triangles

Test #21:

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

input:

20

output:

Yes
0 1000000000 450000000 200000000 500000000 1000000000
500000000 1000000000 450000000 200000000 550000000 200000000
500000000 1000000000 1000000000 1000000000 550000000 200000000
1000000000 1000000000 550000000 200000000 1000000000 0
225000000 100000000 475000000 100000000 250000000 0
0 0 2250000...

result:

ok 20 acute triangles

Test #22:

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

input:

21

output:

Yes
1000000000 600000000 700000000 750000000 1000000000 1000000000
1000000000 1000000000 550000000 1000000000 700000000 750000000
550000000 1000000000 700000000 750000000 420000000 700000000
420000000 700000000 700000000 500000000 700000000 750000000
700000000 500000000 1000000000 600000000 70000000...

result:

ok 21 acute triangles

Test #23:

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

input:

22

output:

Yes
600000000 0 700000000 180000000 1000000000 0
300000000 180000000 500000000 140000000 500000000 300000000
500000000 300000000 700000000 180000000 500000000 140000000
0 0 500000000 300000000 0 1000000000
0 1000000000 1000000000 1000000000 500000000 300000000
1000000000 1000000000 500000000 3000000...

result:

ok 22 acute triangles

Test #24:

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

input:

23

output:

Yes
500000000 1000000000 450000000 200000000 550000000 200000000
500000000 1000000000 1000000000 1000000000 550000000 200000000
1000000000 1000000000 550000000 200000000 1000000000 0
225000000 100000000 475000000 100000000 250000000 0
0 0 225000000 100000000 250000000 0
450000000 200000000 475000000...

result:

ok 23 acute triangles

Test #25:

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

input:

25

output:

Yes
300000000 180000000 500000000 140000000 500000000 300000000
500000000 300000000 700000000 180000000 500000000 140000000
0 0 500000000 300000000 0 1000000000
0 1000000000 1000000000 1000000000 500000000 300000000
1000000000 1000000000 500000000 300000000 1000000000 0
200000000 0 350000000 9000000...

result:

ok 25 acute triangles

Test #26:

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

input:

26

output:

Yes
500000000 1000000000 1000000000 1000000000 550000000 200000000
1000000000 1000000000 550000000 200000000 1000000000 0
225000000 100000000 475000000 100000000 250000000 0
0 0 225000000 100000000 250000000 0
450000000 200000000 475000000 100000000 225000000 100000000
500000000 0 475000000 10000000...

result:

ok 26 acute triangles

Test #27:

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

input:

27

output:

Yes
550000000 1000000000 700000000 750000000 420000000 700000000
420000000 700000000 700000000 500000000 700000000 750000000
700000000 500000000 1000000000 600000000 700000000 750000000
210000000 850000000 485000000 850000000 275000000 1000000000
0 1000000000 210000000 850000000 275000000 1000000000...

result:

ok 27 acute triangles

Test #28:

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

input:

28

output:

Yes
500000000 300000000 700000000 180000000 500000000 140000000
0 0 500000000 300000000 0 1000000000
0 1000000000 1000000000 1000000000 500000000 300000000
1000000000 1000000000 500000000 300000000 1000000000 0
200000000 0 350000000 90000000 150000000 90000000
0 0 200000000 0 150000000 90000000
4000...

result:

ok 28 acute triangles

Test #29:

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

input:

29

output:

Yes
1000000000 1000000000 550000000 200000000 1000000000 0
225000000 100000000 475000000 100000000 250000000 0
0 0 225000000 100000000 250000000 0
450000000 200000000 475000000 100000000 225000000 100000000
500000000 0 475000000 100000000 250000000 0
475000000 100000000 525000000 100000000 500000000...

result:

ok 29 acute triangles

Test #30:

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

input:

30

output:

Yes
420000000 700000000 700000000 500000000 700000000 750000000
700000000 500000000 1000000000 600000000 700000000 750000000
210000000 850000000 485000000 850000000 275000000 1000000000
0 1000000000 210000000 850000000 275000000 1000000000
420000000 700000000 485000000 850000000 210000000 850000000
...

result:

ok 30 acute triangles

Test #31:

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

input:

31

output:

Yes
0 0 500000000 300000000 0 1000000000
0 1000000000 1000000000 1000000000 500000000 300000000
1000000000 1000000000 500000000 300000000 1000000000 0
200000000 0 350000000 90000000 150000000 90000000
0 0 200000000 0 150000000 90000000
400000000 0 350000000 90000000 200000000 0
300000000 180000000 3...

result:

ok 31 acute triangles

Test #32:

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

input:

32

output:

Yes
225000000 100000000 475000000 100000000 250000000 0
0 0 225000000 100000000 250000000 0
450000000 200000000 475000000 100000000 225000000 100000000
500000000 0 475000000 100000000 250000000 0
475000000 100000000 525000000 100000000 500000000 200000000
450000000 200000000 475000000 100000000 5000...

result:

ok 32 acute triangles

Test #33:

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

input:

33

output:

Yes
700000000 500000000 1000000000 600000000 700000000 750000000
210000000 850000000 485000000 850000000 275000000 1000000000
0 1000000000 210000000 850000000 275000000 1000000000
420000000 700000000 485000000 850000000 210000000 850000000
550000000 1000000000 485000000 850000000 275000000 100000000...

result:

ok 33 acute triangles

Test #34:

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

input:

34

output:

Yes
0 1000000000 1000000000 1000000000 500000000 300000000
1000000000 1000000000 500000000 300000000 1000000000 0
200000000 0 350000000 90000000 150000000 90000000
0 0 200000000 0 150000000 90000000
400000000 0 350000000 90000000 200000000 0
300000000 180000000 350000000 90000000 150000000 90000000
...

result:

ok 34 acute triangles

Test #35:

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

input:

35

output:

Yes
0 0 225000000 100000000 250000000 0
450000000 200000000 475000000 100000000 225000000 100000000
500000000 0 475000000 100000000 250000000 0
475000000 100000000 525000000 100000000 500000000 200000000
450000000 200000000 475000000 100000000 500000000 200000000
500000000 0 525000000 100000000 4750...

result:

ok 35 acute triangles

Test #36:

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

input:

36

output:

Yes
210000000 850000000 485000000 850000000 275000000 1000000000
0 1000000000 210000000 850000000 275000000 1000000000
420000000 700000000 485000000 850000000 210000000 850000000
550000000 1000000000 485000000 850000000 275000000 1000000000
350000000 750000000 350000000 250000000 0 500000000
0 10000...

result:

ok 36 acute triangles

Test #37:

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

input:

37

output:

Yes
1000000000 1000000000 500000000 300000000 1000000000 0
200000000 0 350000000 90000000 150000000 90000000
0 0 200000000 0 150000000 90000000
400000000 0 350000000 90000000 200000000 0
300000000 180000000 350000000 90000000 150000000 90000000
400000000 160000000 450000000 70000000 350000000 900000...

result:

ok 37 acute triangles

Test #38:

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

input:

38

output:

Yes
450000000 200000000 475000000 100000000 225000000 100000000
500000000 0 475000000 100000000 250000000 0
475000000 100000000 525000000 100000000 500000000 200000000
450000000 200000000 475000000 100000000 500000000 200000000
500000000 0 525000000 100000000 475000000 100000000
550000000 200000000 ...

result:

ok 38 acute triangles

Test #39:

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

input:

39

output:

Yes
0 1000000000 210000000 850000000 275000000 1000000000
420000000 700000000 485000000 850000000 210000000 850000000
550000000 1000000000 485000000 850000000 275000000 1000000000
350000000 750000000 350000000 250000000 0 500000000
0 1000000000 350000000 750000000 0 500000000
700000000 500000000 350...

result:

ok 39 acute triangles

Test #40:

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

input:

40

output:

Yes
200000000 0 350000000 90000000 150000000 90000000
0 0 200000000 0 150000000 90000000
400000000 0 350000000 90000000 200000000 0
300000000 180000000 350000000 90000000 150000000 90000000
400000000 160000000 450000000 70000000 350000000 90000000
300000000 180000000 400000000 160000000 350000000 90...

result:

ok 40 acute triangles

Test #41:

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

input:

41

output:

Yes
500000000 0 475000000 100000000 250000000 0
475000000 100000000 525000000 100000000 500000000 200000000
450000000 200000000 475000000 100000000 500000000 200000000
500000000 0 525000000 100000000 475000000 100000000
550000000 200000000 525000000 100000000 500000000 200000000
525000000 100000000 ...

result:

ok 41 acute triangles

Test #42:

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

input:

42

output:

Yes
420000000 700000000 485000000 850000000 210000000 850000000
550000000 1000000000 485000000 850000000 275000000 1000000000
350000000 750000000 350000000 250000000 0 500000000
0 1000000000 350000000 750000000 0 500000000
700000000 500000000 350000000 250000000 350000000 750000000
0 0 350000000 250...

result:

ok 42 acute triangles

Test #43:

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

input:

43

output:

Yes
0 0 200000000 0 150000000 90000000
400000000 0 350000000 90000000 200000000 0
300000000 180000000 350000000 90000000 150000000 90000000
400000000 160000000 450000000 70000000 350000000 90000000
300000000 180000000 400000000 160000000 350000000 90000000
500000000 140000000 450000000 70000000 4000...

result:

ok 43 acute triangles

Test #44:

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

input:

44

output:

Yes
475000000 100000000 525000000 100000000 500000000 200000000
450000000 200000000 475000000 100000000 500000000 200000000
500000000 0 525000000 100000000 475000000 100000000
550000000 200000000 525000000 100000000 500000000 200000000
525000000 100000000 775000000 100000000 750000000 0
500000000 0 ...

result:

ok 44 acute triangles

Test #45:

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

input:

45

output:

Yes
550000000 1000000000 485000000 850000000 275000000 1000000000
350000000 750000000 350000000 250000000 0 500000000
0 1000000000 350000000 750000000 0 500000000
700000000 500000000 350000000 250000000 350000000 750000000
0 0 350000000 250000000 0 500000000
350000000 250000000 850000000 250000000 5...

result:

ok 45 acute triangles

Test #46:

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

input:

46

output:

Yes
400000000 0 350000000 90000000 200000000 0
300000000 180000000 350000000 90000000 150000000 90000000
400000000 160000000 450000000 70000000 350000000 90000000
300000000 180000000 400000000 160000000 350000000 90000000
500000000 140000000 450000000 70000000 400000000 160000000
400000000 0 4500000...

result:

ok 46 acute triangles

Test #47:

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

input:

47

output:

Yes
450000000 200000000 475000000 100000000 500000000 200000000
500000000 0 525000000 100000000 475000000 100000000
550000000 200000000 525000000 100000000 500000000 200000000
525000000 100000000 775000000 100000000 750000000 0
500000000 0 525000000 100000000 750000000 0
550000000 200000000 77500000...

result:

ok 47 acute triangles

Test #48:

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

input:

48

output:

Yes
350000000 750000000 350000000 250000000 0 500000000
0 1000000000 350000000 750000000 0 500000000
700000000 500000000 350000000 250000000 350000000 750000000
0 0 350000000 250000000 0 500000000
350000000 250000000 850000000 250000000 500000000 0
0 0 350000000 250000000 500000000 0
700000000 50000...

result:

ok 48 acute triangles

Test #49:

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

input:

49

output:

Yes
300000000 180000000 350000000 90000000 150000000 90000000
400000000 160000000 450000000 70000000 350000000 90000000
300000000 180000000 400000000 160000000 350000000 90000000
500000000 140000000 450000000 70000000 400000000 160000000
400000000 0 450000000 70000000 350000000 90000000
450000000 70...

result:

ok 49 acute triangles

Test #50:

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

input:

50

output:

Yes
500000000 0 525000000 100000000 475000000 100000000
550000000 200000000 525000000 100000000 500000000 200000000
525000000 100000000 775000000 100000000 750000000 0
500000000 0 525000000 100000000 750000000 0
550000000 200000000 775000000 100000000 525000000 100000000
1000000000 0 775000000 10000...

result:

ok 50 acute triangles