Detalii evaluare #53254517

Rezumat problemă

Se dă un șir de caractere care conține doar litere mici și mari ale alfabetului englez. Se parcurge șirul de la stânga la dreapta și dacă se întâlnește o secvență de litere alăturate egale, se șterge. Dacă în urma acestei operații se obține o nouă secvență de litere egale, se șterge și ea, ș. a. m. d.

Să se afișeze șirul obținut.

Detalii

Problema SecvElim Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #53254517 Utilizator ✻H+3+ЯД✻7luCJIo0T6 w (Bobert1928)
Fișier secvelim.cpp Dimensiune 293 B
Data încărcării 22 Octombrie 2024, 15:53 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

secvelim.cpp: In function 'int main()':
secvelim.cpp:10:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 1; i <= s.size(); i++) {

                                 ^
secvelim.cpp:12:19: error: no match for 'operator-' (operand types are 'std::string {aka std::basic_string<char>}' and 'char')
             s = s - c;

                   ^
secvelim.cpp:12:19: note: candidates are:
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:327:5: note: template<class _Iterator> typename std::reverse_iterator<_Iterator>::difference_type std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator-(const reverse_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:327:5: note:   template argument deduction/substitution failed:
secvelim.cpp:12:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             s = s - c;

                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:379:5: note: template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator-(const reverse_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:379:5: note:   template argument deduction/substitution failed:
secvelim.cpp:12:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             s = s - c;

                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note: template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)
     operator-(const move_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note:   template argument deduction/substitution failed:
secvelim.cpp:12:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             s = s - c;

                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note: template<class _Iterator> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)
     operator-(const move_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note:   template argument deduction/substitution failed:
secvelim.cpp:12:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             s = s - c;

                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:896:5: note: template<class _Iterator, class _Container> typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:896:5: note:   template argument deduction/substitution failed:
secvelim.cpp:12:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
             s = s - c;

                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:884:5: note: template<class _IteratorL, class _IteratorR, class _Container> decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
     operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:884:5: note:   template argument deduction/substitution failed:
secvelim.cpp:12:21: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
             s = s - c;

                     ^
secvelim.cpp:13:19: error: no match for 'operator-' (operand types are 'std::string {aka std::basic_string<char>}' and 'char')
             s = s - s[i];

                   ^
secvelim.cpp:13:19: note: candidates are:
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:327:5: note: template<class _Iterator> typename std::reverse_iterator<_Iterator>::difference_type std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator-(const reverse_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:327:5: note:   template argument deduction/substitution failed:
secvelim.cpp:13:24: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             s = s - s[i];

                        ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:379:5: note: template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator-(const reverse_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:379:5: note:   template argument deduction/substitution failed:
secvelim.cpp:13:24: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
             s = s - s[i];

                        ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note: template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)
     operator-(const move_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note:   template argument deduction/substitution failed:
secvelim.cpp:13:24: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             s = s - s[i];

                        ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note: template<class _Iterator> decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)
     operator-(const move_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note:   template argument deduction/substitution failed:
secvelim.cpp:13:24: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::move_iterator<_Iterator>'
             s = s - s[i];

                        ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:896:5: note: template<class _Iterator, class _Container> typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:896:5: note:   template argument deduction/substitution failed:
secvelim.cpp:13:24: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
             s = s - s[i];

                        ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from secvelim.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:884:5: note: template<class _IteratorL, class _IteratorR, class _Container> decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
     operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:884:5: note:   template argument deduction/substitution failed:
secvelim.cpp:13:24: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
             s = s - s[i];

                        ^

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 SecvElim face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul 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ă.