Submission #163356

# Submission time Handle Problem Language Result Execution time Memory
163356 2019-11-12T19:57:16 Z TadijaSebez Golf (JOI17_golf) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=100050;
const int H=4*N;
const int inf=1e9+7;
struct compress
{
	vector<int> all;
	void Add(int x){ all.pb(x);}
	void Build(){ sort(all.begin(),all.end());all.erase(unique(all.begin(),all.end()),all.end());}
	int Get(int x){ return lower_bound(all.begin(),all.end(),x)-all.begin()+1;}
	int sz(){ return all.size();}
} xs,ys;
struct rec
{
	int type,x,l,r;
	rec(int t, int a, int b, int c):type(t),x(a),l(b),r(c){}
};
vector<rec> rs;
int x1[N],y1[N],x2[N],y2[N];
vector<pair<int,int>> Add[H],Del[H];
vector<int> fir,las;
int n,sx,sy,ex,ey;
void Build(int type)
{
	for(int i=1;i<=n;i++) Add[x1[i]].pb({y1[i],y2[i]}),Del[x2[i]].pb({y1[i],y2[i]});
    set<pair<int,int>> st;
    st.insert({1,1});st.insert({ys.sz(),ys.sz()});
    for(int x=1;x<=xs.sz();x++)
	{
        for(auto p:Del[x])
		{
			auto it=st.find(p),l=it,r=it;l--;r++;
			rs.pb(rec(type,x,l->second,r->first));
			st.erase(it);
		}
		if(sx==x)
		{
			auto r=st.lower_bound({sy,-inf}),l=r;l--;
			fir.pb(rs.size());
			rs.pb(rec(type,x,l->second,r->first));
		}
		if(ex==x)
		{
			auto r=st.lower_bound({ey,-inf}),l=r;l--;
			las.pb(rs.size());
			rs.pb(rec(type,x,l->second,r->first));
		}
		for(auto p:Add[x])
		{
			st.insert(p);
			auto it=st.find(p),l=it,r=it;l--;r++;
			rs.pb(rec(type,x,l->second,r->first));
		}
	}
	for(int i=1;i<=xs.sz();i++) Add[i].clear(),Del[i].clear();
	for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
}
const int M=H*2;
bool was[N];
int dist[N];
queue<int> q;
struct SegmentTree
{
	set<pair<int,int>> node[M];
	SegmentTree(){}
	void Ins(int x, int l, int r, int id)
	{
		for(l+=H,r+=H;l<=r;l>>=1,r>>=1)
		{
			if(l%2==1) node[l++].insert({x,id});
			if(r%2==0) node[r--].insert({x,id});
		}
	}
	void Take(int x, int l, int r, int d)
	{
		for(x+=H;x;x>>=1)
		{
			while(1)
			{
				auto it=node[x].lower_bound({l,-inf});
				if(it==node[x].end() || it->first>r) break;
				int id=it->second;
				node[x].erase(it);
				if(!was[id]) was[id]=1,dist[id]=d+1,q.push(id);
			}
		}
	}
} ST[2];
int main()
{
	scanf("%i %i %i %i",&sx,&sy,&ex,&ey);
	scanf("%i",&n);
	xs.Add(0);xs.Add(inf);ys.Add(0);ys.Add(inf);xs.Add(sx);xs.Add(ex);ys.Add(sy);ys.Add(ey);
	for(int i=1;i<=n;i++) scanf("%i %i %i %i",&x1[i],&x2[i],&y1[i],&y2[i]),xs.Add(x1[i]),xs.Add(x2[i]),ys.Add(y1[i]),ys.Add(y2[i]);
	xs.Build();ys.Build();
	sx=xs.Get(sx);ex=xs.Get(ex);sy=ys.Get(sy);ey=ys.Get(ey);
	for(int i=1;i<=n;i++) x1[i]=xs.Get(x1[i]),x2[i]=xs.Get(x2[i]),y1[i]=ys.Get(y1[i]),y2[i]=ys.Get(y2[i]);
	Build(0);Build(1);
	for(int i=0;i<rs.size();i++) ST[rs[i].type].Ins(rs[i].x,rs[i].l,rs[i].r,i);
	for(int i:fir)
	{
		if(rs[i].type==0)
		{
			if(ex==rs[i].x && ey>=rs[i].l && ey<=rs[i].r) return 0*printf("1\n");
		}
		else
		{
			if(ey==rs[i].x && ex>=rs[i].l && ex<=rs[i].r) return 0*printf("1\n");
		}
		q.push(i),was[i]=1;
	}
	while(q.size())
	{
		int x=q.front();
		q.pop();
		ST[rs[x].type^1].Take(rs[x].x,rs[x].l,rs[x].r,dist[x]);
	}
	int ans=1e9+7;
	for(int i:las) if(was[i]) ans=min(ans,dist[i]);
	printf("%i\n",ans+1);
	return 0;
}

