QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#721014 | #9565. Birthday Gift | ucup-team902# | TL | 0ms | 0kb | C++20 | 2.6kb | 2024-11-07 14:58:30 | 2024-11-07 14:58:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define y0 sxxxxx
#define pii pair<int,int>
#define ll long long
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<22|1;
char ibuf[RLEN],*ib,*ob;
inline char gc(){
(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
return (ib==ob)?EOF:*ib++;
}
inline int read(){
char ch=gc();
int res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
inline ll readll(){
char ch=gc();
ll res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
inline int readstring(char *s){
int top=0;char ch=gc();
while(isspace(ch))ch=gc();
while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
s[top+1]='\0';return top;
}
template<typename tp>inline void chemx(tp &a,tp b){(a<b)?(a=b):0;}
template<typename tp>inline void chemn(tp &a,tp b){(a>b)?(a=b):0;}
cs int N=205;
cs double pi=acos(-1);
#define pd pair<double,double>
cs double eps=1e-9;
int n,x0,y0,d,t;
vector<pd> inter;
void ins(double l,double r){
if(l<0)l+=2*pi;
if(r>2*pi+eps)r-=2*pi;
cout<<l<<" "<<r<<'\n';
if(l+eps<r)inter.pb(pd(l,r));
else inter.pb(pd(l,2*pi)),inter.pb(pd(0,r));
}
void init(){
sort(inter.begin(),inter.end());
double lst=-1;
vector<pd>res;
for(int i=0;i<inter.size();i++){
lst=inter[i].se;
int j=i;
while(j+1<inter.size()&&inter[j+1].fi<lst){
j++;
lst=max(inter[j].se,lst);
}
res.pb(pd(inter[i].fi,lst));
i=j;
}
inter=res;
}
double calc(pd x,pd y){
if(x.fi>y.fi)swap(x,y);
if(x.se<y.fi)return 0;
if(x.se>y.se)return y.se-y.fi;
return x.se-y.fi;
}
double query(double l,double r){
cout<<l<<" "<<r<<'\n';
double ans=0;
for(pd x:inter){
ans+=calc(x,pd(l,r));
}return ans;
}
void solve(){
n=read();
x0=read(),y0=read(),d=read(),t=read();
for(int i=1;i<=n;i++){
int x=read(),y=read();
double p1=atan2(x,y);
double dis=sqrt(x*x+y*y);
double del=acos(d/dis);
// cout<<dis<<" "<<d<<'\n';
cout<<p1<<" "<<del<<'\n';
ins(p1-del,p1+del);
}
init();
for(pd x:inter)cout<<x.fi<<" "<<x.se<<'\n';
int cnt=t/(2*pi);
double res=t-cnt*2*pi;
double p0=atan2(y0,x0);
double ans=cnt*query(0,2*pi);
if(p0+res>2*pi)ans=ans+query(p0,2*pi)+query(0,p0+res-2*pi);
else ans=ans+query(p0,p0+res);
printf("%.9lf\n",ans);
}
int main(){
#ifdef Stargazer
freopen("1.in","r",stdin);
#endif
int T=1;
while(T--)solve();
}
详细
Test #1:
score: 0
Time Limit Exceeded
input:
5 0110101 01020102 0000021111 1012121010 0100202010