QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#748487 | #9576. Ordainer of Inexorable Judgment | ZLYF | Compile Error | / | / | C++20 | 2.0kb | 2024-11-14 20:31:43 | 2024-11-14 20:31:46 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-14 21:58:28]
- hack成功,自动添加数据
- (/hack/1181)
- [2024-11-14 20:31:46]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-14 20:31:43]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const double pi=acos(-1),eps=1e-12;
const int N=105;
int n;double x0,y0,d,t;
struct Point{
double x,y;
Point operator-(const Point &b){
return Point{x-b.x,y-b.y};
}
Point operator+(const Point &b){
return Point{x+b.x,y+b.y};
}
friend double operator^(const Point &a,const Point &b){
return a.x*b.y-a.y*b.x;
}
}p[N];
double change(double th){
while(th>=pi*2)
th-=pi*2;
while(th<0)
th+=pi*2;
return th;
}
bool check(double th,int sgn){
Point o={cos(th)*d,sin(th)*d};
Point v={cos(th-pi/2*sgn),sin(th-pi/2*sgn)};
// cout<<o.x<<" "<<o.y<<"\n";
// cout<<v.x<<" "<<v.y<<"\n";
for(int i=0;i<n;i++){
Point a=p[i]-o;
// cout<<a.x<<" "<<a.y<<" "<(v^a)<<"\n";
if(sgn==1){
if((v^a)<-eps)
return 0;
}
if(sgn==-1){
if((v^a)>eps)
return 0;
}
}
// cout<<"!\n";
return 1;
}
double inter(double l,double r,double u,double v){
if(r<u||l>v)
return 0;
return min(r,v)-max(l,u);
}
void print(double th){
cout<<cos(th)*d<<" "<<sin(th)*d<<"\n";
}
void solve(){
cin>>n>>x0>>y0>>d>>t;
vector<double> l,r;
for(int i=0;i<n;i++){
cin>>p[i].x>>p[i].y;
double a=atan2(p[i].y,p[i].x);
double b=atan2(sqrt(p[i].x*p[i].x+p[i].y*p[i].y-d*d),d);
l.push_back(change(a+b));
r.push_back(change(a-b));
}
sort(l.begin(),l.end());
sort(r.begin(),r.end());
double S,T;
if(check(l[0],1))
T=l[0];
else
T=l[n-1];
if(check(r[0],-1))
S=r[0];
else
S=r[n-1];
// cout<<L<<" "<<R<<"\n";
// print(L);print(R);
double th0=atan2(y0,x0),ans=0;
S-=th0;T-=th0;
double C=T-S;
while(t>=2*pi){
ans+=C;
t-=pi*2;
}
if(S<T){
ans+=inter(0,t,S,T);
}
else{
ans+=inter(0,t,0,T);
ans+=inter(0,t,S,pi*2);
}
cout<<fixed<<setprecision(12)<<ans<<"\n";
}
signed main(){
ios::sync_with_stdio(false);
cin.tie();cout.tie();
// int T;cin>>T;
// while(T--)
solve();
return 0;
}
/*
3 1 0 1 10000
1 2
2 1
2 2
*/
Details
answer.code:6:17: error: ‘double y0’ redeclared as different kind of entity 6 | int n;double 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:55:19: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’) 55 | cin>>n>>x0>>y0>>d>>t; | ~~~~~~~~~~^~~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/13/sstream:40, from /usr/include/c++/13/complex:45, from /usr/include/c++/13/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127: /usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 325 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/13/istream:325:7: note: conversion of argument 1 would be ill-formed: answer.code:55:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘void*’ [-fpermissive] 55 | cin>>n>>x0>>y0>>d>>t; | ^~ | | | double (*)(double) noexcept answer.code:55:21: error: cannot bind rvalue ‘(void*)y0’ to ‘void*&’ /usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 201 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:201:7: note: conversion of argument 1 would be ill-formed: answer.code:55:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long unsigned int’ [-fpermissive] 55 | cin>>n>>x0>>y0>>d>>t; | ^~ | | | double (*)(double) noexcept answer.code:55:21: error: cannot bind rvalue ‘(long long unsigned int)y0’ to ‘long long unsigned int&’ /usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 197 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:197:7: note: conversion of argument 1 would be ill-formed: answer.code:55:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long int’ [-fpermissive] 55 | cin>>n>>x0>>y0>>d>>t; | ^~ | | | double (*)(double) noexcept answer.code:55:21: error: cannot bind rvalue ‘(long long int)y0’ to ‘long long int&’ /usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:192:7: note: conversion of argument 1 would be ill-formed: answer.code:55:21: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long unsigned int’ [-fpermissive] 55 | cin>>n>>x0>>y0>>d>>t; | ^~ | | | double (*)(double) noexcept answer.code:55:21: error: cannot bind rvalue ‘(long unsigned int)y0’ to ‘long unsigned int&’ /usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:188:7: note: conversion of argument 1 would be ill-formed: answer.cod...