# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1182695 | asli_bg | Curtains (NOI23_curtains) | C++20 | Compilation error | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define int long long
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define FOR(i,a) for(int i=0;i<(a);i++)
#define FORE(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define pb push_back
#define sp <<" "<<
#define cont(x) for(auto el:x) cout<<el<<' ';cout<<endl;
#define contp(x) for(auto el:x) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl;
#define DEBUG(x) cout<<#x sp x<<endl;
#define carp(x,y) ((x%MOD)*(y%MOD))%MOD
#define topla(x,y) ((x%MOD)+(y%MOD))%MOD
#define mid (l+r)/2
const int MAXN=5e5+5;
const int MOD=1e9+7;
const int INF=1e18;
int n,m,q;
vii ar;
vi tut[MAXN], tut2[MAXN];
int close[MAXN];
bool ans[MAXN];
void dnc(vector<pair<pii,int>> qq,int l=1,int r=n){
if(qq.empty()) return;
if(l==r){
bool f=false;
for(auto el:tut[l]){
if(el==l) f=true;
}
for(auto el:qq){
int ind=el.se;
ans[ind]=f;
}
return;
}
//mid ile ortadan ikiye ayrılanlar için ans hesapla
int sonra,once;
vii vec;
for(int i=mid;i>=l;i--){
close[i]=INF;
sonra=INF;
once=-INF;
for(auto el:tut[i]){
if(el>r) continue;
if(el>=mid) sonra=min(sonra,el);
else once=max(once,el);
}
if(sonra>=mid) close[i]=min(close[i],sonra);
while(!vec.empty() and (vec.back().fi<=once+1 or vec.back().se>close[i])){
close[i]=min(close[i],vec.back().se);
vec.pop_back();
}
vec.pb({i,close[i]});
}
vec.clear();
FORE(i,mid+1,r+1){
close[i]=-INF;
sonra=-INF;
once=INF;
for(auto el:tut2[i]){
if(el<l) continue;
if(el<=mid+1) sonra=max(sonra,el);
else once=min(once,el);
}
if(sonra<=mid+1) close[i]=max(close[i],sonra);
while(!vec.empty() and (once-1<=vec.back().fi or vec.back().se<close[i])){
close[i]=max(close[i],vec.back().se);
vec.pop_back();
}
vec.pb({i,close[i]});
}
vector<pair<pii,int>> sol,sag;
FOR(i,qq.size()){
int bas=qq[i].fi.fi;
int son=qq[i].fi.se;
int ind=qq[i].se;
if(bas>=mid+1) sag.pb(qq[i]);
else if(son<=mid) sol.pb(qq[i]);
else{
//cevabını hesapladım
if(close[bas]<=son and close[son]>=bas) ans[ind]=true;
else ans[ind]=false;
}
}
dnc(sol,l,mid);
dnc(sag,mid+1,r);
}
bool mm(pii a,pii b){
return a.se<b.se;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
//freopen("out.txt","w",stdout);
cin>>n>>m>>q;
ar.resize(m+1);
FORE(i,1,m+1){
cin>>ar[i].fi>>ar[i].se;
}
sort(all(ar),mm);
FORE(i,1,m+1){
tut[ar[i].fi].pb(ar[i].se);
tut2[ar[i].se].pb(ar[i].fi);
}
vector<pair<pii,int>> qq;
FORE(i,1,q+1){
int l,r;
cin>>l>>r;
qq.pb({{l,r},i});
}
dnc(qq);
FORE(i,1,q+1){
if(ans[i]) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
Compilation message (stderr)
curtains.cpp:40:15: error: 'long long int close [500005]' redeclared as different kind of entity 40 | int close[MAXN]; | ^ In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24, from /usr/include/signal.h:328, from /usr/include/c++/11/csignal:42, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:43, from curtains.cpp:1: /usr/include/unistd.h:358:12: note: previous declaration 'int close(int)' 358 | extern int close (int __fd); | ^~~~~ curtains.cpp: In function 'void dnc(std::vector<std::pair<std::pair<long long int, long long int>, long long int> >, long long int, long long int)': curtains.cpp:64:16: warning: pointer to a function used in arithmetic [-Wpointer-arith] 64 | close[i]=INF; | ^ curtains.cpp:64:17: error: assignment of read-only location '*(close + ((sizetype)i))' 64 | close[i]=INF; | ~~~~~~~~^~~~ curtains.cpp:74:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 74 | if(sonra>=mid) close[i]=min(close[i],sonra); | ^ curtains.cpp:74:44: warning: pointer to a function used in arithmetic [-Wpointer-arith] 74 | if(sonra>=mid) close[i]=min(close[i],sonra); | ^ curtains.cpp:74:36: error: no matching function for call to 'min(int (&)(int), long long int&)' 74 | if(sonra>=mid) close[i]=min(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 230 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:230:5: note: template argument deduction/substitution failed: curtains.cpp:74:36: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 74 | if(sonra>=mid) close[i]=min(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 278 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:278:5: note: template argument deduction/substitution failed: curtains.cpp:74:36: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 74 | if(sonra>=mid) close[i]=min(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)' 3449 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3449:5: note: template argument deduction/substitution failed: curtains.cpp:74:36: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 74 | if(sonra>=mid) close[i]=min(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)' 3455 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3455:5: note: template argument deduction/substitution failed: curtains.cpp:74:36: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 74 | if(sonra>=mid) close[i]=min(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ curtains.cpp:76:79: warning: pointer to a function used in arithmetic [-Wpointer-arith] 76 | while(!vec.empty() and (vec.back().fi<=once+1 or vec.back().se>close[i])){ | ^ curtains.cpp:76:71: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 76 | while(!vec.empty() and (vec.back().fi<=once+1 or vec.back().se>close[i])){ | ~~~~~~~~~~~~~^~~~~~~~~ curtains.cpp:77:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 77 | close[i]=min(close[i],vec.back().se); | ^ curtains.cpp:77:33: warning: pointer to a function used in arithmetic [-Wpointer-arith] 77 | close[i]=min(close[i],vec.back().se); | ^ curtains.cpp:77:25: error: no matching function for call to 'min(int (&)(int), long long int&)' 77 | close[i]=min(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 230 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:230:5: note: template argument deduction/substitution failed: curtains.cpp:77:25: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 77 | close[i]=min(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 278 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:278:5: note: template argument deduction/substitution failed: curtains.cpp:77:25: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 77 | close[i]=min(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)' 3449 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3449:5: note: template argument deduction/substitution failed: curtains.cpp:77:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 77 | close[i]=min(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)' 3455 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3455:5: note: template argument deduction/substitution failed: curtains.cpp:77:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 77 | close[i]=min(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ curtains.cpp:81:26: warning: pointer to a function used in arithmetic [-Wpointer-arith] 81 | vec.pb({i,close[i]}); | ^ curtains.cpp:81:15: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)' 81 | vec.pb({i,close[i]}); | ~~~~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/11/vector:67, from /usr/include/c++/11/functional:62, from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/11/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from curtains.cpp:1: /usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]' 1187 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1187:35: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'} 1187 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]' 1203 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1203:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'} 1203 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ curtains.cpp:87:16: warning: pointer to a function used in arithmetic [-Wpointer-arith] 87 | close[i]=-INF; | ^ curtains.cpp:87:17: error: assignment of read-only location '*(close + ((sizetype)i))' 87 | close[i]=-INF; | ~~~~~~~~^~~~~ curtains.cpp:97:33: warning: pointer to a function used in arithmetic [-Wpointer-arith] 97 | if(sonra<=mid+1) close[i]=max(close[i],sonra); | ^ curtains.cpp:97:46: warning: pointer to a function used in arithmetic [-Wpointer-arith] 97 | if(sonra<=mid+1) close[i]=max(close[i],sonra); | ^ curtains.cpp:97:38: error: no matching function for call to 'max(int (&)(int), long long int&)' 97 | if(sonra<=mid+1) close[i]=max(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: curtains.cpp:97:38: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 97 | if(sonra<=mid+1) close[i]=max(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: curtains.cpp:97:38: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 97 | if(sonra<=mid+1) close[i]=max(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: curtains.cpp:97:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 97 | if(sonra<=mid+1) close[i]=max(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: curtains.cpp:97:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 97 | if(sonra<=mid+1) close[i]=max(close[i],sonra); | ~~~^~~~~~~~~~~~~~~~ curtains.cpp:99:79: warning: pointer to a function used in arithmetic [-Wpointer-arith] 99 | while(!vec.empty() and (once-1<=vec.back().fi or vec.back().se<close[i])){ | ^ curtains.cpp:99:71: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 99 | while(!vec.empty() and (once-1<=vec.back().fi or vec.back().se<close[i])){ | ~~~~~~~~~~~~~^~~~~~~~~ curtains.cpp:100:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 100 | close[i]=max(close[i],vec.back().se); | ^ curtains.cpp:100:33: warning: pointer to a function used in arithmetic [-Wpointer-arith] 100 | close[i]=max(close[i],vec.back().se); | ^ curtains.cpp:100:25: error: no matching function for call to 'max(int (&)(int), long long int&)' 100 | close[i]=max(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: curtains.cpp:100:25: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 100 | close[i]=max(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: curtains.cpp:100:25: note: deduced conflicting types for parameter 'const _Tp' ('int(int)' and 'long long int') 100 | close[i]=max(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: curtains.cpp:100:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 100 | close[i]=max(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from curtains.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: curtains.cpp:100:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(int)' 100 | close[i]=max(close[i],vec.back().se); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ curtains.cpp:104:26: warning: pointer to a function used in arithmetic [-Wpointer-arith] 104 | vec.pb({i,close[i]}); | ^ curtains.cpp:104:15: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)' 104 | vec.pb({i,close[i]}); | ~~~~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/11/vector:67, from /usr/include/c++/11/functional:62, from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/11/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from curtains.cpp:1: /usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]' 1187 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1187:35: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'} 1187 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]' 1203 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1203:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'} 1203 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ curtains.cpp:116:25: warning: pointer to a function used in arithmetic [-Wpointer-arith] 116 | if(close[bas]<=son and close[son]>=bas) ans[ind]=true; | ^ curtains.cpp:116:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 116 | if(close[bas]<=son and close[son]>=bas) ans[ind]=true; | ~~~~~~~~~~^~~~~ curtains.cpp:116:45: warning: pointer to a function used in arithmetic [-Wpointer-arith] 116 | if(close[bas]<=son and close[son]>=bas) ans[ind]=true; | ^ curtains.cpp:116:46: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 116 | if(close[bas]<=son and close[son]>=bas) ans[ind]=true; | ~~~~~~~~~~^~~~~