Submission #1256709

#TimeUsernameProblemLanguageResultExecution timeMemory
1256709medmdgTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include "triples.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; vector<ll> H; ll n; bool check(ll i,ll j,ll k){ if(i<0||j<0||k<0||i>=n||j>=n||k>=n)return 0; vector<ll> s1,s2; s1.push_back(abs(j-i)); s1.push_back(abs(k-i)); s1.push_back(abs(j-k)); sort(s1.begin(),s1.end()); if(s1[0]==0)return 0; s2.push_back(H[i]); s2.push_back(H[j]); s2.push_back(H[k]); sort(s2.begin(),s2.end()); return s1==s2; } ll sub4(){ ll ans=0; for(int i=n-1;i>1;i--){ ll x2=i-H[i]; ll x3=x2+H[x2],x4=i-H[x2]; if(i-x3==H[x3])ans++; if(x3!=x4) if(x4-x2==H[x4])ans++; } return ans; } ll sub2(){ return 0; } ll sub3(){ return 0; } ll count_triples(vector<int> h) { n=H.size(); H=h; return sub4(); if(n<2001)return sub3(); else return sub2(); } std::vector<int> construct_range(int M, int K) { return {1, 1, 1}; }

Compilation message (stderr)

triples.cpp: In function 'll count_triples(std::vector<int>)':
triples.cpp:40:5: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   40 |   H=h;
      |     ^
In file included from /usr/include/c++/11/vector:72,
                 from triples.h:1,
                 from triples.cpp:1:
/usr/include/c++/11/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/11/vector:67,
                 from triples.h:1,
                 from triples.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~