QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#609209 | #9434. Italian Cuisine | Rosmontispes | Compile Error | / | / | C++20 | 2.1kb | 2024-10-04 11:15:16 | 2024-10-04 11:15:17 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct Point{
long long x,y;
Point(long long a,long long b){x = a,y = b;}
};
int sgn(long long x){
if(x == 0)
return 0;
else if(x > 0)
return 1;
return -1;
}
Point operator - (Point a,Point b){
return Point(a.x - b.x,a.y - b.y);
}
long long Dot(Point a,Point b){
return a.x * b.x + a.y * b.y;
}
long long Cross(Point a,Point b){
return a.x*b.y - a.y*b.x;
}
long long Cross(Point sp,Point ep,Point op){
return (sp.x - op.x) * (ep.y - op.y) - (ep.x - op.x) * (sp.y - op.y);
}
long long dis(Point a,Point b){
return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
int judge(Point A,Point B,Point C,long long r){
if(dis(A,B) == 0)
return dis(B,C) >= r * r;
if(Dot(B - A,C - A) < 0)
return dis(A,C) >= r * r;
if(Dot(A - B,C - B) < 0)
return dis(B,C) >= r * r;
return Cross(B - A,C - A) * Cross(B - A,C - A) >= r * r * dis(B,A);
}
void solve(){
int n;
cin>>n;
long long cx,cy,r;
cin>>cx>>cy>>r;
Point cir(cx,cy);
vector<Point>poi(n);
for(int i = 0;i < n;i ++){
long long x,y;
cin>>x>>y;
poi[i] = Point(x,y);
}
int j = 0;
long long S = 0;
long long ans = 0;
for(int st = 0;st < n;st ++){
if(j == st){
j = j + 1 >= n?(j + 1 - n):j + 1;
S = Cross(poi[st],poi[j]);
}
int nex = j + 1 >= n?(j + 1 - n):j + 1;
while(j != st){
if(sgn(Cross(poi[j],cir,poi[st])) * sgn(Cross(poi[nex],cir,poi[st])) <= 0)
break;
if(!judge(poi[st],poi[nex],cir,r))
break;
S += Cross(poi[j],poi[nex]);
j = nex;
nex = j + 1 >= n?(j + 1 - n):j + 1;
}
ans = max(ans,S + Cross(poi[j],poi[st]));
nex = st + 1 >= n?(st + 1 - n):st + 1;
S -= Cross(poi[st],poi[nex]);
}
cout<<ans<<"\n";
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T;
cin>>T;
while(T --)
solve();
}
Details
In file included from /usr/include/c++/13/bits/stl_iterator.h:85, from /usr/include/c++/13/bits/stl_algobase.h:67, from /usr/include/c++/13/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:1: /usr/include/c++/13/bits/stl_construct.h: In instantiation of ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Point; _Args = {}]’: /usr/include/c++/13/bits/stl_uninitialized.h:643:18: required from ‘static constexpr _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Point*; _Size = long unsigned int; bool _TrivialValueType = false]’ /usr/include/c++/13/bits/stl_uninitialized.h:706:20: required from ‘constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Point*; _Size = long unsigned int]’ /usr/include/c++/13/bits/stl_uninitialized.h:773:44: required from ‘constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = Point*; _Size = long unsigned int; _Tp = Point]’ /usr/include/c++/13/bits/stl_vector.h:1715:36: required from ‘constexpr void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = Point; _Alloc = std::allocator<Point>; size_type = long unsigned int]’ /usr/include/c++/13/bits/stl_vector.h:555:9: required from ‘constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = Point; _Alloc = std::allocator<Point>; size_type = long unsigned int; allocator_type = std::allocator<Point>]’ answer.code:46:23: required from here /usr/include/c++/13/bits/stl_construct.h:115:28: error: no matching function for call to ‘construct_at(Point*&)’ 115 | std::construct_at(__p, std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/stl_construct.h:94:5: note: candidate: ‘template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...)’ 94 | construct_at(_Tp* __location, _Args&&... __args) | ^~~~~~~~~~~~ /usr/include/c++/13/bits/stl_construct.h:94:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_construct.h: In substitution of ‘template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = Point; _Args = {}]’: /usr/include/c++/13/bits/stl_construct.h:115:21: required from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Point; _Args = {}]’ /usr/include/c++/13/bits/stl_uninitialized.h:643:18: required from ‘static constexpr _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Point*; _Size = long unsigned int; bool _TrivialValueType = false]’ /usr/include/c++/13/bits/stl_uninitialized.h:706:20: required from ‘constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Point*; _Size = long unsigned int]’ /usr/include/c++/13/bits/stl_uninitialized.h:773:44: required from ‘constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = Point*; _Size = long unsigned int; _Tp = Point]’ /usr/include/c++/13/bits/stl_vector.h:1715:36: required from ‘constexpr void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = Point; _Alloc = std::allocator<Point>; size_type = long unsigned int]’ /usr/include/c++/13/bits/stl_vector.h:555:9: required from ‘constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = Point; _Alloc = std::allocator<Point>; size_type = long unsigned int; allocator_type = std::allocator<Point>]’ answer.code:46:23: required from here /usr/include/c++/13/bits/stl_construct.h:96:17: error: no matching function for call to ‘Point::Point()’ 96 | -> decltype(::new((void*)0) _Tp(std::declval<_Args>()...)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:5:5: note: candidate: ‘Point::Point(long long int, long long int)’ 5 | Point(long long a,long long b){x = a,y = b;} | ^~~~~ answer.code:5:5: note: candidate expects 2 arguments, 0 provided answer.code:3:8: note: candidate: ‘constexpr Point::Point(const Point&)’ 3 | struct Point{ | ^~~~~ answer.code:3:8: note: candidate expects 1 argument, 0 provided answer.code:3:8: note: candidate: ‘constexpr Point::Point(Point&&)’ answer.code:3:8: note: candidate expects 1 argument, 0 provided /usr/include/c++/13/bits/stl_construct.h: In instantiation of ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Point; _Args = {}]’: /usr/include/c++/13/bits/stl_uninitialized.h:643:18: required from ‘static con...