답안 #397140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
397140 2021-05-01T14:17:27 Z idk321 Simurgh (IOI17_simurgh) C++11
컴파일 오류
0 ms 0 KB
    simurgh

    #include "simurgh.h"


    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;

    const int N = 240;
    const int M = 28680;
    vector<array<int, 2>> adj[N];
    int n;
    int m;

    int in[N];
    int up[N];
    int timer;
    bool done[N];

    void bridges(int node, int par, int pEdge)
    {
        in[node] = ++timer;
        up[node] = in[node];

        for (auto next : adj[node])
        {
            if (next[0] == par) continue;
            if (in[next[0]] == 0)
            {
                bridges(next[0], node, next[1]);
                up[node] = min(up[node], up[next[0]]);
            } else
            {
                up[node] = min(up[node], up[next[0]]);
            }
        }

        if (par != -1 && up[node] == in[node])
        {
            done[pEdge] = true;
        }
    }

    int p[N];

    int getRoot(int a)
    {
        if (p[a] == a) return a;
        p[a] = getRoot(p[a]);
        return p[a];
    }

    void join(int a, int b)
    {
        a = getRoot(a);
        b = getRoot(b);
        p[b] = a;
    }


    std::vector<int> find_roads(int XD, std::vector<int> u, std::vector<int> v) {
        n = XD;
        m = u.size();
        for (int i = 0; i < m; i++)
        {
            adj[u[i]].push_back({v[i], i});
            adj[v[i]].push_back({u[i], i});
        }

        bridges(0, -1, -1);


        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                p[j] = j;
            }

            vector<int> gold;
            for (int i = 0; i < m; i++)
            {
                if (done[i])
                {
                     join(u[i], v[i]);
                     gold.push_back(i);
                }
            }
            for (int j = 0; j < m; j++)
            {
                if (u[j] != i && v[j] != i && getRoot(u[j]) != getRoot(v[j]))
                {
                    join(u[j], v[j]);
                    gold.push_back(j);
                }
            }

            int best = 0;
            int goodEdge = -1;
            for (auto next : adj[i])
            {
                if (done[next[1]])
                {
                    gold.push_back(next[1]);
                    //cout << gold.size() << endl;
                    int quer = count_common_roads(gold);
                    best = quer;
                    gold.pop_back();
                    break;
                }
            }
            vector<int> toAdd;
            for (auto next : adj[i])
            {
                if (done[next[1]]) continue;
                if (getRoot(i) != getRoot(next[0]))
                {
                    gold.push_back(next[1]);
                    //cout << gold.size() << endl;
                    int quer = count_common_roads(gold);
                    gold.pop_back();
                    if (quer == best)
                    {
                        toAdd.push_back(next[1]);
                    } else if (quer > best)
                    {
                        best = quer;
                        toAdd.clear();
                        toAdd.push_back(next[1]);
                    }
                }
            }

            for (int edge : toAdd)
            {
                done[edge] = true;
            }
        }

    	vector<int> res;
    	for (int i = 0; i < m; i++) if (done[i]) res.push_back(i);


    	return res;
    }

Compilation message

simurgh.cpp:2:5: error: 'simurgh' does not name a type
    2 |     simurgh
      |     ^~~~~~~
In file included from /usr/include/c++/9/bits/stl_algobase.h:62,
                 from /usr/include/c++/9/vector:60,
                 from simurgh.h:1,
                 from simurgh.cpp:4:
/usr/include/c++/9/ext/type_traits.h:162:35: error: 'bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
  162 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/9/ext/type_traits.h:157:5: note: previous declaration 'template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)'
  157 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/ext/type_traits.h:162:26: error: 'nullptr_t' is not a member of 'std'
  162 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from simurgh.h:1,
                 from simurgh.cpp:4:
/usr/include/c++/9/type_traits:361:31: error: 'std::size_t' has not been declared
  361 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/9/type_traits:362:25: error: '_Size' was not declared in this scope
  362 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/9/type_traits:362:31: error: template argument 1 is invalid
  362 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/9/type_traits:560:42: error: 'nullptr_t' is not a member of 'std'
  560 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                          ^~~~~~~~~
/usr/include/c++/9/type_traits:560:42: error: 'nullptr_t' is not a member of 'std'
/usr/include/c++/9/type_traits:560:51: error: template argument 1 is invalid
  560 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                                   ^
/usr/include/c++/9/type_traits:1253:37: error: 'size_t' is not a member of 'std'
 1253 |     : public integral_constant<std::size_t, alignof(_Tp)> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1253:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/9/type_traits:1253:57: error: template argument 1 is invalid
 1253 |     : public integral_constant<std::size_t, alignof(_Tp)> { };
      |                                                         ^
