QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#549099 | #5419. Triangles | Wuyanru | RE | 0ms | 0kb | C++14 | 2.9kb | 2024-09-06 08:26:10 | 2024-09-06 08:26:11 |
answer
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f3f3f3f3fll
#define debug(x) cerr<<#x<<"="<<x<<endl
using namespace std;
using ll=long long;
using ld=long double;
using pli=pair<ll,int>;
using pi=pair<int,int>;
template<typename A>
using vc=vector<A>;
inline int read()
{
int s=0,w=1;char ch;
while((ch=getchar())>'9'||ch<'0') if(ch=='-') w=-1;
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
struct node
{
int x,y;
node(){ x=y=0;}
inline bool check()
{
if(x&1) return false;
if(y&1) return false;
return true;
}
node operator + (node b)
{
node ans;
ans.x=(x+b.x)/2;
ans.y=(y+b.y)/2;
return ans;
}
inline void output()
{
printf("%d %d",x,y);
}
};
struct T
{
node a,b,c;
T():a(),b(),c(){}
T(node x,node y,node z){ a=x,b=y,c=z;}
inline bool check()
{
return a.check()&&b.check()&&c.check();
}
inline void output()
{
a.output(),putchar(' ');
b.output(),putchar(' ');
c.output(),putchar('\n');
}
};
vc<T>ans;
int n;
inline void run()
{
for(auto &i:ans) if(i.check())
{
node c=i.a+i.b;
node b=i.a+i.c;
node a=i.c+i.b;
auto mem=i;
i=T(a,b,c);
ans.push_back(T(mem.a,b,c));
ans.push_back(T(a,mem.b,c));
ans.push_back(T(a,b,mem.c));
return ;
}
assert(0);
}
const int L=10000000;
inline void push(int x1,int y1,int x2,int y2,int x3,int y3)
{
node a;a.x=x1*L,a.y=y1*L;
node b;b.x=x2*L,b.y=y2*L;
node c;c.x=x3*L,c.y=y3*L;
ans.push_back(T(a,b,c));
}
inline void run8()
{
push(0,0,90,48,100,0);
push(0,0,0,50,90,48);
push(100,0,100,50,90,48);
push(0,100,90,52,100,100);
push(0,100,0,50,90,52);
push(100,100,100,50,90,52);
push(0,50,90,48,90,52);
push(100,50,90,48,90,52);
}
inline void run10()
{
push(0,0,90,48,100,0);
push(0,0,0,49,90,48);
push(100,0,100,50,90,48);
push(0,100,90,52,100,100);
push(0,100,0,51,90,52);
push(100,100,100,50,90,52);
push(100,50,90,48,90,52);
push(90,48,90,50,0,49);
push(90,52,90,50,0,51);
push(0,49,0,51,90,50);
}
inline void run9()
{
push(40,80,100,0,100,100);
push(40,80,0,0,100,0);
push(40,80,39,100,100,100);
push(39,100,40,80,20,80);
push(39,100,0,100,20,80);
push(30,60,20,80,40,80);
push(0,0,0,65,30,60);
push(0,65,30,60,20,80);
push(0,65,20,80,0,100);
}
int main()
{
freopen("plane.in","r",stdin);
freopen("plane.out","w",stdout);
n=read();
if(n<=7)
{
printf("No\n");
return 0;
}
printf("Yes\n");
int now=-1;
if(n%3==2) now=8,run8();
else if(n%3==1) now=10,run10();
else now=9,run9();
while(now<n) run(),now+=3;
for(auto i:ans) i.output();
return 0;
}
详细
Test #1:
score: 0
Dangerous Syscalls
input:
2