#512
Se dă un vector cu n
elemente, numere naturale distincte. Ordonați crescător elementele situate înaintea valorii maxime din vector și descrescător elementele situate după această valoare.
Problema | SortMax | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58438383 | Utilizator | |
Fișier | sortmax.cpp | Dimensiune | 988 B |
Data încărcării | 04 Iunie 2025, 13:44 | Scor / rezultat | Eroare de compilare |
sortmax.cpp: In function 'void QuickSort(int*, int, int, bool)': sortmax.cpp:35:23: error: 'i' was not declared in this scope std::cin >> v[i]; ^ sortmax.cpp:36:19: error: 'max' was not declared in this scope if(v[i] > max) ^ sortmax.cpp:36:19: note: suggested alternative: 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 sortmax.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: 'std::max' max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ sortmax.cpp:37:25: error: 'pozmax' was not declared in this scope max = v[i], pozmax = i; ^ sortmax.cpp: At global scope: sortmax.cpp:39:14: error: expected constructor, destructor, or type conversion before '(' token QuickSort(v, 0, pozmax, 1); ^ sortmax.cpp:40:14: error: expected constructor, destructor, or type conversion before '(' token QuickSort(v, pozmax, n - 1, 0); ^ sortmax.cpp:41:5: error: expected unqualified-id before 'for' for(int i = 0; i < n; i++) ^ sortmax.cpp:41:20: error: 'i' does not name a type for(int i = 0; i < n; i++) ^ sortmax.cpp:41:27: error: 'i' does not name a type for(int i = 0; i < n; i++) ^ sortmax.cpp:44:5: error: expected unqualified-id before 'return' return 0; ^ sortmax.cpp:45:1: error: expected declaration before '}' token } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SortMax 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ă.