Submission #1051251

#TimeUsernameProblemLanguageResultExecution timeMemory
1051251ReLiceAliens (IOI16_aliens)C++17
Compilation error
0 ms0 KiB
#include "aliens.h" #include <bits/stdc++.h> #define ll int #define sz size(); #define all(x) x.begin(),x.end() #define vll vector<ll> #define str string #define pb push_back #define bc back() using namespace std; const ll N=4e3+5; ll sq(ll x){ return x*x; } long long dp[N][N]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { ll i,j,q; vll len,nxt; {//deleting unnecessary ones vll mx(m, m), nr; for(i=0;i<n;i++){ if(r[i] < c[i]) swap(r[i], c[i]); mx[r[i]] = min(mx[r[i]], c[i]); } for(i=m-1;i>=0;i--){ if(mx[i] > i)continue; if(nr.empty() || mx[nr.bc] > mx[i]){ nr.pb(i); len.pb(i-mx[i]+1); } } nr.pb(-1), len.pb(-1);//changing indexation reverse(all(nr)); reverse(all(len)); r=nr; n=r.size()-1; } c.clear(); c.pb(0); for(i=1;i<=n;i++){ nxt.pb(r[i] - len[i]); c.pb(nxt.bc); len[i - 1] = r[i - 1] - nxt[i - 1]; len[i - 1] = min(len[i - 1], 0ll); } nxt.pb(r[n]); memset(dp, 0x3f, sizeof(dp)); dp[0][0] = 0; k = min(k, n); for(i=1;i<=n;i++){ for(j=1;j<=k;j++){ for(q=0;q<i;q++){ if(dp[q][j-1] >= dp[0][1])continue; dp[i][j] = min(dp[i][j], dp[q][j - 1] + sq(r[i] - nxt[q]) - sq(len[q])); } } } return dp[n][k]; }

Compilation message (stderr)

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:53:35: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, long long int)'
   53 |   len[i - 1] = min(len[i - 1], 0ll);
      |                                   ^
In file included from /usr/include/c++/10/vector:60,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
aliens.cpp:53:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   53 |   len[i - 1] = min(len[i - 1], 0ll);
      |                                   ^
In file included from /usr/include/c++/10/vector:60,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
aliens.cpp:53:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   53 |   len[i - 1] = min(len[i - 1], 0ll);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from aliens.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
aliens.cpp:53:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   53 |   len[i - 1] = min(len[i - 1], 0ll);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from aliens.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
aliens.cpp:53:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   53 |   len[i - 1] = min(len[i - 1], 0ll);
      |                                   ^