Compilation message

golf.cpp:22:15: error: 'int y1 [100050]' redeclared as different kind of symbol
 int x1[N],y1[N],x2[N],y2[N];
               ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533,
                 from /usr/include/c++/7/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from golf.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:251:1: note: previous declaration 'double y1(double)'
 __MATHCALL (y1,, (_Mdouble_));
 ^
golf.cpp: In function 'void Build(int)':
golf.cpp:28:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  for(int i=1;i<=n;i++) Add[x1[i]].pb({y1[i],y2[i]}),Del[x2[i]].pb({y1[i],y2[i]});
                                           ^
golf.cpp:28:51: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
  for(int i=1;i<=n;i++) Add[x1[i]].pb({y1[i],y2[i]}),Del[x2[i]].pb({y1[i],y2[i]});
                                                   ^
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 golf.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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, 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 '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
golf.cpp:28:72: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  for(int i=1;i<=n;i++) Add[x1[i]].pb({y1[i],y2[i]}),Del[x2[i]].pb({y1[i],y2[i]});
                                                                        ^
golf.cpp:28:80: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
  for(int i=1;i<=n;i++) Add[x1[i]].pb({y1[i],y2[i]}),Del[x2[i]].pb({y1[i],y2[i]});
                                                                                ^
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 golf.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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, 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 '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
golf.cpp:59:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                       ^
golf.cpp:59:40: error: no matching function for call to 'swap(int&, double (&)(double) throw ())'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/complex:45:0,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from golf.cpp:1:
/usr/include/c++/7/sstream:796:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&)
     swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
     ^~~~
/usr/include/c++/7/sstream:796:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/complex:45:0,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from golf.cpp:1:
/usr/include/c++/7/sstream:803:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&)
     swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
     ^~~~
/usr/include/c++/7/sstream:803:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/complex:45:0,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from golf.cpp:1:
/usr/include/c++/7/sstream:810:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&)
     swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
     ^~~~
/usr/include/c++/7/sstream:810:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/complex:45:0,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from golf.cpp:1:
/usr/include/c++/7/sstream:817:5: note: candidate: template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&)
     swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
     ^~~~
/usr/include/c++/7/sstream:817:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
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 golf.cpp:1:
/usr/include/c++/7/bits/regex.h:805:5: note: candidate: template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&)
     swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
     ^~~~
/usr/include/c++/7/bits/regex.h:805:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
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 golf.cpp:1:
/usr/include/c++/7/bits/regex.h:1958:5: note: candidate: template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(std::__cxx11::match_results<_BiIter, _Alloc>&, std::__cxx11::match_results<_BiIter, _Alloc>&)
     swap(match_results<_Bi_iter, _Alloc>& __lhs,
     ^~~~
/usr/include/c++/7/bits/regex.h:1958:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/unordered_set:48:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:118,
                 from golf.cpp:1:
/usr/include/c++/7/bits/unordered_set.h:1528:5: note: candidate: template<class _Value, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&, std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>&)
     swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
     ^~~~
/usr/include/c++/7/bits/unordered_set.h:1528:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/unordered_set:48:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:118,
                 from golf.cpp:1:
/usr/include/c++/7/bits/unordered_set.h:1521:5: note: candidate: template<class _Value, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_set<_Value, _Hash, _Pred, _Alloc>&, std::unordered_set<_Value, _Hash, _Pred, _Alloc>&)
     swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
     ^~~~
/usr/include/c++/7/bits/unordered_set.h:1521:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/unordered_map:48:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:117,
                 from golf.cpp:1:
