QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#310386#5419. Trianglessumi007WA 1ms3696kbC++142.3kb2024-01-21 12:08:192024-01-21 12:08:20

Judging History

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

  • [2024-01-21 12:08:20]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3696kb
  • [2024-01-21 12:08:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ldb long double
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define lowbit(i) i&(-i)
const int N = 2077,lim = 1e7;
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(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin >> n;
	if(n<8){
		cout << "No\n";
		return 0;
	}
	l = 1,r = 0;
	cout << "Yes\n";
	if(n%3==0){
		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 if(n%3==2){
		n -= 8;
		q[++r] = {{0,0},{40,25},{50,0}}; 
		q[++r] = {{40,25},{50,0},{60,25}}; 
		q[++r] = {{50,0},{60,25},{100,0}}; 
		q[++r] = {{0,0},{0,100},{40,25}}; 
		q[++r] = {{0,100},{40,25},{50,100}}; 
		q[++r] = {{50,100},{40,25},{60,25}}; 
		q[++r] = {{50,100},{100,100},{60,25}}; 
		q[++r] = {{100,100},{60,25},{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;
		auto 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++){
		cout << q[i].a.x << ' ' << q[i].a.y << ' ';
		cout << q[i].b.x << ' ' << q[i].b.y << ' ';
		cout << q[i].c.x << ' ' << q[i].c.y << "\n";
	}
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

No

result:

ok no solution

Test #2:

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

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

input:

1

output:

No

result:

ok no solution

Test #4:

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

input:

3

output:

No

result:

ok no solution

Test #5:

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

input:

4

output:

No

result:

ok no solution

Test #6:

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

input:

5

output:

No

result:

ok no solution

Test #7:

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

input:

6

output:

No

result:

ok no solution

Test #8:

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

input:

7

output:

No

result:

ok no solution

Test #9:

score: -100
Wrong Answer
time: 0ms
memory: 3696kb

input:

8

output:

Yes
0 0 400000000 250000000 500000000 0
400000000 250000000 500000000 0 600000000 250000000
500000000 0 600000000 250000000 1000000000 0
0 0 0 1000000000 400000000 250000000
0 1000000000 400000000 250000000 500000000 1000000000
500000000 1000000000 400000000 250000000 600000000 250000000
500000000 1...

result:

wrong answer triangle 4 not acute