#3334
PlatouK_v3
Fiind dat un șir de numere, numim secvenţă a acestuia o parte dintre termenii şirului luaţi de pe poziţii consecutive. Denumim platou al acestui şir o secvenţă formată din valori identice. Lungimea unui platou este egală cu numărul de elemente care îl formează.
Asupra unui şir se poate efectua următoarea operaţiune:
Să se scrie un program care citește un șir de n
numere naturale și un număr k
și determină:
k
orik
operațiuniProblema | PlatouK_v3 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.01 secunde | Limita memorie |
Total: 5 MB
/
Stivă 5 MB
|
Id soluție | #54526022 | Utilizator | |
Fișier | platouk_v3.cpp | Dimensiune | 1.15 KB |
Data încărcării | 01 Decembrie 2024, 16:21 | Scor / rezultat | Eroare de compilare |
platouk_v3.cpp: In function 'int main()': platouk_v3.cpp:45:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i=0; i<k&& i<m.se.size(); i++) ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from platouk_v3.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]': /usr/include/c++/4.8/bits/stl_algo.h:2211:62: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:5462:47: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' platouk_v3.cpp:43:38: required from here /usr/include/c++/4.8/bits/stl_algo.h:2142:17: error: assignment of read-only location '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()' *__first = _GLIBCXX_MOVE(__val); ^ In file included from /usr/include/c++/4.8/bits/stl_algo.h:61:0, from /usr/include/c++/4.8/algorithm:62, from platouk_v3.cpp:2: /usr/include/c++/4.8/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]': /usr/include/c++/4.8/bits/stl_algo.h:1936:42: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:5308:51: required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:2310:60: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Size = int]' /usr/include/c++/4.8/bits/stl_algo.h:5461:36: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' platouk_v3.cpp:43:38: required from here /usr/include/c++/4.8/bits/stl_heap.h:262:17: error: assignment of read-only location '__result.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()' *__result = _GLIBCXX_MOVE(*__first); ^ /usr/include/c++/4.8/bits/stl_heap.h: In instantiation of 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Distance = int; _Tp = int]': /usr/include/c++/4.8/bits/stl_heap.h:407:71: required from 'void std::make_heap(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:1933:39: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:5308:51: required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:2310:60: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Size = int]' /usr/include/c++/4.8/bits/stl_algo.h:5461:36: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' platouk_v3.cpp:43:38: required from here /usr/include/c++/4.8/bits/stl_heap.h:237:29: error: assignment of read-only location '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+<const int*, std::vector<int> >((*(const difference_type*)(& __holeIndex))).__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()' *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); ^ /usr/include/c++/4.8/bits/stl_heap.h:243:29: error: assignment of read-only location '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+<const int*, std::vector<int> >((*(const difference_type*)(& __holeIndex))).__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()' *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first ^ In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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 platouk_v3.cpp:1: /usr/include/c++/4.8/bits/move.h: In instantiation of 'void std::swap(_Tp&, _Tp&) [with _Tp = const int]': /usr/include/c++/4.8/bits/stl_algobase.h:147:22: required from 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _ForwardIterator2 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:88:34: required from 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:2282:74: required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:2315:54: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Size = int]' /usr/include/c++/4.8/bits/stl_algo.h:5461:36: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' platouk_v3.cpp:43:38: required from here /usr/include/c++/4.8/bits/move.h:176:11: error: assignment of read-only reference '__a' __a = _GLIBCXX_MOVE(__b); ^ /usr/include/c++/4.8/bits/move.h:177:11: error: assignment of read-only reference '__b' __b = _GLIBCXX_MOVE(__tmp); ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, 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 platouk_v3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h: In instantiation of '_BI2 std::__copy_move_backward_a(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = const int*; _BI2 = const int*]': /usr/include/c++/4.8/bits/stl_algobase.h:596:33: required from '_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _BI2 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algobase.h:667:15: required from '_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _BI2 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:2141:8: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:2211:62: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' /usr/include/c++/4.8/bits/stl_algo.h:5462:47: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]' platouk_v3.cpp:43:38: required from here /usr/include/c++/4.8/bits/stl_algobase.h:587:18: error: no matching function for call to 'std::__copy_move_backward<true, true, std::random_access_iterator_tag>::__copy_move_b(const int*&, const int*&, const int*&)' __result); ^ /usr/include/c++/4.8/bits/stl_algobase.h:587:18: note: candidate is: /usr/include/c++/4.8/bits/stl_algobase.h:563:9: note: template<class _Tp> static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = _Tp; bool _IsMove = true] __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) ^ /usr/include/c++/4.8/bits/stl_algobase.h:563:9: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/stl_algobase.h:587:18: note: deduced conflicting types for parameter '_Tp' ('int' and 'const int') __result); ^ platouk_v3.cpp: In function 'void read(int&)': platouk_v3.cpp:15:39: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result] fread(buff, 1, DIM, stdin); ^ platouk_v3.cpp:21:39: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result] fread(buff, 1, DIM, stdin); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PlatouK_v3 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
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ă.