#396
Se dă un șir cu n elemente, numere naturale. Determinați un cel mai lung subșir crescător al șirului.
| Problema | SCLM | Operații I/O |
sclm.in/sclm.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #61066398 | Utilizator | |
| Fișier | sclm.cpp | Dimensiune | 686 B |
| Data încărcării | 18 Noiembrie 2025, 13:25 | Scor/rezultat | Eroare de compilare |
sclm.cpp: In function 'int main()': sclm.cpp:33:27: warning: capture of variable 'k' with non-automatic storage duration [enabled by default] for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ sclm.cpp:6:7: note: 'int k' declared here int n,k,a[1001], l[1001], p[1001]; ^ sclm.cpp: In lambda function: sclm.cpp:33:29: error: expected '{' before ';' token for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ sclm.cpp: In function 'int main()': sclm.cpp:33:24: error: no match for 'operator<=' (operand types are 'int' and 'main()::__lambda0') for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ sclm.cpp:33:24: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:239:5: note: template<class _T1, class _T2> constexpr bool std::operator<=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:239:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:315:5: note: template<class _Iterator> bool 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:315:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:365:5: note: template<class _IteratorL, class _IteratorR> bool 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:365:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1067:5: note: template<class _IteratorL, class _IteratorR> bool 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:1067:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const std::move_iterator<_Iterator>' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1073:5: note: template<class _Iterator> bool 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:1073:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const std::move_iterator<_Iterator>' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ In file included from /usr/include/c++/4.8/string:52:0, 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2643:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2643:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ In file included from /usr/include/c++/4.8/string:52:0, 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2655:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2655:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ In file included from /usr/include/c++/4.8/string:52:0, 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sclm.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2667:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<=(const _CharT* __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2667:5: note: template argument deduction/substitution failed: sclm.cpp:33:29: note: mismatched types 'const _CharT*' and 'int' for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ sclm.cpp:33:34: error: expected ')' before ';' token for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ sclm.cpp:33:18: warning: unused variable 'j' [-Wunused-variable] for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ sclm.cpp:33:36: error: 'j' was not declared in this scope for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^ sclm.cpp:33:42: error: expected ';' before ')' token for(int i=1, j=k; i<=[k]; i++; j=p[j]) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SCLM 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ă.