QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#859359 | #9668. Isoball: 2D Version | yjtac | Compile Error | / | / | C++20 | 2.7kb | 2025-01-17 17:49:13 | 2025-01-17 17:49:15 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int gcd(int a,int b)
{
while(b^=a^=b^=a%=b);
return a;
}
signed main()
{
int t;
cin >> t;
while (t--)
{
long double x1,y1,x2,y2,r;//x2=v1,y2=v2
cin>>x1>>y1>>r>>x2>>y2;
int q=gcd(x2,y2);
x2/=q;
y2/=q;
long double xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4;
cin>>xx4>>yy4>>xx2>>yy2;
yy1=yy2;
xx1=xx4;
yy3=yy4;
xx3=xx2;
xx1+=r;
xx4+=r;
xx2-=r;
xx3-=r;
yy1-=r;
yy2-=r;
yy3+=r;
yy4+=r;
if(x2==0&&y2==0)
{
if(x1>=xx1&&x1<=xx2&&y1<=yy1&&y1>=yy4)
{
cout<<"Yes"<<endl;
continue;
}
else
{
cout<<"No"<<endl;
continue;
}
}
if(y2==0&&x2>0)
{
if(x1<=xx2&&y2<=yy1&&y2>=yy4)
{
cout<<"Yes"<<endl;
continue;
}
else
{
cout<<"No"<<endl;
continue;
}
}
if(y2==0&&x2<0&&y2<=yy1&&y2>=yy4)
{
if(x1>=xx1)
{
cout<<"Yes"<<endl;
continue;
}
else
{
cout<<"No"<<endl;
continue;
}
}
if(x2==0&&y2>0)
{
if(y1<=yy1&&x2<=xx1&&x2>=xx4)
{
cout<<"Yes"<<endl;
continue;
}
else
{
cout<<"No"<<endl;
continue;
}
}
if(x2==0&&y2<0)
{
if(y1>=yy4&&x2<=xx1&&x2>=4)
{
cout<<"Yes"<<endl;
continue;
}
else
{
cout<<"No"<<endl;
continue;
}
}
if(xx1>xx2)
{
cout<<"No"<<endl;
continue;
}
if(yy1<yy4)
{
cout<<"No"<<endl;
continue;
}
long double x,y;
long double t=0;
t=(xx1-x1)/x2;
if(t>=0)
{
y=y2*t+y1;
if(y<=yy1&&y>=yy4)
{
cout<<"Yes"<<endl;
continue;
}
}
t=(xx2-x1)/x2;
if(t>=0)
{
y=y2*t+y1;
if(y<=yy2&&y>=yy3)
{
cout<<"Yes"<<endl;
continue;
}
}
t=(yy1-y1)/y2;
if(t>=0)
{
x=x2*t+x1;
if(x<=xx2&&x>=xx1)
{
cout<<"Yes"<<endl;
continue;
}
}
t=(yy3-y1)/y2;
if(t>=0)
{
x=x2*t+x1;
if(x<=xx2&&x>=xx1)
{
cout<<"Yes"<<endl;
continue;
}
}
cout<<"No"<<endl;
}
return 0;
}
Details
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from answer.code:1: /usr/include/c++/14/numeric: In instantiation of ‘constexpr std::common_type_t<_Tp1, _Tp2> std::gcd(_Mn, _Nn) [with _Mn = long double; _Nn = long double; common_type_t<_Tp1, _Tp2> = long double]’: answer.code:17:17: required from here 17 | int q=gcd(x2,y2); | ~~~^~~~~~~ /usr/include/c++/14/numeric:175:21: error: static assertion failed: std::gcd arguments must be integers 175 | static_assert(is_integral_v<_Mn> && is_integral_v<_Nn>, | ^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/numeric:175:21: note: ‘std::is_integral_v<long double>’ evaluates to false In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In instantiation of ‘struct std::make_unsigned<long double>’: /usr/include/c++/14/type_traits:2061:11: required by substitution of ‘template<class _Tp> using std::make_unsigned_t = typename std::make_unsigned::type [with _Tp = long double]’ 2061 | using make_unsigned_t = typename make_unsigned<_Tp>::type; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/numeric:182:24: required from ‘constexpr std::common_type_t<_Tp1, _Tp2> std::gcd(_Mn, _Nn) [with _Mn = long double; _Nn = long double; common_type_t<_Tp1, _Tp2> = long double]’ 182 | return __detail::__gcd<make_unsigned_t<_Ct>>(__m2, __n2); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:17:17: required from here 17 | int q=gcd(x2,y2); | ~~~^~~~~~~ /usr/include/c++/14/type_traits:1914:13: error: invalid use of incomplete type ‘class std::__make_unsigned_selector<long double, false, false>’ 1914 | { using type = typename __make_unsigned_selector<_Tp>::__type; }; | ^~~~ /usr/include/c++/14/type_traits:1822:11: note: declaration of ‘class std::__make_unsigned_selector<long double, false, false>’ 1822 | class __make_unsigned_selector; | ^~~~~~~~~~~~~~~~~~~~~~~~