Submission #257434

# Submission time Handle Problem Language Result Execution time Memory
257434 2020-08-04T09:13:47 Z tinjyu Sky Walking (IOI19_walk) C++14
Compilation error
0 ms 0 KB
    walk

            #include "walk.h"
            #include <iostream>
            #include <algorithm>
            #include <cmath>
            using namespace std;
            struct node{
            	long long int dis,id;
            }t[1000005];
            long long int p[1000005],hp[1000005],dis[1000005],m,n,road[1000005],map[1000005][3],pointer[100005][50][2],num[100005],cont,st,cnt;
            int connect(int a,int b,int len)
            {
            	//cout<<a<<" "<<p[a]<<" "<<hp[a]<<" "<<b<<" "<<p[b]<<" "<<hp[b]<<endl;
            	cont++;
            	map[cont][0]=b;
            	map[cont][1]=road[a];
            	map[cont][2]=len;
            	road[a]=cont;
            	cont++;
            	map[cont][0]=a;
            	map[cont][1]=road[b];
            	map[cont][2]=len;
            	road[b]=cont;
            	return 0;
            }
            struct cmp{
            	bool operator()(const node &a,const node &b)
            	{
            		return a.dis<b.dis;
            	}
            };
            int dijk()
            {
            	for(int i=1;i<=cnt;i++)dis[i]=1000000000000;
            	dis[st]=0;
            	t[1].id=st;
            	t[1].dis=0;
            	long long int pp=1;
            	while(pp>=1)
            	{
            		pop_heap(t+1,t+pp+1,cmp());
            		long long int x=t[pp].id,len=t[pp].dis;
            		pp--;
            		if(len!=dis[x])
            		{
            			continue;
            		}
            		//cout<<x<<" "<<len<<" "<<p[x]<<endl;
            		long long int g=road[x];
            		while(g!=-1){
            			long long int now=map[g][0];
            			//cout<<now<<" "<<dis[now]<<" "<<p[now]<<" "<<hp[now]<<endl;
            			if(len+map[g][2]<dis[now]){
            				dis[now]=len+map[g][2];
            				pp++;
            				t[pp].id=now;
            				t[pp].dis=dis[now];
            				push_heap(t+1,t+pp+1,cmp());
            			}
            			g=map[g][1];
            		}
            		for(int i=1;i<=num[p[x]];i++)
            		{
            			long long int now=pointer[p[x]][i][0];
            			if(now==x)continue;
            			//cout<<now<<" "<<dis[now]<<" "<<p[now]<<" "<<hp[now]<<endl;
            			if(len+abs(hp[x]-pointer[p[x]][i][1])<dis[now]){
            				dis[now]=len+abs(hp[x]-pointer[p[x]][i][1]);
            				pp++;
            				t[pp].id=now;
            				t[pp].dis=dis[now];
            				push_heap(t+1,t+pp+1,cmp());
            			}
            			g=map[g][1];
            		}
            		//cout<<endl;
             
            	}
            	return 0;
            }
            long long min_distance(std::vector<int> x, std::vector<int> h, std::vector<int> l, std::vector<int> r, std::vector<int> y, int s, int g) {
            	n=x.size();
            	m=l.size();
            	for(int i=0;i<=n*m;i++)road[i]=-1;
            	st=0;
            	for(int i=0;i<m;i++){
            		cnt++;
            		num[l[i]]++;
            		p[cnt]=l[i];
            		hp[cnt]=y[i];
            		pointer[l[i]][num[l[i]]][0]=cnt;
            		pointer[l[i]][num[l[i]]][1]=y[i];
            		long long int pr=cnt,prex=x[l[i]];
            		for(int j=l[i]+1;j<=r[i];j++){
            			if(h[j]>=y[i])
            			{
            				cnt++;
            				num[j]++;
            				p[cnt]=j;
            				hp[cnt]=y[i];
            				pointer[j][num[j]][0]=cnt;
            				pointer[j][num[j]][1]=y[i];
            				connect(cnt,pr,x[j]-prex);
            				pr=cnt;
            				prex=x[j];
            			}
            		}
            	}
            	num[s]++;
            	cnt++;
            	p[cnt]=s;
            	pointer[s][num[s]][0]=cnt;
            	st=cnt;
             
            	num[g]++;
            	cnt++;
            	p[cnt]=g;
            	pointer[g][num[g]][0]=cnt;
            	dijk();
            	return dis[cnt];
            }

