Submission #619826

#TimeUsernameProblemLanguageResultExecution timeMemory
619826A_DAliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; const int N=5e2+11; const long long LINF = 1e18; long long dp[N][N]; pair<long long,long long> a[N]; pair<long long,long long> b[N]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { vector<long long,long long> vec; for(int j=1;j<=n;j++){ dp[0][j]=1e18; dp[j][0]=1e18; } for(int i=0;i<n;i++){ if(r[i]<c[i])swap(r[i],c[i]); a[i+1]={r[i],c[i]}; } sort(a+1,a+n+1); pair<long long,long long> lst=a[n]; vec.push_back(lst); for(int i=n-1;i>=1;i--){ if(a[i].second>=lst.second){ a[i]={-1,-1}; } else{ lst=a[i]; vec.push_back(lst); } } n=vec.size(); for(int i=0;i<n;i++){ a[i+1]=vec[i]; } for(int i=1;i<=n;i++){ for(int j=1;j<=k;j++){ dp[i][j] = LINF; if(a[i].first==-1&&a[i].second==-1)continue; long long ret=1e18; long long mn=a[i].second; long long mx=a[i].first; for(int h=i;h>=1;h--){ if(a[h].first==-1&&a[h].second==-1)continue; mn=min(mn,a[h].second); mx=max(mx,a[h].first); if(dp[h-1][j-1]==1e18)continue; long long u=(mx-mn+1)*(mx-mn+1)+dp[h-1][j-1]; ret=min(ret,u); } dp[i][j]=ret; } } // cout<<dp[0][0]<<" "<<dp[1][1]<<"\n"; long long ret=1e18; for(int i=1;i<=k;i++){ ret=min(ret,dp[n][i]); } return ret; }

Compilation message (stderr)

In file included from /usr/include/c++/10/vector:67,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<long long int, long long int>':
/usr/include/c++/10/bits/stl_vector.h:389:11:   required from 'class std::vector<long long int, long long int>'
aliens.cpp:16:33:   required from here
/usr/include/c++/10/bits/stl_vector.h:87:21: error: 'long long int' is not a class, struct, or union type
   87 |  rebind<_Tp>::other _Tp_alloc_type;
      |                     ^~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:89:9: error: 'long long int' is not a class, struct, or union type
   89 |         pointer;
      |         ^~~~~~~
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'class std::vector<long long int, long long int>':
aliens.cpp:16:33:   required from here
/usr/include/c++/10/bits/stl_vector.h:404:64: error: 'long long int' is not a class, struct, or union type
  404 |       static_assert(is_same<typename _Alloc::value_type, _Tp>::value,
      |                                                                ^~~~~
/usr/include/c++/10/bits/stl_vector.h:474:20: error: '_M_allocate' has not been declared in 'std::_Base<long long int, long long int>'
  474 |       using _Base::_M_allocate;
      |                    ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:475:20: error: '_M_deallocate' has not been declared in 'std::_Base<long long int, long long int>'
  475 |       using _Base::_M_deallocate;
      |                    ^~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:477:20: error: '_M_get_Tp_allocator' has not been declared in 'std::_Base<long long int, long long int>'
  477 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:59,
                 from /usr/include/c++/10/vector:60,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = long long int; _Alloc = long long int]':
aliens.cpp:16:33:   recursively required from 'std::vector<_Tp, _Alloc>::vector() [with _Tp = long long int; _Alloc = long long int]'
aliens.cpp:16:33:   required from here
/usr/include/c++/10/bits/stl_vector.h:131:17: error: 'long long int' is not a class, struct, or union type
  131 |  _Vector_impl() _GLIBCXX_NOEXCEPT_IF(
      |                 ^~~~~~~~~~~~~~~~~~~~
aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:28:22: error: no matching function for call to 'std::vector<long long int, long long int>::push_back(std::pair<long long int, long long int>&)'
   28 |     vec.push_back(lst);
      |                      ^
In file included from /usr/include/c++/10/vector:67,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = long long int; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const value_type&' {aka 'const long long int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = long long int; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::vector<long long int, long long int>::value_type&&' {aka 'long long int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
aliens.cpp:35:22: error: no matching function for call to 'std::vector<long long int, long long int>::push_back(std::pair<long long int, long long int>&)'
   35 |     vec.push_back(lst);
      |                      ^
In file included from /usr/include/c++/10/vector:67,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = long long int; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const value_type&' {aka 'const long long int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = long long int; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::vector<long long int, long long int>::value_type&&' {aka 'long long int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
aliens.cpp:40:19: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   40 |         a[i+1]=vec[i];
      |                   ^
In file included from /usr/include/c++/10/vector:67,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = long long int; _Alloc = long long int]':
/usr/include/c++/10/bits/stl_vector.h:288:7:   required from here
/usr/include/c++/10/bits/stl_vector.h:133:19: error: 'long long int' is not a class, struct, or union type
  133 |  : _Tp_alloc_type()
      |                   ^
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = long long int; _Alloc = long long int]':
/usr/include/c++/10/bits/stl_vector.h:487:7:   required from here
/usr/include/c++/10/bits/stl_vector.h:335:24: error: 'struct std::_Vector_base<long long int, long long int>::_Vector_impl' has no member named '_M_start'
  335 |  _M_deallocate(_M_impl._M_start,
      |                ~~~~~~~~^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:336:17: error: 'struct std::_Vector_base<long long int, long long int>::_Vector_impl' has no member named '_M_end_of_storage'
  336 |         _M_impl._M_end_of_storage - _M_impl._M_start);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:336:45: error: 'struct std::_Vector_base<long long int, long long int>::_Vector_impl' has no member named '_M_start'
  336 |         _M_impl._M_end_of_storage - _M_impl._M_start);
      |                                     ~~~~~~~~^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = long long int; _Alloc = long long int]':
aliens.cpp:16:33:   required from here
/usr/include/c++/10/bits/stl_vector.h:680:30: error: 'struct std::_Vector_base<long long int, long long int>::_Vector_impl' has no member named '_M_start'
  680 |  std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
      |                ~~~~~~~~~~~~~~^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:680:54: error: 'struct std::_Vector_base<long long int, long long int>::_Vector_impl' has no member named '_M_finish'
  680 |  std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
      |                                        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:681:28: error: '_M_get_Tp_allocator' was not declared in this scope; did you mean 'get_allocator'?
  681 |         _M_get_Tp_allocator());
      |         ~~~~~~~~~~~~~~~~~~~^~
      |         get_allocator
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = long long int; _Alloc = long long int; std::vector<_Tp, _Alloc>::size_type = long unsigned int]':
aliens.cpp:38:16:   required from here
/usr/include/c++/10/bits/stl_vector.h:919:40: error: 'const struct std::_Vector_base<long long int, long long int>::_Vector_impl' has no member named '_M_finish'
  919 |       { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
      |                          ~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:919:66: error: 'const struct std::_Vector_base<long long int, long long int>::_Vector_impl' has no member named '_M_start'
  919 |       { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
      |                                                    ~~~~~~~~~~~~~~^~~~~~~~