제출 #218382

#제출 시각아이디문제언어결과실행 시간메모리
218382super_j6Split the Attractions (IOI19_split)C++14
컴파일 에러
0 ms0 KiB
split #include "split.h" #include <bits/stdc++.h> #define F first #define S second #define MP make_pair #define SZ(X) (int)X.size() #define PB push_back #define ALL(X) X.begin(),X.end() #define RI(X) scanf("%d",&X) #define RII(X,Y) scanf("%d%d",&X,&Y) #define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z) #define DRI(X) int X;scanf("%d",&X) #define DRII(X,Y) int X,Y;scanf("%d%d",&X,&Y) #define DRIII(X,Y,Z) int X,Y,Z;scanf("%d%d%d",&X,&Y,&Z) #define MS0(X) memset(X,0,sizeof(X)); #define MS1(X) memset(X,-1,sizeof(X)); #define REP(I,N) for(int I=0;I<N;++I) #define REPP(I,A,B) for(int I=A;I<B;++I) using namespace std; typedef pair<int,int> PII; typedef long long LL; typedef pair<LL,LL> PLL; vector<int> adj[200009],adj2[200009]; bool isap[200009]; int num[200009],low[200009],p[200009],ss[200009]; int curt=0; int N,E; int piva,pivb;//piva is the AP, pivb is the place to find a subtree? vector<PII> cci; bool possible = 1; vector<int> ans; int nodesleft; void dfs(int x,int par=-1){ num[x]=low[x]=curt++; ss[x]=1; p[x]=par; int children=0; for(int i:adj[x]){ if(i==par)continue; if(num[i]==-1){ children++; dfs(i,x); ss[x]+=ss[i]; low[x]=min(low[x],low[i]); if((par!=-1&&low[i]>=num[x])||(par==-1&&children>1)){ isap[x]=1; } adj2[x].PB(i); } else{ low[x]=min(low[x],num[i]); } } } void dfstree(int x,int v){ if(nodesleft==0)return; if(ans[x]!=cci[2].S)return; ans[x]=v; nodesleft --; for(int i:adj2[x])dfstree(i,v); } void dfsfree(int x,int v){ if(nodesleft==0)return; if(ans[x]!=cci[2].S)return; ans[x]=v; nodesleft --; for(int i:adj[x])dfsfree(i,v); } void solve(int x){ while(1){ bool bigchild=0; for(auto i:adj2[x]){ if(ss[i]>=cci[0].F){ bigchild=1; x = i; break; } } if(!bigchild)break; } //cout << "PIVOT" << x <<endl; ans[x] = cci[1].S; nodesleft = cci[1].F-1; for(int i:adj2[x]){ if(low[i]<num[x])continue; dfstree(i,cci[1].S);//down the tree only if(nodesleft==0)break; } for(int i:adj2[x]){ if(low[i]>=num[x])continue; dfstree(i,cci[1].S);//down the tree only if(nodesleft==0)break; } nodesleft = cci[0].F; if(p[x] != -1) dfsfree(p[x],cci[0].S); if(nodesleft)possible = 0; } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { N=n,E=SZ(p); cci.PB(MP(a,1));cci.PB(MP(b,2));cci.PB(MP(c,3)); sort(ALL(cci)); for(int i=0;i<E;i++) { adj[p[i]].PB(q[i]); adj[q[i]].PB(p[i]); } MS1(num); dfs(0,-1); for(int i=0;i<N;i++){ ans.PB(cci[2].S); } solve(0); if(!possible){ fill(ALL(ans),0); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

split.cpp:1:1: error: 'split' does not name a type; did you mean 'si_int'?
 split
 ^~~~~
 si_int
In file included from /usr/include/c++/7/bits/stl_algobase.h:62:0,
                 from /usr/include/c++/7/vector:60,
                 from split.h:5,
                 from split.cpp:2:
/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 split.h:5,
                 from split.cpp:2:
/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 split.h:5,
                 from split.cpp:2:
/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 split.h:5,
                 from split.cpp:2:
/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...>);