QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#720936#9572. Bingoucup-team902#Compile Error//C++202.4kb2024-11-07 14:45:162024-11-07 14:45:17

Judging History

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

  • [2024-11-07 14:45:17]
  • 评测
  • [2024-11-07 14:45:16]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#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,r+=2*pi;
	if(r>2*pi+eps)r-=2*pi;
	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){
	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(y,x);
		double dis=x*x+y*y;
		double del=acos(dis/d);
		ins(p1-del,p1+del);
	}
	init();
	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();

}

詳細信息

answer.code:48:10: error: ‘int y0’ redeclared as different kind of entity
   48 | int n,x0,y0,d,t;
      |          ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679,
                 from /usr/include/c++/13/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33,
                 from answer.code:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’
  220 | __MATHCALL (y0,, (_Mdouble_));
      | ^~~~~~~~~~
answer.code: In function ‘void solve()’:
answer.code:86:21: error: assignment of function ‘double y0(double)’
   86 |         x0=read(),y0=read(),d=read(),t=read();
      |                   ~~^~~~~~~
answer.code:97:24: error: no matching function for call to ‘atan2(double (&)(double) noexcept, int&)’
   97 |         double p0=atan2(y0,x0);
      |                   ~~~~~^~~~~~~
In file included from /usr/include/c++/13/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:166:
/usr/include/c++/13/bits/valarray_after.h:548:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Atan2, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::atan2(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)’
  548 | _DEFINE_EXPR_BINARY_FUNCTION(atan2, struct std::_Atan2)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note:   template argument deduction/substitution failed:
answer.code:97:24: note:   mismatched types ‘const std::valarray<_Tp>’ and ‘int’
   97 |         double p0=atan2(y0,x0);
      |                   ~~~~~^~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Atan2, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::atan2(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)’
  548 | _DEFINE_EXPR_BINARY_FUNCTION(atan2, struct std::_Atan2)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note:   template argument deduction/substitution failed:
answer.code:97:24: note:   mismatched types ‘const std::valarray<_Tp>’ and ‘double(double) noexcept’
   97 |         double p0=atan2(y0,x0);
      |                   ~~~~~^~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Atan2, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::atan2(const valarray<_Tp>&, const valarray<_Tp>&)’
  548 | _DEFINE_EXPR_BINARY_FUNCTION(atan2, struct std::_Atan2)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note:   template argument deduction/substitution failed:
answer.code:97:24: note:   mismatched types ‘const std::valarray<_Tp>’ and ‘double(double) noexcept’
   97 |         double p0=atan2(y0,x0);
      |                   ~~~~~^~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Atan2, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::atan2(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)’
  548 | _DEFINE_EXPR_BINARY_FUNCTION(atan2, struct std::_Atan2)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note:   template argument deduction/substitution failed:
answer.code:97:24: note:   mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘int’
   97 |         double p0=atan2(y0,x0);
      |                   ~~~~~^~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Atan2, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::atan2(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)’
  548 | _DEFINE_EXPR_BINARY_FUNCTION(atan2, struct std::_Atan2)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note:   template argument deduction/substitution failed:
answer.code:97:24: note:   mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘double(double) noexcept’
   97 |         double p0=atan2(y0,x0);
      |                   ~~~~~^~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Atan2, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::atan2(const valarray<typename _Dom::valarray>&, const _Expr<_Dom1, typename _Dom1::value_type>&)’
  548 | _DEFINE_EXPR_BINARY_FUNCTION(atan2, struct std::_Atan2)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:548:1:...