QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#732978 | #5419. Triangles | PorNPtree | WA | 0ms | 3664kb | C++23 | 1.7kb | 2024-11-10 16:43:45 | 2024-11-10 16:43:45 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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