比赛 |
Asm.Def战记之圣地亚哥“杯2015 |
评测结果 |
AAAAAAEEEE |
题目名称 |
Asm.Def的命令 |
最终得分 |
60 |
用户昵称 |
WINAPI |
运行时间 |
3.443 s |
代码语言 |
C++ |
内存使用 |
6.50 MiB |
提交时间 |
2015-10-31 11:19:31 |
显示代码纯文本
#include<cstdio>
#include<cstdlib>
#include<cmath>
#define min(a,b) a>b?b:a
#define MAXN 50005
int qian[MAXN];
int b[MAXN];
int minnn=2147483647;
int ssum=0;
int num=0;
struct tree{
int begin,end;
float x,y;
};
tree ren[MAXN];
int built(int node,int l,int r)
{
ren[node].begin=l;
ren[node].end=r;
if(l==r) {ren[node].x=0;ren[node].y=l;}
if(l<r) {
built(node*2,l,(l+r)/2);
built(node*2+1,(l+r)/2+1,r);
}
}
int query(int node,int l,int r)
{
if(ren[node].begin>=l&&ren[node].end<=r)
{
printf("%.1f %.1f\n",ren[node].x,ren[node].y);
return 0;
}
else {
if((ren[node].begin+ren[node].end)/2>=l) query(node*2,l,r);
if((ren[node].begin+ren[node].end)/2<r) query(node*2+1,l,r);
}
}
int edit(int a,float x2,float y2,int node)
{
if(ren[node].begin==ren[node].end)
{ren[node].x+=x2;ren[node].y+=y2;}
else
{
int mid=(ren[node].begin + ren[node].end)/2;
if(a<=mid) edit(a,x2,y2,node*2);
if(a>=mid+1) edit(a,x2,y2,node*2+1);
}
}
int edit2(int a,float deg,int node)
{
if(ren[node].begin==ren[node].end)
{int x0=ren[node].x;int y0=ren[node].y;
ren[node].x=x0*cos(x0)-y0*sin(y0);
ren[node].y=x0*sin(x0)+y0*cos(y0);
}
else
{
int mid=(ren[node].begin + ren[node].end)/2;
if(a<=mid) edit2(a,deg,node);
if(a>=mid+1) edit2(a,deg,node);
}
}
int main()
{
freopen("asm_command.in","r",stdin);
freopen("asm_command.out","w",stdout);
int m,n;
int a,x,bz;
float y,z;
int i,head=1;
scanf("%d",&m);
scanf("%d",&n);
built(1,1,m);
while(n--)
{ scanf("%d",&bz);
if(bz==0){
scanf("%d",&x);
query(1,x,x);
}
else if(bz==1)
{
scanf("%d%d%f%f",&a,&x,&y,&z);
for(i=a;i<=x;i++)
edit(i,y,z,1);
}
else if(bz==2){
float deg;
scanf("%d%d%f",&x,&y,°);
for(i=x;i<=y;i++)
edit2(i,deg,1);
}
}
return 0;
}