# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
157185 | 2019-10-10T02:43:01 Z | puppies_and_rainbows | Examination (JOI19_examination) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> #define int long long #define left dhusiad #define right dusanan using namespace std; pair<int, int> a[100005], cursort[100005]; int it[400005], root[400005]; int it1[100000005], left[100000005], right[100000005]; vector<vector<int> > check[100000005]; int cntnode=0, ans, ans1; int n; int itgen(int l, int r) { if(l>r) return 0; cntnode++; int id=cntnode; for(int i=l; i<=r; i++) { check[id].push_back(cursort[i].second); } it1[id]=cursort[r].first; sort(check[id].begin(), check[id].end()); int mid=(l+r)/2; if(l==r) return id; left[id]=itgen(l, mid); right[id]=itgen(mid+1, r); return id; } void build_tree(int id, int l, int r) { // cout<<"DEBUG "<<l<<" "<<r<<endl; for(int i=l; i<=r; i++) { cursort[i]={a[i].second, a[i].first+a[i].second}; // cout<<cursort[i].first<<" "<<cursort[i].second<<endl; } // cout<<endl; sort(cursort+l, cursort+r+1); // for(int i=l; i<=r; i++) // { // cout<<cursort[i].first<<" "<<cursort[i].second<<endl; // } // cout<<endl; root[id]=itgen(l, r); if(l==r) it[id]=a[l].first; else { int mid=(l+r)/2; build_tree(id*2, l, mid); build_tree(id*2+1, mid+1, r); it[id]=max(it[id*2], it[id*2+1]); } } void solvehave(int ok, int y, int z, int l, int r) { // cout<<l<<" "<<r<<" "<<ans1<<endl; int id=root[ok]; while(l<r) { int mid=(l+r)/2; if(it1[left[id]]>=y) { ans1+=(int)(check[right[id]].end()-lower_bound(check[right[id]].begin(), check[right[id]].end(), z)); id=left[id]; r=mid; } else { id=right[id]; l=mid+1; } } if(it1[id]>=y&&check[id][0]>=z) ans1++; // cout<<ans1<<endl; } void solvefail(int id, int z) { return; ans+=check[root[id]].end()-lower_bound(check[root[id]].begin(), check[root[id]].end(), z); } bool checkk(int id, int x, int y, int z) { if(a[id].first>=x&&a[id].second>=y&&a[id].first+a[id].second>=z) return true; return false; } int solve(int x, int y, int z) { ans=0, ans1=0; int id=1, l=1, r=n; while(l<r) { int mid=(l+r)/2; if(it[id*2]>=x) { solvehave(id*2+1, y, z, mid+1, r); id*=2; r=mid; } else { solvefail(id*2, z); id=id*2+1; l=mid+1; } } if(checkk(l, x, y, z)) { ans++; } return ans+ans1; } signed main() { int q; cin>>n>>q; for(int i=1; i<=n; i++) { cin>>a[i].first>>a[i].second; } sort(a+1, a+n+1); build_tree(1, 1, n); // cout<<1<<endl; // return 0; int x, y, z; for(int i=1; i<=q; i++) { cin>>x>>y>>z; cout<<solve(x, y, z)<<endl; } }
Compilation message
examination.cpp: In function 'long long int itgen(long long int, long long int)': examination.cpp:21:40: error: no matching function for call to 'std::vector<std::vector<long long int> >::push_back(long long int&)' check[id].push_back(cursort[i].second); ^ In file included from /usr/include/c++/7/vector:64:0, from /usr/include/c++/7/queue:61, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from examination.cpp:1: /usr/include/c++/7/bits/stl_vector.h:939:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>] push_back(const value_type& __x) ^~~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:939:7: note: no known conversion for argument 1 from 'long long int' to 'const value_type& {aka const std::vector<long long int>&}' /usr/include/c++/7/bits/stl_vector.h:953:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>] push_back(value_type&& __x) ^~~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:953:7: note: no known conversion for argument 1 from 'long long int' to 'std::vector<std::vector<long long int> >::value_type&& {aka std::vector<long long int>&&}' examination.cpp: In function 'void solvehave(long long int, long long int, long long int, long long int, long long int)': examination.cpp:77:29: error: no match for 'operator>=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' and 'long long int') if(it1[id]>=y&&check[id][0]>=z) ans1++; In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from examination.cpp:1: /usr/include/c++/7/bits/regex.h:984:5: note: candidate: template<class _BiIter> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&) operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) ^~~~~~~~ /usr/include/c++/7/bits/regex.h:984:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from examination.cpp:1: /usr/include/c++/7/bits/regex.h:1068:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>=(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&) operator>=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1068:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from examination.cpp:1: /usr/include/c++/7/bits/regex.h:1148:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&) operator>=(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1148:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from examination.cpp:1: /usr/include/c++/7/bits/regex.h:1222:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>=(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&) operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1222:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from examination.cpp:1: /usr/include/c++/7/bits/regex.h:1296:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*) operator>=(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1296:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from examination.cpp:1: /usr/include/c++/7/bits/regex.h:1376:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>=(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&) operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1376:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from examination.cpp:1: /usr/include/c++/7/bits/regex.h:1456:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&) operator>=(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1456:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/future:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105, from examination.cpp:1: /usr/include/c++/7/thread:297:3: note: candidate: bool std::operator>=(std::thread::id, std::thread::id) operator>=(thread::id __x, thread::id __y) noexcept ^~~~~~~~ /usr/include/c++/7/thread:297:3: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' to 'std::thread::id' In file included from /usr/include/c++/7/forward_list:38:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:104, from examination.cpp:1: /usr/include/c++/7/bits/forward_list.h:1413:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator>=(const std::forward_list<_Tp, _Alloc>&, const std::forward_list<_Tp, _Alloc>&) operator>=(const forward_list<_Tp, _Alloc>& __lx, ^~~~~~~~ /usr/include/c++/7/bits/forward_list.h:1413:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::forward_list<_Tp, _Alloc>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from examination.cpp:1: /usr/include/c++/7/valarray:1189:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__greater_equal, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__greater_equal, _Tp>::result_type> std::operator>=(const _Tp&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(>=, __greater_equal) ^ /usr/include/c++/7/valarray:1189:1: note: template argument deduction/substitution failed: examination.cpp:77:31: note: mismatched types 'const std::valarray<_Tp>' and 'long long int' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from examination.cpp:1: /usr/include/c++/7/valarray:1189:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__greater_equal, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__greater_equal, _Tp>::result_type> std::operator>=(const std::valarray<_Tp>&, const _Tp&) _DEFINE_BINARY_OPERATOR(>=, __greater_equal) ^ /usr/include/c++/7/valarray:1189:1: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::valarray<_Tp>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from examination.cpp:1: /usr/include/c++/7/valarray:1189:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__greater_equal, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__greater_equal, _Tp>::result_type> std::operator>=(const std::valarray<_Tp>&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(>=, __greater_equal) ^ /usr/include/c++/7/valarray:1189:1: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::valarray<_Tp>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ 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 examination.cpp:1: /usr/include/c++/7/bits/valarray_after.h:419:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater_equal, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__greater_equal, 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(>=, __greater_equal) ^ /usr/include/c++/7/bits/valarray_after.h:419:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ 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 examination.cpp:1: /usr/include/c++/7/bits/valarray_after.h:419:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater_equal, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__greater_equal, 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(>=, __greater_equal) ^ /usr/include/c++/7/bits/valarray_after.h:419:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ 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 examination.cpp:1: /usr/include/c++/7/bits/valarray_after.h:419:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater_equal, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__greater_equal, 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(>=, __greater_equal) ^ /usr/include/c++/7/bits/valarray_after.h:419:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ 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 examination.cpp:1: /usr/include/c++/7/bits/valarray_after.h:419:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__greater_equal, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__greater_equal, 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(>=, __greater_equal) ^ /usr/include/c++/7/bits/valarray_after.h:419:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ 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 examination.cpp:1: /usr/include/c++/7/bits/valarray_after.h:419:5: note: candidate: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__greater_equal, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__greater_equal, 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(>=, __greater_equal) ^ /usr/include/c++/7/bits/valarray_after.h:419:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/stack:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:89, from examination.cpp:1: /usr/include/c++/7/bits/stl_stack.h:335:5: note: candidate: template<class _Tp, class _Seq> bool std::operator>=(const std::stack<_Tp, _Seq>&, const std::stack<_Tp, _Seq>&) operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_stack.h:335:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::stack<_Tp, _Seq>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/set:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from examination.cpp:1: /usr/include/c++/7/bits/stl_multiset.h:941:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&) operator>=(const multiset<_Key, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_multiset.h:941:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::multiset<_Key, _Compare, _Alloc>' if(it1[id]>=y&&check[id][0]>=z) ans1++; ^ In file included from /usr/include/c++/7/set:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from examination.cpp:1: /usr/include/c++/7/bits/stl_set.h:958:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator>=(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&) operator>=(const set<_Key, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_set.h:958:5: note: template argument deduction/substitution failed: examination.cpp:77:31: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> > >::value_type {aka std::vector<long long int>}' is not derived from 'const std::set<_Key, _Compare, _Alloc>' if(it1[id]>=y&&check[id][0]>=z) ans1++;