Submission #466560

#TimeUsernameProblemLanguageResultExecution timeMemory
466560flappybirdFun Tour (APIO20_fun)C++14
Compilation error
0 ms0 KiB
대회 문제 답안 목록 기여하기 답안 #466555 # 제출 시각UTC+9 아이디 문제 언어 결과 실행 시간 메모리 466555 2021-08-20 01:06:33 flappybird 즐거운 행로 (APIO20_fun) C++14 66 / 100 265 ms 21376 KB fun #include "fun.h" #include <bits/stdc++.h> #include <cassert> #define e(v) ( ( (v).empty() ) ? (pair<int, int>(-1, -1) ) : ( (v)[(v).size()-1] ) ) using namespace std; typedef int ll; vector<int> createFunTour(int N, int Q) { if (N == 2) { vector<ll> v; v.push_back(0); v.push_back(1); return v; } vector<ll> res; ll i; for (i = 0; i < N; i++) res.push_back(attractionsBehind(0, i)); ll c = 0; ll mn = 1010101010; for (i = 0; i < N; i++) { if (res[i] >= (N + 1) / 2) { if (mn > res[i]) mn = res[i], c = i; } } vector<pair<ll, ll>> dis; vector<vector<pair<ll, ll>>> subtree; subtree.resize(3); ll num; for (i = 0; i < N; i++) { if (i == c) continue; dis.push_back({ hoursRequired(i, c), i }); } sort(dis.begin(), dis.end()); num = 1; subtree[0].push_back(dis[0]); for (i = 1; i < dis.size(); i++) { ll j; for (j = 0; j < num; j++) { if (j == 2) break; if (hoursRequired(dis[i].second, subtree[j][0].second) != dis[i].first + subtree[j][0].first) break; } if (j == num) num++; subtree[j].push_back(dis[i]); } vector<ll> ans; assert(num >= 2); if (num == 2) { ll r = N; ll a; if (subtree[0].size() < subtree[1].size()) a = 1; else a = 0; while (r != 1) { ans.push_back(e(subtree[a]).second); subtree[a].pop_back(); a = !a; r--; } ans.push_back(c); } else { ll chk = 0; ll r = N; ll a; vector<ll> asdf(N); if (e(subtree[0]).first > e(subtree[1]).first) swap(subtree[0], subtree[1]); if (e(subtree[1]).first > e(subtree[2]).first) swap(subtree[1], subtree[2]); if (e(subtree[0]).first == e(subtree[1]).first && subtree[0].size() > subtree[1].size()) swap(subtree[0], subtree[1]); if (e(subtree[1]).first == e(subtree[2]).first && subtree[1].size() > subtree[2].size()) swap(subtree[1], subtree[2]); for (i = 0; i < 3; i++) { for (auto x : subtree[i]) { assert(!asdf[x.second]); asdf[x.second]++; } } for (i = 0; i < N; i++) { assert(asdf[i] <= 1); } a = 2; ll abc=c; assert((2*max({ subtree[0].size(), subtree[1].size(), subtree[2].size() }) <= (N))); while (r != 1) { ll b, c; b = a + 1; c = a + 2; b %= 3; c %= 3; ll loc = subtree[a][subtree[a].size() - 1].second; //assert(asdf[loc] == a); ans.push_back(loc); subtree[a].pop_back(); if (chk||2*max({ subtree[0].size(), subtree[1].size(), subtree[2].size() }) >= (r)-2) { chk = 1; ll mx = max({ subtree[0].size(), subtree[1].size(), subtree[2].size() }); ll na=a; if (a!=0&&mx == subtree[0].size()) na = 0; if (a!=1&&mx == subtree[1].size()) na = 1; if (a!=2&&mx == subtree[2].size()) na = 2; if (na == a) { if(subtree[b].empty()&&subtree[c].empty()) {                    while(1);                    ans.push_back(abc); ans.push_back(subtree[a][0].second); return ans; } else if (e(subtree[b]).first < e(subtree[c]).first) a = c; else if (e(subtree[b]).first == e(subtree[c]).first && (subtree[b].size() < subtree[c].size())) a = c; else a = b; } else a = na; } else { if (e(subtree[b]).first < e(subtree[c]).first) a = c; else if (e(subtree[b]).first == e(subtree[c]).first && (subtree[b].size() < subtree[c].size())) a = c; else a = b; } r--; } for (i = 0; i < ans.size(); i++) assert(ans[i] != c); ans.push_back(c); } vector<ll> asdfsdf(N); for (i = 0; i < N; i++) asdfsdf[ans[i]] = 1; for (i = 0; i < N; i++) assert(asdfsdf[i]); return ans; }

Compilation message (stderr)

fun.cpp:6:8: error: stray '#' in program
    6 | 답안 #466555
      |      ^
fun.cpp:9:3: error: invalid preprocessing directive #\U0000c81c\U0000cd9c
    9 | # 제출 시각UTC+9 아이디 문제 언어 결과 실행 시간 메모리
      |   ^~~~