Compilation message

walk.cpp:2:5: error: 'walk' does not name a type
     walk
     ^~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:62:0,
                 from /usr/include/c++/7/vector:60,
                 from walk.h:4,
                 from walk.cpp:4:
/usr/include/c++/7/ext/type_traits.h:162:35: error: 'bool __gnu_cxx::__is_null_pointer' redeclared as different kind of symbol
   __is_null_pointer(std::nullptr_t)
                                   ^
/usr/include/c++/7/ext/type_traits.h:157:5: note: previous declaration 'template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)'
     __is_null_pointer(_Type)
     ^~~~~~~~~~~~~~~~~
/usr/include/c++/7/ext/type_traits.h:162:26: error: 'nullptr_t' is not a member of 'std'
   __is_null_pointer(std::nullptr_t)
                          ^~~~~~~~~
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/stl_pair.h:59,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/vector:60,
                 from walk.h:4,
                 from walk.cpp:4:
/usr/include/c++/7/type_traits:362:31: error: 'std::size_t' has not been declared
   template<typename _Tp, std::size_t _Size>
                               ^~~~~~
/usr/include/c++/7/type_traits:363:25: error: '_Size' was not declared in this scope
     struct is_array<_Tp[_Size]>
                         ^~~~~
/usr/include/c++/7/type_traits:363:31: error: template argument 1 is invalid
     struct is_array<_Tp[_Size]>
                               ^
/usr/include/c++/7/type_traits:561:42: error: 'nullptr_t' is not a member of 'std'
     struct __is_null_pointer_helper<std::nullptr_t>
                                          ^~~~~~~~~
/usr/include/c++/7/type_traits:561:42: error: 'nullptr_t' is not a member of 'std'
/usr/include/c++/7/type_traits:561:51: error: template argument 1 is invalid
     struct __is_null_pointer_helper<std::nullptr_t>
                                                   ^
/usr/include/c++/7/type_traits:1464:37: error: 'size_t' is not a member of 'std'
     : public integral_constant<std::size_t, __alignof__(_Tp)> { };
                                     ^~~~~~
/usr/include/c++/7/type_traits:1464:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/7/type_traits:1464:61: error: template argument 1 is invalid
     : public integral_constant<std::size_t, __alignof__(_Tp)> { };
                                                             ^
/usr/include/c++/7/type_traits:1464:61: note: invalid template non-type parameter
/usr/include/c++/7/type_traits:1469:37: error: 'size_t' is not a member of 'std'
     : public integral_constant<std::size_t, 0> { };
                                     ^~~~~~
/usr/include/c++/7/type_traits:1469:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/7/type_traits:1469:46: error: template argument 1 is invalid
     : public integral_constant<std::size_t, 0> { };
                                              ^
/usr/include/c++/7/type_traits:1469:46: note: invalid template non-type parameter
/usr/include/c++/7/type_traits:1471:31: error: 'std::size_t' has not been declared
   template<typename _Tp, std::size_t _Size>
                               ^~~~~~
/usr/include/c++/7/type_traits:1472:21: error: '_Size' was not declared in this scope
     struct rank<_Tp[_Size]>
                     ^~~~~
/usr/include/c++/7/type_traits:1472:27: error: template argument 1 is invalid
     struct rank<_Tp[_Size]>
                           ^
/usr/include/c++/7/type_traits:1473:37: error: 'size_t' is not a member of 'std'
     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
                                     ^~~~~~
/usr/include/c++/7/type_traits:1473:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/7/type_traits:1473:65: error: template argument 1 is invalid
     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
                                                                 ^
/usr/include/c++/7/type_traits:1473:65: note: invalid template non-type parameter
/usr/include/c++/7/type_traits:1477:37: error: 'size_t' is not a member of 'std'
     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
                                     ^~~~~~
/usr/include/c++/7/type_traits:1477:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/7/type_traits:1477:65: error: template argument 1 is invalid
     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
                                                                 ^
