QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#406151 | #7730. Convex Checker | RainningLove | Compile Error | / | / | C++20 | 1.5kb | 2024-05-06 21:15:30 | 2024-05-06 21:15:31 |
Judging History
你现在查看的是最新测评结果
- [2024-07-04 19:27:17]
- hack成功,自动添加数据
- (/hack/727)
- [2024-07-04 19:17:30]
- hack成功,自动添加数据
- (/hack/726)
- [2024-05-06 21:15:31]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-05-06 21:15:30]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
struct Point {
long double x,y;
friend bool operator<(Point &a,Point &b) {
if(a.x==b.x)return a.y<b.y;
return a.x<b.x;
}
Point(long long x,long long y) {
this->x=x;
this->y=y;
}
};
struct Line {
long double A,B,C;
Line(Point a,Point b) {
this->A = b.y-a.y;
this->B = a.x-b.x;
this->C = a.y*b.x - a.x*b.y;
}
int contains(Point x) {
if(A*x.x + B*x.y+C==0) return 1;
return 0;
}
};
struct Vector {
long long x,y;
Vector(Point a,Point b) {
this->x=b.x-a.x;
this->y=b.y-a.y;
}
};
int n;
vector<Point> a;
void solve() {
cin>>n;
set<Point> st;
for(int i=1;i<=n;i++) {
long long x,y;
cin>>x>>y;
a.push_back(Point(x,y));
}
for(int i=0;i<n;i++) a.push_back(a[i]),st.insert(a[i]);
if(st.size()!=n) return(void)(cout<<"No");
int f=1;
for(int i=1;i<=n;i++) {
Vector x(a[i-1],a[i]),y(a[i],a[i+1]);
if(x.x*y.y-x.y*y.x<=0) f=0;
}
if(f) return (void)(cout<<"Yes");
f=1;
for(int i=1;i<=n;i++) {
Vector x(a[i-1],a[i]),y(a[i],a[i+1]);
if(x.x*y.y-x.y*y.x>=0) f=0;
}
if(f) return (void)(cout<<"Yes");
cout<<"No";
}
/*
(1,0)
(0,1)
a.x*b.y-a.y*b.x>0 a在b右侧
*/
int main() {
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int t=1;
// cin>>t;
while(t--)
solve();
}
/*
*/
Details
In file included from /usr/include/c++/13/string:49, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:1: /usr/include/c++/13/bits/stl_function.h: In instantiation of ‘constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Point]’: /usr/include/c++/13/bits/stl_tree.h:2118:35: required from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = Point; _Val = Point; _KeyOfValue = std::_Identity<Point>; _Compare = std::less<Point>; _Alloc = std::allocator<Point>; key_type = Point]’ /usr/include/c++/13/bits/stl_tree.h:2171:4: required from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const Point&; _Key = Point; _Val = Point; _KeyOfValue = std::_Identity<Point>; _Compare = std::less<Point>; _Alloc = std::allocator<Point>]’ /usr/include/c++/13/bits/stl_set.h:514:25: required from ‘std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = Point; _Compare = std::less<Point>; _Alloc = std::allocator<Point>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<Point, Point, std::_Identity<Point>, std::less<Point>, std::allocator<Point> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<Point>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<Point>, Point>::rebind<Point>; typename _Alloc::value_type = Point; value_type = Point]’ answer.code:52:53: required from here /usr/include/c++/13/bits/stl_function.h:408:20: error: no match for ‘operator<’ (operand types are ‘const Point’ and ‘const Point’) 408 | { return __x < __y; } | ~~~~^~~~~ In file included 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: /usr/include/c++/13/bits/stl_iterator.h:583:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> requires three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&)’ (reversed) 583 | operator<=>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:583:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const Point’ is not derived from ‘const std::reverse_iterator<_IteratorL>’ 408 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/13/bits/stl_iterator.h:1690:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> requires three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ (reversed) 1690 | operator<=>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1690:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const Point’ is not derived from ‘const std::move_iterator<_IteratorL>’ 408 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/13/bits/stl_algobase.h:64: /usr/include/c++/13/bits/stl_pair.h:819:5: note: candidate: ‘template<class _T1, class _T2> constexpr std::common_comparison_category_t<decltype (std::__detail::__synth3way(declval<_T1&>(), declval<_T1&>())), decltype (std::__detail::__synth3way(declval<_T2&>(), declval<_T2&>()))> std::operator<=>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’ (rewritten) 819 | operator<=>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/13/bits/stl_pair.h:819:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const Point’ is not derived from ‘const std::pair<_T1, _T2>’ 408 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/13/bits/stl_iterator.h:601:5: note: candidate: ‘template<class _Iterator> requires three_way_comparable<_Iterator, std::partial_ordering> constexpr std::compare_three_way_result_t<_Iterator, _Iterator> std::operator<=>(const reverse_iter...