Detalii evaluare #47504401

Rezumat problemă

Se dă un șir s = s0, s1,…, sn-1 de n litere mici. Prin s[i..j] se înțelege secvența si, si+1, …, sj. Asupra șirului se efectuează de mai multe ori operația switch(i,j,c1,c2), care în secvența s[i..j] modifică orice apariție a literei c1 în litera c2. Dându-se șirul s și m operații switch, să se afișeze șirul s după efectuarea celor m operații.

Lot juniori, Cluj-Napoca 2022

Detalii

Problema switchLetters Operații I/O switchletters.in/switchletters.out
Limita timp 0.45 secunde Limita memorie Total: 128 MB / Stivă 64 MB
Id soluție #47504401 Utilizator Codrut Opris (Apyx121)
Fișier switchletters.cpp Dimensiune 898 B
Data încărcării 14 Decembrie 2023, 20:01 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

switchletters.cpp: In function 'void switchLetters(std::string&, std::vector<std::tuple<int, int, char, char> >&)':
switchletters.cpp:11:25: error: 'tie' was not declared in this scope
         tie(i, j, c1, c2) = operation;

                         ^
switchletters.cpp: In function 'int main()':
switchletters.cpp:35:54: error: 'make_tuple' was not declared in this scope
         operations[i] = make_tuple(start, end, c1, c2);

                                                      ^
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 switchletters.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h: In instantiation of '__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::tuple<int, int, char, char>*; _Container = std::vector<std::tuple<int, int, char, char> >]':
switchletters.cpp:8:28:   required from here
/usr/include/c++/4.8/bits/stl_iterator.h:748:2: error: cannot increment a pointer to incomplete type 'std::tuple<int, int, char, char>'
  ++_M_current;
  ^
In file included from /usr/include/c++/4.8/vector:64:0,
                 from switchletters.cpp:2:
/usr/include/c++/4.8/bits/stl_vector.h: In instantiation of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::vector<_Tp, _Alloc>::reference = std::tuple<int, int, char, char>&; std::vector<_Tp, _Alloc>::size_type = unsigned int]':
switchletters.cpp:35:21:   required from here
/usr/include/c++/4.8/bits/stl_vector.h:771:41: error: invalid use of incomplete type 'class std::tuple<int, int, char, char>'
       { return *(this->_M_impl._M_start + __n); }
                                         ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64: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 switchletters.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<int, int, char, char>'
     class tuple;
           ^
In file included from /usr/include/c++/4.8/vector:64:0,
                 from switchletters.cpp:2:
/usr/include/c++/4.8/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >]':
/usr/include/c++/4.8/bits/stl_vector.h:270:23:   required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
switchletters.cpp:30:53:   required from here
/usr/include/c++/4.8/bits/stl_vector.h:161:9: error: invalid use of incomplete type 'class std::tuple<int, int, char, char>'
         - this->_M_impl._M_start); }
         ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64: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 switchletters.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<int, int, char, char>'
     class tuple;
           ^
In file included from /usr/include/c++/4.8/vector:64:0,
                 from switchletters.cpp:2:
/usr/include/c++/4.8/bits/stl_vector.h: In instantiation of 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::size_t = unsigned int]':
/usr/include/c++/4.8/bits/stl_vector.h:136:30:   required from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::size_t = unsigned int; std::_Vector_base<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
/usr/include/c++/4.8/bits/stl_vector.h:270:23:   required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
switchletters.cpp:30:53:   required from here
/usr/include/c++/4.8/bits/stl_vector.h:183:59: error: invalid use of incomplete type 'class std::tuple<int, int, char, char>'
  this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
                                                           ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64: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 switchletters.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<int, int, char, char>'
     class tuple;
           ^
In file included from /usr/include/c++/4.8/vector:62:0,
                 from switchletters.cpp:2:
/usr/include/c++/4.8/bits/stl_construct.h: In instantiation of 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::tuple<int, int, char, char>*]':
/usr/include/c++/4.8/bits/stl_construct.h:151:31:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_T2>&) [with _ForwardIterator = std::tuple<int, int, char, char>*; _Tp = std::tuple<int, int, char, char>]'
/usr/include/c++/4.8/bits/stl_vector.h:416:30:   required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >]'
switchletters.cpp:30:53:   required from here
/usr/include/c++/4.8/bits/stl_construct.h:127:27: error: invalid use of incomplete type '_Value_type {aka class std::tuple<int, int, char, char>}'
  __destroy(__first, __last);
                           ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64: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 switchletters.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of '_Value_type {aka class std::tuple<int, int, char, char>}'
     class tuple;
           ^