/usr/include/c++/7/type_traits:1477:65: note: invalid template non-type parameter
/usr/include/c++/7/type_traits:1482:37: error: 'size_t' is not a member of 'std'
     : public integral_constant<std::size_t, 0> { };
                                     ^~~~~~
/usr/include/c++/7/type_traits:1482:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/7/type_traits:1482:46: error: template argument 1 is invalid
     : public integral_constant<std::size_t, 0> { };
                                              ^
/usr/include/c++/7/type_traits:1482:46: note: invalid template non-type parameter
/usr/include/c++/7/type_traits:1484:47: error: 'std::size_t' has not been declared
   template<typename _Tp, unsigned _Uint, std::size_t _Size>
                                               ^~~~~~
/usr/include/c++/7/type_traits:1485:23: error: '_Size' was not declared in this scope
     struct extent<_Tp[_Size], _Uint>
                       ^~~~~
/usr/include/c++/7/type_traits:1485:36: error: template argument 1 is invalid
     struct extent<_Tp[_Size], _Uint>
                                    ^
/usr/include/c++/7/type_traits:1486:37: error: 'size_t' is not a member of 'std'
     : public integral_constant<std::size_t,
                                     ^~~~~~
/usr/include/c++/7/type_traits:1486:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/7/type_traits:1487:24: error: '_Size' was not declared in this scope
           _Uint == 0 ? _Size : extent<_Tp,
                        ^~~~~
/usr/include/c++/7/type_traits:1488:28: error: template argument 1 is invalid
           _Uint - 1>::value>
                            ^
/usr/include/c++/7/type_traits:1488:28: note: invalid template non-type parameter
/usr/include/c++/7/type_traits:1493:37: error: 'size_t' is not a member of 'std'
     : public integral_constant<std::size_t,
                                     ^~~~~~
/usr/include/c++/7/type_traits:1493:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/7/type_traits:1495:31: error: template argument 1 is invalid
              _Uint - 1>::value>
                               ^
/usr/include/c++/7/type_traits:1495:31: note: invalid template non-type parameter
/usr/include/c++/7/type_traits:1944:31: error: 'std::size_t' has not been declared
   template<typename _Tp, std::size_t _Size>
                               ^~~~~~
/usr/include/c++/7/type_traits:1945:30: error: '_Size' was not declared in this scope
     struct remove_extent<_Tp[_Size]>
                              ^~~~~
/usr/include/c++/7/type_traits:1945:36: error: template argument 1 is invalid
     struct remove_extent<_Tp[_Size]>
                                    ^
/usr/include/c++/7/type_traits:1957:31: error: 'std::size_t' has not been declared
   template<typename _Tp, std::size_t _Size>
                               ^~~~~~
/usr/include/c++/7/type_traits:1958:35: error: '_Size' was not declared in this scope
     struct remove_all_extents<_Tp[_Size]>
                                   ^~~~~
/usr/include/c++/7/type_traits:1958:41: error: template argument 1 is invalid
     struct remove_all_extents<_Tp[_Size]>
                                         ^
/usr/include/c++/7/type_traits:2016:17: error: 'std::size_t' has not been declared
   template<std::size_t _Len>
                 ^~~~~~
/usr/include/c++/7/type_traits:2021:23: error: '_Len' was not declared in this scope
  unsigned char __data[_Len];
                       ^~~~
/usr/include/c++/7/type_traits:2036:17: error: 'std::size_t' has not been declared
   template<std::size_t _Len, std::size_t _Align =
                 ^~~~~~
/usr/include/c++/7/type_traits:2036:35: error: 'std::size_t' has not been declared
   template<std::size_t _Len, std::size_t _Align =
                                   ^~~~~~
/usr/include/c++/7/type_traits:2037:48: error: '_Len' was not declared in this scope
     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
                                                ^~~~
/usr/include/c++/7/type_traits:2037:52: error: template argument 1 is invalid
     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
                                                    ^
/usr/include/c++/7/type_traits:2042:23: error: '_Len' was not declared in this scope
  unsigned char __data[_Len];
                       ^~~~
/usr/include/c++/7/type_traits:2043:37: error: '_Align' was not declared in this scope
  struct __attribute__((__aligned__((_Align)))) { } __align;
                                     ^~~~~~
