제출 #437784

#제출 시각아이디문제언어결과실행 시간메모리
437784yiqilim5438던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include"dungeons.h" using namespace std; typedef long long ll; typedef pair<ll,ll> pll; int n; int INF = 1e7+10; vector<int>s,p,w,l; vector<ll>wins(5e4+5,0ll); vector<pll>ls(5e4+5); vector<map<int,int>>mp(5e4+5); set<int,int>st; void init(int N,vector<int>S,vector<int>P,vector<int>W,vector<int>L){ n = N,s = S,p = P,w = W,l = L; for(int i = n-1;i>=0;i--){ wins[i] = s[i]+wins[w[i]]; st.insert(s[i]); } for(int i = 0;i<n;i++){ int x = i; for(int j = 1;j<=1000;j++){ mp[i][s[x]] = ls[i].first; ls[i].first += p[x]; x = l[x]; ls[i].second = x; if(x==n){ls[i].first = INF;break;} } } }; ll simulate(int x,int z){ if(z>=s[x]){ return z+wins[x]; } else{ bool ok = 0; for(auto i:st){ if(z+mp[x][i]>=i) ok = 1; } if(ok){ while(true){ if(x==n) return z; else if(z>=s[x]) return z+wins[x]; z += p[x]; x = l[x]; } } else{ z += ls[x].first; x = ls[x].second; return simulate(x,z); } } }

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

In file included from /usr/include/c++/10/map:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from dungeons.cpp:1:
/usr/include/c++/10/bits/stl_tree.h: In instantiation of 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = int]':
/usr/include/c++/10/bits/stl_tree.h:2154:4:   required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const int&; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>]'
/usr/include/c++/10/bits/stl_set.h:512:25:   required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = int; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = int]'
dungeons.cpp:18:26:   required from here
/usr/include/c++/10/bits/stl_tree.h:2101:35: error: expression cannot be used as a function
 2101 |    __comp = _M_impl._M_key_compare(__k, _S_key(__x));
      |             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:2112:33: error: expression cannot be used as a function
 2112 |       if (_M_impl._M_key_compare(_S_key(__j._M_node), __k))
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h: In instantiation of 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, _Arg&&, _NodeGen&) [with _Arg = const int&; _NodeGen = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::_Alloc_node; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::iterator; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr = std::_Rb_tree_node_base*]':
/usr/include/c++/10/bits/stl_tree.h:2159:26:   required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const int&; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>]'
/usr/include/c++/10/bits/stl_set.h:512:25:   required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = int; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = int]'
dungeons.cpp:18:26:   required from here
/usr/include/c++/10/bits/stl_tree.h:1813:35: error: expression cannot be used as a function
 1813 |          || _M_impl._M_key_compare(_KeyOfValue()(__v),
      |             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
 1814 |        _S_key(__p)));
      |        ~~~~~~~~~~~~                
/usr/include/c++/10/bits/stl_tree.h: In instantiation of 'static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type) [with _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<int>*]':
/usr/include/c++/10/bits/stl_tree.h:2101:47:   required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = int]'
/usr/include/c++/10/bits/stl_tree.h:2154:4:   required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const int&; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = int; _Alloc = std::allocator<int>]'
/usr/include/c++/10/bits/stl_set.h:512:25:   required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = int; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, int, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = int]'
dungeons.cpp:18:26:   required from here
/usr/include/c++/10/bits/stl_tree.h:772:16: error: static assertion failed: comparison object must be invocable with two arguments of key type
  772 |  static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{},
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~