In file included from /usr/include/c++/4.8/vector:63:0,
                 from switchletters.cpp:2:
/usr/include/c++/4.8/bits/stl_uninitialized.h: In instantiation of 'void std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = std::tuple<int, int, char, char>*; _Size = unsigned int]':
/usr/include/c++/4.8/bits/stl_uninitialized.h:605:50:   required from 'void std::__uninitialized_default_n_a(_ForwardIterator, _Size, std::allocator<_Tp>&) [with _ForwardIterator = std::tuple<int, int, char, char>*; _Size = unsigned int; _Tp = std::tuple<int, int, char, char>]'
/usr/include/c++/4.8/bits/stl_vector.h:1225:28:   required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::vector<_Tp, _Alloc>::size_type = unsigned int]'
/usr/include/c++/4.8/bits/stl_vector.h:271:34:   required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
switchletters.cpp:30:53:   required from here
/usr/include/c++/4.8/bits/stl_uninitialized.h:544:33: error: invalid use of incomplete type '_ValueType {aka class std::tuple<int, int, char, char>}'
  __uninit_default_n(__first, __n);
                                 ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64: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 switchletters.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of '_ValueType {aka class std::tuple<int, int, char, char>}'
     class tuple;
           ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/c++allocator.h:33:0,
                 from /usr/include/c++/4.8/bits/allocator.h:46,
                 from /usr/include/c++/4.8/string:41,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from switchletters.cpp:1:
/usr/include/c++/4.8/ext/new_allocator.h: In instantiation of '_Tp* __gnu_cxx::new_allocator<_Tp>::allocate(__gnu_cxx::new_allocator<_Tp>::size_type, const void*) [with _Tp = std::tuple<int, int, char, char>; __gnu_cxx::new_allocator<_Tp>::pointer = std::tuple<int, int, char, char>*; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]':
/usr/include/c++/4.8/bits/stl_vector.h:168:25:   required from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::_Vector_base<_Tp, _Alloc>::pointer = std::tuple<int, int, char, char>*; std::size_t = unsigned int]'
/usr/include/c++/4.8/bits/stl_vector.h:181:25:   required from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::size_t = unsigned int]'
/usr/include/c++/4.8/bits/stl_vector.h:136:30:   required from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::size_t = unsigned int; std::_Vector_base<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
/usr/include/c++/4.8/bits/stl_vector.h:270:23:   required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
switchletters.cpp:30:53:   required from here
/usr/include/c++/4.8/ext/new_allocator.h:104:54: error: invalid application of 'sizeof' to incomplete type 'std::tuple<int, int, char, char>'
  return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
                                                      ^
/usr/include/c++/4.8/ext/new_allocator.h: In instantiation of '__gnu_cxx::new_allocator<_Tp>::size_type __gnu_cxx::new_allocator<_Tp>::max_size() const [with _Tp = std::tuple<int, int, char, char>; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]':
/usr/include/c++/4.8/ext/new_allocator.h:101:10:   required from '_Tp* __gnu_cxx::new_allocator<_Tp>::allocate(__gnu_cxx::new_allocator<_Tp>::size_type, const void*) [with _Tp = std::tuple<int, int, char, char>; __gnu_cxx::new_allocator<_Tp>::pointer = std::tuple<int, int, char, char>*; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]'
/usr/include/c++/4.8/bits/stl_vector.h:168:25:   required from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::_Vector_base<_Tp, _Alloc>::pointer = std::tuple<int, int, char, char>*; std::size_t = unsigned int]'
/usr/include/c++/4.8/bits/stl_vector.h:181:25:   required from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::size_t = unsigned int]'
/usr/include/c++/4.8/bits/stl_vector.h:136:30:   required from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::size_t = unsigned int; std::_Vector_base<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
/usr/include/c++/4.8/bits/stl_vector.h:270:23:   required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, char, char>; _Alloc = std::allocator<std::tuple<int, int, char, char> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, char, char> >]'
switchletters.cpp:30:53:   required from here
/usr/include/c++/4.8/ext/new_allocator.h:114:35: error: invalid application of 'sizeof' to incomplete type 'std::tuple<int, int, char, char>'
       { return size_t(-1) / sizeof(_Tp); }
                                   ^

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 switchLetters 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ă.