/usr/include/c++/9/type_traits:1253:57: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1258:37: error: 'size_t' is not a member of 'std'
 1258 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1258:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/9/type_traits:1258:46: error: template argument 1 is invalid
 1258 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/9/type_traits:1258:46: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1260:31: error: 'std::size_t' has not been declared
 1260 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/9/type_traits:1261:21: error: '_Size' was not declared in this scope
 1261 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/9/type_traits:1261:27: error: template argument 1 is invalid
 1261 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/9/type_traits:1262:37: error: 'size_t' is not a member of 'std'
 1262 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1262:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/9/type_traits:1262:65: error: template argument 1 is invalid
 1262 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/9/type_traits:1262:65: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1266:37: error: 'size_t' is not a member of 'std'
 1266 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1266:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/9/type_traits:1266:65: error: template argument 1 is invalid
 1266 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/9/type_traits:1266:65: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1271:37: error: 'size_t' is not a member of 'std'
 1271 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1271:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/9/type_traits:1271:46: error: template argument 1 is invalid
 1271 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/9/type_traits:1271:46: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1273:47: error: 'std::size_t' has not been declared
 1273 |   template<typename _Tp, unsigned _Uint, std::size_t _Size>
      |                                               ^~~~~~
/usr/include/c++/9/type_traits:1274:23: error: '_Size' was not declared in this scope
 1274 |     struct extent<_Tp[_Size], _Uint>
      |                       ^~~~~
/usr/include/c++/9/type_traits:1274:36: error: template argument 1 is invalid
 1274 |     struct extent<_Tp[_Size], _Uint>
      |                                    ^
/usr/include/c++/9/type_traits:1275:37: error: 'size_t' is not a member of 'std'
 1275 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1275:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/9/type_traits:1276:24: error: '_Size' was not declared in this scope
 1276 |           _Uint == 0 ? _Size : extent<_Tp,
      |                        ^~~~~
/usr/include/c++/9/type_traits:1277:28: error: template argument 1 is invalid
 1277 |           _Uint - 1>::value>
      |                            ^
/usr/include/c++/9/type_traits:1277:28: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1282:37: error: 'size_t' is not a member of 'std'
 1282 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1282:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/9/type_traits:1284:31: error: template argument 1 is invalid
 1284 |              _Uint - 1>::value>
      |                               ^
/usr/include/c++/9/type_traits:1284:31: note: invalid template non-type parameter
/usr/include/c++/9/type_traits:1616:26: error: 'size_t' does not name a type
 1616 |       { static constexpr size_t __size = sizeof(_Tp); };
      |                          ^~~~~~
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from simurgh.h:1,
                 from simurgh.cpp:4:
/usr/include/c++/9/type_traits:1:1: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | // C++11 <type_traits> -*- C++ -*-
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from simurgh.h:1,
                 from simurgh.cpp:4:
/usr/include/c++/9/type_traits:1618:14: error: 'size_t' has not been declared
 1618 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |              ^~~~~~
/usr/include/c++/9/type_traits:1618:48: error: '_Sz' was not declared in this scope
 1618 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                                ^~~
/usr/include/c++/9/type_traits:1619:14: error: no default argument for '_Tp'
 1619 |       struct __select;
      |              ^~~~~~~~
/usr/include/c++/9/type_traits:1621:14: error: 'size_t' has not been declared
 1621 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/9/type_traits:1622:23: error: '_Sz' was not declared in this scope
 1622 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                       ^~~
/usr/include/c++/9/type_traits:1622:57: error: template argument 1 is invalid
 1622 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                                                         ^
/usr/include/c++/9/type_traits:1625:14: error: 'size_t' has not been declared
 1625 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/9/type_traits:1626:23: error: '_Sz' was not declared in this scope
 1626 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                       ^~~
/usr/include/c++/9/type_traits:1626:58: error: template argument 1 is invalid
 1626 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                                                          ^
/usr/include/c++/9/type_traits:1627:18: error: '_Sz' was not declared in this scope
 1627 |       : __select<_Sz, _List<_UInts...>>
      |                  ^~~
/usr/include/c++/9/type_traits:1627:38: error: template argument 1 is invalid
 1627 |       : __select<_Sz, _List<_UInts...>>
      |                                      ^~
/usr/include/c++/9/type_traits:1618:52: error: '__size' is not a member of 'std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>'
 1618 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                               ~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1640:68: error: template argument 3 is invalid
 1640 |       using __unsigned_type = typename __select<sizeof(_Tp), _UInts>::__type;
      |                                                                    ^
/usr/include/c++/9/type_traits:1644:40: error: '__unsigned_type' was not declared in this scope
 1644 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                        ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1644:55: error: template argument 2 is invalid
 1644 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                                       ^
/usr/include/c++/9/type_traits:1656:61: error: '__type' in 'class std::__make_unsigned_selector<wchar_t, false, true>' does not name a type
 1656 |  = typename __make_unsigned_selector<wchar_t, false, true>::__type;
      |                                                             ^~~~~~
/usr/include/c++/9/type_traits:1673:62: error: '__type' in 'class std::__make_unsigned_selector<char16_t, false, true>' does not name a type
 1673 |  = typename __make_unsigned_selector<char16_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/9/type_traits:1680:62: error: '__type' in 'class std::__make_unsigned_selector<char32_t, false, true>' does not name a type
 1680 |  = typename __make_unsigned_selector<char32_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'class std::__make_unsigned_selector<wchar_t, true, false>':
