QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#732978#5419. TrianglesPorNPtreeWA 0ms3664kbC++231.7kb2024-11-10 16:43:452024-11-10 16:43:45

Judging History

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

  • [2024-11-10 16:43:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3664kb
  • [2024-11-10 16:43:45]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define LD long double
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=55;const LD eps=1e-10;
int n;
struct comp{LL x,y;};
inline LD p2(LD x){return x*x;}
inline LD dis(comp A,comp B){return sqrtl(p2(A.x-B.x)+p2(A.y-B.y));}
inline bool chk(LD a,LD b,LD c)
{
	LD cs=(a*a+b*b-c*c)/2/a/b;
	return eps<cs&&cs<1-eps;
}
inline bool chk(comp A,comp B,comp C)
{
	LD a=dis(B,C),b=dis(A,C),c=dis(A,B);
	return chk(a,b,c)&&chk(b,c,a)&&chk(c,a,b);
}
vector<array<comp,3>>g;
inline bool operator==(comp A,comp B){return A.x==B.x&&A.y==B.y;}
inline comp MID(comp A,comp B){return {(A.x+B.x)>>1,(A.y+B.y)>>1};}
inline void add()
{
	for(auto i:g)
	{
		comp A=i[0],B=i[1],C=i[2];
		if((A.x&1)==(B.x&1)&&(A.x&1)==(C.x&1)&&(A.y&1)==(B.y&1)&&(A.y&1)==(C.y&1))
		{
			comp D=MID(B,C),E=MID(C,A),F=MID(A,B);
			for(int j=0;j<g.size();j++) if(g[j]==i) swap(g[j],g.back()),g.pop_back();
			g.push_back({A,E,F});g.push_back({B,D,F});g.push_back({C,D,E});
			g.push_back({D,E,F});
			return;
		}
	}
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>n;
	if(n<8) return cout<<"No",0;
	if(n%3==2)
	{
		LL d=1e9/20;
		comp A={0*d,d*20},B={10*d,d*20},C={20*d,d*20},
		D={8*d,d*4},E={12*d,d*4},
		F={0*d,d*0},G={10*d,d*0},H={20*d,d*0};
		g={{A,B,D},{B,C,E},{B,D,E},{A,D,F},{C,E,H},{D,F,G},{D,E,G},{E,G,H}};
		while(g.size()!=n) add();
	}
	// 0 0 500000000 0 400000000 300000000
	cout<<"Yes\n";
	for(auto i:g)
	{
		comp A=i[0],B=i[1],C=i[2];
		cout<<A.x<<" "<<A.y<<" "<<B.x<<" "<<B.y<<" "<<C.x<<" "<<C.y<<"\n";
	}
	// for(auto i:g)
	// {
	// 	comp A=i[0],B=i[1],C=i[2];
	// 	cout<<chk(A,B,C);
	// }
	return 0;
}

詳細信息

Test #1:

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

input:

2

output:

No

result:

ok no solution

Test #2:

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

input:

24

output:

Yes

result:

wrong output format Unexpected end of file - int32 expected