fun.cpp:10:13: error: invalid digit "8" in octal constant
   10 | 466555 2021-08-20 01:06:33 flappybird 즐거운 행로 (APIO20_fun) C++14
      |             ^~
fun.cpp:115:2: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |  ^
fun.cpp:115:5: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |    ^
fun.cpp:115:8: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |      ^
fun.cpp:115:11: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |        ^
fun.cpp:115:14: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |          ^
fun.cpp:115:17: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |            ^
fun.cpp:115:20: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |              ^
fun.cpp:115:23: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |                ^
fun.cpp:115:26: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |                  ^
fun.cpp:115:29: error: extended character   is not valid in an identifier
  115 |                     while(1);
      |                    ^
fun.cpp:116:2: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |  ^
fun.cpp:116:5: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |    ^
fun.cpp:116:8: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |      ^
fun.cpp:116:11: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |        ^
fun.cpp:116:14: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |          ^
fun.cpp:116:17: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |            ^
fun.cpp:116:20: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |              ^
fun.cpp:116:23: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |                ^
fun.cpp:116:26: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |                  ^
fun.cpp:116:29: error: extended character   is not valid in an identifier
  116 |                     ans.push_back(abc);
      |                    ^
fun.cpp:2:1: error: '\U0000b300\U0000d68c' does not name a type
    2 | 대회
      | ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:62,
                 from /usr/include/c++/10/vector:60,
                 from fun.h:1,
                 from fun.cpp:14:
/usr/include/c++/10/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++/10/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++/10/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++/10/bits/move.h:57,
                 from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from fun.h:1,
                 from fun.cpp:14:
/usr/include/c++/10/type_traits:200:27: error: 'size_t' has not been declared
  200 |   template <typename _Tp, size_t = sizeof(_Tp)>
      |                           ^~~~~~
/usr/include/c++/10/type_traits:402:31: error: 'std::size_t' has not been declared
  402 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/10/type_traits:403:25: error: '_Size' was not declared in this scope
  403 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/10/type_traits:403:31: error: template argument 1 is invalid
  403 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/10/type_traits:508:42: error: 'nullptr_t' is not a member of 'std'
  508 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                          ^~~~~~~~~
/usr/include/c++/10/type_traits:508:42: error: 'nullptr_t' is not a member of 'std'
/usr/include/c++/10/type_traits:508:51: error: template argument 1 is invalid
  508 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                                   ^
/usr/include/c++/10/type_traits:984:26: error: 'size_t' has not been declared
  984 |   template<typename _Tp, size_t _Num>
      |                          ^~~~~~
/usr/include/c++/10/type_traits:985:49: error: '_Num' was not declared in this scope
  985 |     struct __is_nt_constructible_impl<true, _Tp[_Num]>
      |                                                 ^~~~
/usr/include/c++/10/type_traits:985:54: error: template argument 2 is invalid
  985 |     struct __is_nt_constructible_impl<true, _Tp[_Num]>
      |                                                      ^
/usr/include/c++/10/type_traits:1351:37: error: 'size_t' is not a member of 'std'
 1351 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1351:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1351:57: error: template argument 1 is invalid
 1351 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/10/type_traits:1351:57: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1360:37: error: 'size_t' is not a member of 'std'
 1360 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1360:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1360:46: error: template argument 1 is invalid
 1360 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/10/type_traits:1360:46: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1362:31: error: 'std::size_t' has not been declared
 1362 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/10/type_traits:1363:21: error: '_Size' was not declared in this scope
 1363 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/10/type_traits:1363:27: error: template argument 1 is invalid
 1363 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/10/type_traits:1364:37: error: 'size_t' is not a member of 'std'
 1364 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1364:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1364:65: error: template argument 1 is invalid
 1364 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/10/type_traits:1364:65: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1368:37: error: 'size_t' is not a member of 'std'
 1368 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1368:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1368:65: error: template argument 1 is invalid
 1368 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/10/type_traits:1368:65: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1373:37: error: 'size_t' is not a member of 'std'
 1373 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1373:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1373:46: error: template argument 1 is invalid
 1373 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/10/type_traits:1373:46: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1375:47: error: 'std::size_t' has not been declared
 1375 |   template<typename _Tp, unsigned _Uint, std::size_t _Size>
      |                                               ^~~~~~
/usr/include/c++/10/type_traits:1376:23: error: '_Size' was not declared in this scope
 1376 |     struct extent<_Tp[_Size], _Uint>
      |                       ^~~~~
/usr/include/c++/10/type_traits:1376:36: error: template argument 1 is invalid
 1376 |     struct extent<_Tp[_Size], _Uint>
      |                                    ^
/usr/include/c++/10/type_traits:1377:37: error: 'size_t' is not a member of 'std'
 1377 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1377:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1378:24: error: '_Size' was not declared in this scope
 1378 |           _Uint == 0 ? _Size : extent<_Tp,
      |                        ^~~~~
/usr/include/c++/10/type_traits:1379:28: error: template argument 1 is invalid
 1379 |           _Uint - 1>::value>
      |                            ^