/usr/include/c++/7/type_traits:2050:20: error: 'size_t' does not name a type; did you mean '__size_t'?
       static const size_t _S_alignment = 0;
                    ^~~~~~
                    __size_t
/usr/include/c++/7/type_traits:2051:20: error: 'size_t' does not name a type; did you mean '__size_t'?
       static const size_t _S_size = 0;
                    ^~~~~~
                    __size_t
/usr/include/c++/7/type_traits:2057:20: error: 'size_t' does not name a type; did you mean '__size_t'?
       static const size_t _S_alignment =
                    ^~~~~~
                    __size_t
/usr/include/c++/7/type_traits:2060:20: error: 'size_t' does not name a type; did you mean '__size_t'?
       static const size_t _S_size =
                    ^~~~~~
                    __size_t
/usr/include/c++/7/type_traits:2075:13: error: 'size_t' has not been declared
   template <size_t _Len, typename... _Types>
             ^~~~~~
/usr/include/c++/7/type_traits:2082:20: error: 'size_t' does not name a type; did you mean '__size_t'?
       static const size_t _S_len = _Len > __strictest::_S_size
                    ^~~~~~
                    __size_t
/usr/include/c++/7/type_traits:2086:20: error: 'size_t' does not name a type; did you mean '__size_t'?
       static const size_t alignment_value = __strictest::_S_alignment;
                    ^~~~~~
                    __size_t
/usr/include/c++/7/type_traits:2088:40: error: '_S_len' was not declared in this scope
       typedef typename aligned_storage<_S_len, alignment_value>::type type;
                                        ^~~~~~
/usr/include/c++/7/type_traits:2088:48: error: 'alignment_value' was not declared in this scope
       typedef typename aligned_storage<_S_len, alignment_value>::type type;
                                                ^~~~~~~~~~~~~~~
/usr/include/c++/7/type_traits:2088:48: note: suggested alternative: 'alignment_of'
       typedef typename aligned_storage<_S_len, alignment_value>::type type;
                                                ^~~~~~~~~~~~~~~
                                                alignment_of
/usr/include/c++/7/type_traits:2088:63: error: template argument 1 is invalid
       typedef typename aligned_storage<_S_len, alignment_value>::type type;
                                                               ^
/usr/include/c++/7/type_traits:2088:63: error: template argument 2 is invalid
/usr/include/c++/7/type_traits:2091:13: error: 'size_t' has not been declared
   template <size_t _Len, typename... _Types>
             ^~~~~~
/usr/include/c++/7/type_traits:2092:11: error: 'size_t' does not name a type; did you mean '__size_t'?
     const size_t aligned_union<_Len, _Types...>::alignment_value;
           ^~~~~~
           __size_t
/usr/include/c++/7/type_traits:2463:12: error: 'size_t' has not been declared
   template<size_t _Len, size_t _Align =
            ^~~~~~
/usr/include/c++/7/type_traits:2463:25: error: 'size_t' has not been declared
   template<size_t _Len, size_t _Align =
                         ^~~~~~
/usr/include/c++/7/type_traits:2464:49: error: '_Len' was not declared in this scope
      __alignof__(typename __aligned_storage_msa<_Len>::__type)>
                                                 ^~~~
/usr/include/c++/7/type_traits:2464:53: error: template argument 1 is invalid
      __alignof__(typename __aligned_storage_msa<_Len>::__type)>
                                                     ^
/usr/include/c++/7/type_traits:2465:56: error: '_Len' was not declared in this scope
     using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
                                                        ^~~~
/usr/include/c++/7/type_traits:2465:62: error: '_Align' was not declared in this scope
     using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
                                                              ^~~~~~
/usr/include/c++/7/type_traits:2465:68: error: template argument 1 is invalid
     using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
                                                                    ^
/usr/include/c++/7/type_traits:2465:68: error: template argument 2 is invalid
/usr/include/c++/7/type_traits:2467:13: error: 'size_t' has not been declared
   template <size_t _Len, typename... _Types>
             ^~~~~~
/usr/include/c++/7/type_traits:2468:52: error: '_Len' was not declared in this scope
     using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
                                                    ^~~~
/usr/include/c++/7/type_traits:2468:67: error: template argument 1 is invalid
     using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
                                                                   ^
