#2533
Numim secvență încadrată a unui șir de numere naturale un subșir al acestuia, format din termeni aflați pe poziții consecutive în șirul dat, subșir care începe și se termină cu aceeași valoare. Lungimea secvenței este egală cu numărul de termeni ai acesteia.
Să se determine secvențele încadrate dintr-un șir, care au lungimea maximă.
Bacalaureat 2018, sesiunea specială
| Problema | SecventaIncadrata | Operații I/O |
secventaincadrata.in/secventaincadrata.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0 MB
|
| Id soluție | #64462664 | Utilizator | |
| Fișier | secventaincadrata.cpp | Dimensiune | 546 B |
| Data încărcării | 08 Mai 2026, 09:58 | Scor/rezultat | Eroare de compilare |
secventaincadrata.cpp: In function ‘int main()’: secventaincadrata.cpp:16:5: error: reference to ‘max’ is ambiguous 16 | max=0; | ^~~ In file included from /usr/include/c++/13/string:51, 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 secventaincadrata.cpp:1: /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ secventaincadrata.cpp:6:31: note: ‘int max’ 6 | int v[10], v1[10],n,i,x,k,max; | ^~~ secventaincadrata.cpp:18:26: error: reference to ‘max’ is ambiguous 18 | if (v1[i]-v[i]+1>max) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ secventaincadrata.cpp:6:31: note: ‘int max’ 6 | int v[10], v1[10],n,i,x,k,max; | ^~~ secventaincadrata.cpp:19:9: error: reference to ‘max’ is ambiguous 19 | max = v1[i]-v[i]+1; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ secventaincadrata.cpp:6:31: note: ‘int max’ 6 | int v[10], v1[10],n,i,x,k,max; | ^~~ secventaincadrata.cpp:20:11: error: reference to ‘max’ is ambiguous 20 | fout<<max<<endl; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ secventaincadrata.cpp:6:31: note: ‘int max’ 6 | int v[10], v1[10],n,i,x,k,max; | ^~~ secventaincadrata.cpp:23:27: error: reference to ‘max’ is ambiguous 23 | if (v1[i]-v[i]+1==max) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ secventaincadrata.cpp:6:31: note: ‘int max’ 6 | int v[10], v1[10],n,i,x,k,max; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SecventaIncadrata 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ă.