Submission #64779

#TimeUsernameProblemLanguageResultExecution timeMemory
64779bazsi700The Forest of Fangorn (CEOI14_fangorn)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define C complex<ll> #define X real() #define Y imag() ll w,h,n,c; C g; C camp[2005]; C tree[10005]; bool can[15]; int sign(ll x) { if(x > 0) { return 1; } else if(x == 0) { return 0; } else { return -1; } } ll cross(C a, C b) { //-1 bal, 0 egyenes, 1 jobb A hoz képest a B return sign(((a*conj(b)).Y)); } bool isbad[2005][2005]; bool isbadv[2005]; int leftest[2005]; int rightest[2005]; int main() { ios::sync_with_stdio(false); cin.tie(0); ll gx,gy; cin >> w >> h >> gx >> gy >> c; g = {gx,gy}; for(int i = 0; i < c; i++) { ll x,y; cin >> x >> y; camp[i] = {x,y}; } cin >> n; for(int i = 0; i < n; i++) { ll x,y; cin >> x >> y; tree[i] = {x,y}; } for(int i = 0; i < n; i++) { bool bad = false; int fix = (i == 0 ? 1 : 0); for(int j = 0; j < n; j++) { if(j == i || j == fix) { continue; } if(cross(tree[fix]-tree[i],tree[j]-tree[i]) > 0) { fix = i; } } for(int j = 0; j < n; j++) { if(j == i || j == fix) { continue; } if(cross(tree[fix]-tree[i],tree[j]-tree[i]) > 0) { bad = true; } } if(bad) { isbadv[i] = true; for(int j = 0; j < n; j++) { isbad[i][j] = isbad[j][i] = true; } } else { leftest[i] = fix; } } for(int i = 0; i < n; i++) { if(isbadv[i]) { continue; } int fix = (i == 0 ? 1 : 0); for(int j = 0; j < n; j++) { if(j == i || j == fix) { continue; } if(cross(tree[fix]-tree[i],tree[j]-tree[i]) < 0) { fix = i; } } rightest[i] = fix; } vector<int> pr; for(int i = 0; i < c; i++) { bool good = true; for(int x = 0; x < n; x++) { for(int y = x+1; y < n; y++) { if(isbad[x][y]) { if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) { good = false; } } } } if(!good) { continue; } for(int a2 = 0; a2 < n; a2++) { if(!isbadv[a2]) { int b1 = a2; int a1 = leftest[a2]; int b2 = rightest[a2]; if(b2 == a1 || b2 == a2) { continue; } if(cross(tree[a2]-tree[a1],camp[i]-tree[a1]) == cross(tree[a2]-tree[a1],g-tree[a1]) && cross(tree[b2]-tree[b1],camp[i]-tree[b1]) == cross(tree[b2]-tree[b1],g-tree[b1])) { continue; } if(cross(tree[a2]-tree[a1],tree[b2]-tree[a1]) != cross(tree[a2]-tree[a1],camp[i]-tree[a1]) && cross(tree[b2]-tree[b1],tree[a1]-tree[b1]) != cross(tree[b2]-tree[b1],camp[i]-tree[b1])) { good = false; } if(cross(tree[a2]-tree[a1],tree[b2]-tree[a1]) != cross(tree[a2]-tree[a1],g-tree[a1]) && cross(tree[b2]-tree[b1],tree[a1]-tree[b1]) != cross(tree[b2]-tree[b1],g-tree[b1])) { good = false; } } } if(good) { pr.push_back(i+1); } } cout << pr.size() << "\n"; for(int el : pr) { cout << el << " "; } return 0; }

Compilation message (stderr)

fangorn.cpp: In function 'int main()':
fangorn.cpp:101:47: error: no match for 'operator-' (operand types are 'std::complex<long long int>' and 'int')
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                              ~^~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:389:5: note: candidate: template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator-(const reverse_iterator<_IteratorL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:389:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:1191:5: note: candidate: template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)
     operator-(const move_iterator<_IteratorL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:1191:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/complex:356:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)
     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:356:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   mismatched types 'const std::complex<_Tp>' and 'int'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/complex:365:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&)
     operator-(const complex<_Tp>& __x, const _Tp& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:365:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/complex:374:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const std::complex<_Tp>&)
     operator-(const _Tp& __x, const complex<_Tp>& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:374:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   mismatched types 'const std::complex<_Tp>' and 'int'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/complex:451:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&)
     operator-(const complex<_Tp>& __x)
     ^~~~~~~~
/usr/include/c++/7/complex:451:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   candidate expects 1 argument, 2 provided
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:68,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/stl_deque.h:351:5: note: candidate: template<class _Tp, class _Ref, class _Ptr> typename std::_Deque_iterator<_Tp, _Ref, _Ptr>::difference_type std::operator-(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&)
     operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_deque.h:351:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:68,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/stl_deque.h:363:5: note: candidate: template<class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR> typename std::_Deque_iterator<_Tp, _Ref, _Ptr>::difference_type std::operator-(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _RefR, _PtrR>&)
     operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_deque.h:363:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/vector:65:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/stl_bvector.h:208:3: note: candidate: std::ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const std::_Bit_iterator_base&)
   operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y)
   ^~~~~~~~
/usr/include/c++/7/bits/stl_bvector.h:208:3: note:   no known conversion for argument 1 from 'std::complex<long long int>' to 'const std::_Bit_iterator_base&'
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
     ^
/usr/include/c++/7/bits/valarray_after.h:403:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)
     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
     ^
/usr/include/c++/7/bits/valarray_after.h:403:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
     ^
/usr/include/c++/7/bits/valarray_after.h:403:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
     ^
/usr/include/c++/7/bits/valarray_after.h:403:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
     ^
/usr/include/c++/7/bits/valarray_after.h:403:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from fangorn.cpp:1:
/usr/include/c++/7/valarray:1173:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const std::valarray<_Tp>&)
 _DEFINE_BINARY_OPERATOR(-, __minus)
 ^
/usr/include/c++/7/valarray:1173:1: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::valarray<_Tp>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from fangorn.cpp:1:
/usr/include/c++/7/valarray:1173:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const _Tp&)
 _DEFINE_BINARY_OPERATOR(-, __minus)
 ^
/usr/include/c++/7/valarray:1173:1: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   'std::complex<long long int>' is not derived from 'const std::valarray<_Tp>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from fangorn.cpp:1:
/usr/include/c++/7/valarray:1173:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const _Tp&, const std::valarray<_Tp>&)
 _DEFINE_BINARY_OPERATOR(-, __minus)
 ^
/usr/include/c++/7/valarray:1173:1: note:   template argument deduction/substitution failed:
fangorn.cpp:101:48: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                ^
fangorn.cpp:101:83: error: no match for 'operator-' (operand types are 'std::complex<long long int>' and 'int')
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                                            ~~~~~~~^~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:389:5: note: candidate: template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator-(const reverse_iterator<_IteratorL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:389:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:84: note:   'std::complex<long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                                                    ^
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:1191:5: note: candidate: template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)
     operator-(const move_iterator<_IteratorL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:1191:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:84: note:   'std::complex<long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                                                    ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/complex:356:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)
     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:356:5: note:   template argument deduction/substitution failed:
fangorn.cpp:101:84: note:   mismatched types 'const std::complex<_Tp>' and 'int'
                     if(cross(tree[y]-tree[x],g-x) != cross(tree[y]-tree[x],camp[i]-x)) {
                                                                                    ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from fangorn.cpp:1:
/usr/include/c++/7/complex:365:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&)
     operator-(const complex<_Tp>& __x, const _Tp& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:365:5: note:   template a