/usr/include/c++/7/type_traits:2581:26: error: 'size_t' has not been declared
   template<typename _Tp, size_t _Nm>
                          ^~~~~~
/usr/include/c++/7/type_traits:2584:21: error: '_Nm' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                     ^~~
/usr/include/c++/7/type_traits:2584:24: error: 'template<class _Tp, <declaration error> > typename std::enable_if<std::__is_swappable<_Tp>::value>::type std::swap' conflicts with a previous declaration
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                        ^
/usr/include/c++/7/type_traits:2577:5: note: previous declaration 'typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&)'
     swap(_Tp&, _Tp&)
     ^~~~
/usr/include/c++/7/type_traits:2584:16: error: '__a' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                ^~~
/usr/include/c++/7/type_traits:2584:16: note: suggested alternative: '__N'
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                ^~~
                __N
/usr/include/c++/7/type_traits:2584:21: error: '_Nm' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                     ^~~
/usr/include/c++/7/type_traits:2584:33: error: '__b' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                                 ^~~
/usr/include/c++/7/type_traits:2584:33: note: suggested alternative: '__N'
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                                 ^~~
                                 __N
/usr/include/c++/7/type_traits:2584:38: error: '_Nm' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                                      ^~~
/usr/include/c++/7/type_traits:2585:5: error: expected ';' before 'noexcept'
     noexcept(__is_nothrow_swappable<_Tp>::value);
     ^~~~~~~~
In file included from /usr/include/c++/7/bits/stl_pair.h:59:0,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/vector:60,
                 from walk.h:4,
                 from walk.cpp:4:
/usr/include/c++/7/bits/move.h:206:26: error: 'size_t' has not been declared
   template<typename _Tp, size_t _Nm>
                          ^~~~~~
/usr/include/c++/7/bits/move.h:210:21: error: '_Nm' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                     ^~~
/usr/include/c++/7/bits/move.h:210:24: error: 'template<class _Tp, <declaration error> > typename std::enable_if<std::__is_swappable<_Tp>::value>::type std::swap' conflicts with a previous declaration
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                        ^
/usr/include/c++/7/bits/move.h:187:5: note: previous declaration 'typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&)'
     swap(_Tp& __a, _Tp& __b)
     ^~~~
/usr/include/c++/7/bits/move.h:210:16: error: '__a' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                ^~~
/usr/include/c++/7/bits/move.h:210:16: note: suggested alternative: '__N'
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                ^~~
                __N
/usr/include/c++/7/bits/move.h:210:21: error: '_Nm' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                     ^~~
/usr/include/c++/7/bits/move.h:210:33: error: '__b' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                                 ^~~
/usr/include/c++/7/bits/move.h:210:33: note: suggested alternative: '__N'
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                                 ^~~
                                 __N
/usr/include/c++/7/bits/move.h:210:38: error: '_Nm' was not declared in this scope
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
                                      ^~~
/usr/include/c++/7/bits/move.h:211:5: error: expected ';' before 'noexcept'
     noexcept(__is_nothrow_swappable<_Tp>::value)
     ^~~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/7/vector:60,
                 from walk.h:4,
                 from walk.cpp:4:
/usr/include/c++/7/bits/stl_pair.h:86:17: error: 'std::size_t' has not been declared
   template<std::size_t...>
                 ^~~~~~
/usr/include/c++/7/bits/stl_pair.h:429:41: error: 'std::size_t' has not been declared
       template<typename... _Args1, std::size_t... _Indexes1,
                                         ^~~~~~
/usr/include/c++/7/bits/stl_pair.h:430:41: error: 'std::size_t' has not been declared
                typename... _Args2, std::size_t... _Indexes2>
                                         ^~~~~~
/usr/include/c++/7/bits/stl_pair.h:432:27: error: '_Indexes1' was not declared in this scope
              _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
                           ^~~~~~~~~
/usr/include/c++/7/bits/stl_pair.h:432:27: note: suggested alternative: '_Index_tuple'
              _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
                           ^~~~~~~~~
                           _Index_tuple
/usr/include/c++/7/bits/stl_pair.h:432:36: error: expected parameter pack before '...'
              _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
                                    ^~~
/usr/include/c++/7/bits/stl_pair.h:432:39: error: template argument 1 is invalid
              _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);