/usr/include/c++/7/bits/unordered_map.h:1904:5: note: candidate: template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&, std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&)
     swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
     ^~~~
/usr/include/c++/7/bits/unordered_map.h:1904:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/unordered_map:48:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:117,
                 from golf.cpp:1:
/usr/include/c++/7/bits/unordered_map.h:1897:5: note: candidate: template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> void std::swap(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&, std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&)
     swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
     ^~~~
/usr/include/c++/7/bits/unordered_map.h:1897:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105:0,
                 from golf.cpp:1:
/usr/include/c++/7/future:1579:5: note: candidate: template<class _Res, class ... _ArgTypes> void std::swap(std::packaged_task<_Res(_ArgTypes ...)>&, std::packaged_task<_Res(_ArgTypes ...)>&)
     swap(packaged_task<_Res(_ArgTypes...)>& __x,
     ^~~~
/usr/include/c++/7/future:1579:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::packaged_task<_Res(_ArgTypes ...)>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105:0,
                 from golf.cpp:1:
/usr/include/c++/7/future:1144:5: note: candidate: template<class _Res> void std::swap(std::promise<_Res>&, std::promise<_Res>&)
     swap(promise<_Res>& __x, promise<_Res>& __y) noexcept
     ^~~~
/usr/include/c++/7/future:1144:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::promise<_Res>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
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 golf.cpp:1:
/usr/include/c++/7/thread:263:3: note: candidate: void std::swap(std::thread&, std::thread&)
   swap(thread& __x, thread& __y) noexcept
   ^~~~
/usr/include/c++/7/thread:263:3: note:   no known conversion for argument 1 from 'int' to 'std::thread&'
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 golf.cpp:1:
/usr/include/c++/7/bits/forward_list.h:1427:5: note: candidate: template<class _Tp, class _Alloc> void std::swap(std::forward_list<_Tp, _Alloc>&, std::forward_list<_Tp, _Alloc>&)
     swap(forward_list<_Tp, _Alloc>& __lx,
     ^~~~
/usr/include/c++/7/bits/forward_list.h:1427:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::forward_list<_Tp, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
In file included from /usr/include/c++/7/condition_variable:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:103,
                 from golf.cpp:1:
/usr/include/c++/7/bits/std_mutex.h:363:5: note: candidate: template<class _Mutex> void std::swap(std::unique_lock<_Mutex>&, std::unique_lock<_Mutex>&)
     swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept
     ^~~~
/usr/include/c++/7/bits/std_mutex.h:363:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::unique_lock<_Mutex>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
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 golf.cpp:1:
/usr/include/c++/7/bits/stl_stack.h:347:5: note: candidate: template<class _Tp, class _Seq> void std::swap(std::stack<_Tp, _Seq>&, std::stack<_Tp, _Seq>&)
     swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
     ^~~~
/usr/include/c++/7/bits/stl_stack.h:347:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::stack<_Tp, _Seq>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
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 golf.cpp:1:
/usr/include/c++/7/bits/stl_multiset.h:948:5: note: candidate: template<class _Key, class _Compare, class _Alloc> void std::swap(std::multiset<_Key, _Compare, _Alloc>&, std::multiset<_Key, _Compare, _Alloc>&)
     swap(multiset<_Key, _Compare, _Alloc>& __x,
     ^~~~
/usr/include/c++/7/bits/stl_multiset.h:948:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::multiset<_Key, _Compare, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);
                                        ^
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 golf.cpp:1:
/usr/include/c++/7/bits/stl_set.h:965:5: note: candidate: template<class _Key, class _Compare, class _Alloc> void std::swap(std::set<_Key, _Compare, _Alloc>&, std::set<_Key, _Compare, _Alloc>&)
     swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y)
     ^~~~
/usr/include/c++/7/bits/stl_set.h:965:5: note:   template argument deduction/substitution failed:
golf.cpp:59:40: note:   mismatched types 'std::set<_Key, _Compare, _Alloc>' and 'int'
  for(int i=1;i<=n;i++) swap(x1[i],y1[i]),swap(x2[i],y2[i]);swap(sx,sy);swap(ex,ey);swap(xs,ys);