/usr/include/c++/10/type_traits:1379:28: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1384:37: error: 'size_t' is not a member of 'std'
 1384 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1384:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1386:31: error: template argument 1 is invalid
 1386 |              _Uint - 1>::value>
      |                               ^
/usr/include/c++/10/type_traits:1386:31: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1753:26: error: 'size_t' does not name a type
 1753 |       { static constexpr size_t __size = sizeof(_Tp); };
      |                          ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
                 from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from fun.h:1,
                 from fun.cpp:14:
/usr/include/c++/10/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++/10/bits/move.h:57,
                 from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from fun.h:1,
                 from fun.cpp:14:
/usr/include/c++/10/type_traits:1755:14: error: 'size_t' has not been declared
 1755 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |              ^~~~~~
/usr/include/c++/10/type_traits:1755:48: error: '_Sz' was not declared in this scope
 1755 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                                ^~~
/usr/include/c++/10/type_traits:1756:14: error: no default argument for '_Tp'
 1756 |       struct __select;
      |              ^~~~~~~~
/usr/include/c++/10/type_traits:1758:14: error: 'size_t' has not been declared
 1758 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/10/type_traits:1759:23: error: '_Sz' was not declared in this scope
 1759 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                       ^~~
/usr/include/c++/10/type_traits:1759:57: error: template argument 1 is invalid
 1759 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                                                         ^
/usr/include/c++/10/type_traits:1762:14: error: 'size_t' has not been declared
 1762 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/10/type_traits:1763:23: error: '_Sz' was not declared in this scope
 1763 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                       ^~~
/usr/include/c++/10/type_traits:1763:58: error: template argument 1 is invalid
 1763 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                                                          ^
/usr/include/c++/10/type_traits:1764:18: error: '_Sz' was not declared in this scope
 1764 |       : __select<_Sz, _List<_UInts...>>
      |                  ^~~
/usr/include/c++/10/type_traits:1764:38: error: template argument 1 is invalid
 1764 |       : __select<_Sz, _List<_UInts...>>
      |                                      ^~
/usr/include/c++/10/type_traits:1755:60: 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>'
 1755 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                                            ^~~~~~
/usr/include/c++/10/type_traits:1777:68: error: template argument 3 is invalid
 1777 |       using __unsigned_type = typename __select<sizeof(_Tp), _UInts>::__type;
      |                                                                    ^
/usr/include/c++/10/type_traits:1781:40: error: '__unsigned_type' was not declared in this scope
 1781 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                        ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1781:55: error: template argument 2 is invalid
 1781 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                                       ^
/usr/include/c++/10/type_traits:1793:61: error: '__type' in 'class std::__make_unsigned_selector<wchar_t, false, true>' does not name a type
 1793 |  = typename __make_unsigned_selector<wchar_t, false, true>::__type;
      |                                                             ^~~~~~
/usr/include/c++/10/type_traits:1810:62: error: '__type' in 'class std::__make_unsigned_selector<char16_t, false, true>' does not name a type
 1810 |  = typename __make_unsigned_selector<char16_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/10/type_traits:1817:62: error: '__type' in 'class std::__make_unsigned_selector<char32_t, false, true>' does not name a type
 1817 |  = typename __make_unsigned_selector<char32_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/10/type_traits: In instantiation of 'class std::__make_unsigned_selector<wchar_t, true, false>':
/usr/include/c++/10/type_traits:1904:62:   required from 'class std::__make_signed_selector<wchar_t, false, true>'
/usr/include/c++/10/type_traits:1919:57:   required from here
/usr/include/c++/10/type_traits:1738:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1738 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1742:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1742 |       using __type
      |             ^~~~~~
/usr/include/c++/10/type_traits:1919:59: error: invalid combination of multiple type-specifiers
 1919 |  = typename __make_signed_selector<wchar_t, false, true>::__type;
      |                                                           ^~~~~~
/usr/include/c++/10/type_traits: In instantiation of 'class std::__make_unsigned_selector<char16_t, true, false>':
/usr/include/c++/10/type_traits:1904:62:   required from 'class std::__make_signed_selector<char16_t, false, true>'
/usr/include/c++/10/type_traits:1936:58:   required from here
/usr/include/c++/10/type_traits:1738:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1738 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1742:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1742 |       using __type
      |             ^~~~~~
/usr/include/c++/10/type_traits:1936:60: error: invalid combination of multiple type-specifiers
 1936 |  = typename __make_signed_selector<char16_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/10/type_traits: In instantiation of 'class std::__make_unsigned_selector<char32_t, true, false>':
/usr/include/c++/10/type_traits:1904:62:   required from 'class std::__make_signed_selector<char32_t, false, true>'
/usr/include/c++/10/type_traits:1943:58:   required from here
/usr/include/c++/10/type_traits:1738:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1738 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1742:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1742 |       using __type
      |             ^~~~~~
/usr/include/c++/10/type_traits:1943:60: error: invalid combination of multiple type-specifiers
 1943 |  = typename __make_signed_selector<char32_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/10/type_traits:1975:31: error: 'std::size_t' has not been declared
 1975 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/10