Detalii evaluare #64346659

Rezumat problemă

#3198

Se dă codul sursă al unui program. Se cere optimizarea unei funcții din acesta.

AcadNet 2017
Fișiere Stan Andrei (Grizzlly) Politechnica Bucuresti concurs

Detalii

Problema Optimize Operații I/O input.txt/output.txt
Limita timp 0.3 secunde Limita memorie Total: 10 MB / Stivă 10 MB
Id soluție #64346659 Utilizator Popescu Darius (DariusCNGL)
Fișier optimize.cpp Dimensiune 160 B
Data încărcării 30 Aprilie 2026, 19:38 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

optimize.cpp: In member function ‘void Function::nule(std::vector<int>&)’:
optimize.cpp:24:13: error: no match for ‘operator+’ (operand types are ‘std::vector<int>’ and ‘int’)
   24 |     sort(v,v+size);
      |            ~^~~~~
      |            | |
      |            | int
      |            std::vector<int>
In file included from /usr/include/c++/13/string:48,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from optimize.cpp:6:
/usr/include/c++/13/bits/stl_iterator.h:634:5: note: candidate: ‘template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)’
  634 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:634:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/stl_iterator.h:1808:5: note: candidate: ‘template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)’
 1808 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1808:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’
   24 |     sort(v,v+size);
      |              ^~~~
In file included from /usr/include/c++/13/string:54:
/usr/include/c++/13/bits/basic_string.h:3553:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 3553 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3553:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3571:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 3571 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3571:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   mismatched types ‘const _CharT*’ and ‘std::vector<int>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3590:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 3590 |     operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3590:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3607:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’
 3607 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3607:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3625:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)’
 3625 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3625:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3637:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 3637 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3637:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3644:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’
 3644 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3644:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3651:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’
 3651 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3651:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3674:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’
 3674 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3674:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   mismatched types ‘const _CharT*’ and ‘std::vector<int>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3681:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’
 3681 |     operator+(_CharT __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3681:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3688:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)’
 3688 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3688:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
/usr/include/c++/13/bits/basic_string.h:3695:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)’
 3695 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3695:5: note:   template argument deduction/substitution failed:
optimize.cpp:24:14: note:   ‘std::vector<int>’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   24 |     sort(v,v+size);
      |              ^~~~
optimize.cpp:24:5: error: ‘sort’ was not declared in this scope; did you mean ‘short’?
   24 |     sort(v,v+size);
      |     ^~~~
      |     short
optimize.cpp:26:9: error: ‘swap’ was not declared in this scope
   26 |         swap(v[i],v[size-i]);
      |         ^~~~
optimize.cpp:26:9: note: suggested alternatives:
In file included from optimize.cpp:8:
/usr/include/c++/13/fstream:1292:5: note:   ‘std::swap’
 1292 |     swap(basic_fstream<_CharT, _Traits>& __x,
      |     ^~~~
In file included from /usr/include/c++/13/bits/exception_ptr.h:41,
                 from /usr/include/c++/13/exception:164,
                 from /usr/include/c++/13/ios:41:
/usr/include/c++/13/bits/move.h:189:5: note:   ‘std::swap’
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/13/bits/exception_ptr.h:230:5: note:   ‘std::__exception_ptr::swap’
  230 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Optimize face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. Soluția propusă de tine va fi evaluată astfel:

  • Soluția propusă de tine este inclusă în programul suport, apoi acesta este compilat. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Datorită existenței programului suport, la compilare pot să apară erori sau avertismente care să nu se refere la instrucțiunile scrise de tine, dar care sunt datorate faptului că soluția ta nu este corectă.
  • Dacă programul suport a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.

Du-te sus!