/usr/include/c++/9/type_traits:1767:62:   required from 'class std::__make_signed_selector<wchar_t, false, true>'
/usr/include/c++/9/type_traits:1782:57:   required from here
/usr/include/c++/9/type_traits:1601:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1601 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1605:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1605 |       using __type
      |             ^~~~~~
/usr/include/c++/9/type_traits:1782:59: error: invalid combination of multiple type-specifiers
 1782 |  = typename __make_signed_selector<wchar_t, false, true>::__type;
      |                                                           ^~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'class std::__make_unsigned_selector<char16_t, true, false>':
/usr/include/c++/9/type_traits:1767:62:   required from 'class std::__make_signed_selector<char16_t, false, true>'
/usr/include/c++/9/type_traits:1799:58:   required from here
/usr/include/c++/9/type_traits:1601:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1601 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1605:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1605 |       using __type
      |             ^~~~~~
/usr/include/c++/9/type_traits:1799:60: error: invalid combination of multiple type-specifiers
 1799 |  = typename __make_signed_selector<char16_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/9/type_traits: In instantiation of 'class std::__make_unsigned_selector<char32_t, true, false>':
/usr/include/c++/9/type_traits:1767:62:   required from 'class std::__make_signed_selector<char32_t, false, true>'
/usr/include/c++/9/type_traits:1806:58:   required from here
/usr/include/c++/9/type_traits:1601:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1601 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/9/type_traits:1605:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1605 |       using __type
      |             ^~~~~~
/usr/include/c++/9/type_traits:1806:60: error: invalid combination of multiple type-specifiers
 1806 |  = typename __make_signed_selector<char32_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/9/type_traits:1838:31: error: 'std::size_t' has not been declared
 1838 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/9/type_traits:1839:30: error: '_Size' was not declared in this scope
 1839 |     struct remove_extent<_Tp[_Size]>
      |                              ^~~~~
/usr/include/c++/9/type_traits:1839:36: error: template argument 1 is invalid
 1839 |     struct remove_extent<_Tp[_Size]>
      |                                    ^
/usr/include/c++/9/type_traits:1851:31: error: 'std::size_t' has not been declared
 1851 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/9/type_traits:1852:35: error: '_Size' was not declared in this scope
 1852 |     struct remove_all_extents<_Tp[_Size]>
      |                                   ^~~~~
/usr/include/c++/9/type_traits:1852:41: error: template argument 1 is invalid
 1852 |     struct remove_all_extents<_Tp[_Size]>
      |                                         ^
/usr/include/c++/9/type_traits:1910:17: error: 'std::size_t' has not been declared
 1910 |   template<std::size_t _Len>
      |                 ^~~~~~
/usr/include/c++/9/type_traits:1915:23: error: '_Len' was not declared in this scope
 1915 |  unsigned char __data[_Len];
      |                       ^~~~
/usr/include/c++/9/type_traits:1930:17: error: 'std::size_t' has not been declared
 1930 |   template<std::size_t _Len, std::size_t _Align =
      |                 ^~~~~~
/usr/include/c++/9/type_traits:1930:35: error: 'std::size_t' has not been declared
 1930 |   template<std::size_t _Len, std::size_t _Align =
      |                                   ^~~~~~
/usr/include/c++/9/type_traits:1931:48: error: '_Len' was not declared in this scope
 1931 |     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                ^~~~
/usr/include/c++/9/type_traits:1931:52: error: template argument 1 is invalid
 1931 |     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                    ^
/usr/include/c++/9/type_traits:1936:23: error: '_Len' was not declared in this scope
 1936 |  unsigned char __data[_Len];
      |                       ^~~~
/usr/include/c++/9/type_traits:1937:37: error: '_Align' was not declared in this scope
 1937 |  struct __attribute__((__aligned__((_Align)))) { } __align;
      |                                     ^~~~~~
/usr/include/c++/9/type_traits:1944:20: error: 'size_t' does not name a type
 1944 |       static const size_t _S_alignment = 0;
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1944:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1945:20: error: 'size_t' does not name a type
 1945 |       static const size_t _S_size = 0;
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1945:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1951:20: error: 'size_t' does not name a type
 1951 |       static const size_t _S_alignment =
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1951:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1954:20: error: 'size_t' does not name a type
 1954 |       static const size_t _S_size =
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1954:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1969:13: error: 'size_t' has not been declared
 1969 |   template <size_t _Len, typename... _Types>
      |             ^~~~~~
/usr/include/c++/9/type_traits:1976:20: error: 'size_t' does not name a type
 1976 |       static const size_t _S_len = _Len > __strictest::_S_size
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1976:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1980:20: error: 'size_t' does not name a type
 1980 |       static const size_t alignment_value = __strictest::_S_alignment;
      |                    ^~~~~~
/usr/include/c++/9/type_traits:1980:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/9/type_traits:1982:40: error: '_S_len' was not declared in this scope
 1982 |       typedef typename aligned_storage<_S_len, alignment_value>::type type;
      |                                        ^~~~~~
/usr/include/c++/9/type_traits:1982:48: error: 'alignment_value' was not declared in this scope; did you mean 'alignment_of'?
 1982 |       typedef typename aligned_storage<_S_len, alignme