#4106
HalfSort4
Se dă un vector cu n
elemente numere întregi nenule.
Să se ordoneze crescător subșirul format din elementele negative din vector și descrescător subșirul format din elementele pozitive.
Problema | HalfSort4 | Operații I/O |
![]() halfsort4.in /halfsort4.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51643446 | Utilizator | |
Fișier | halfsort4.cpp | Dimensiune | 527 B |
Data încărcării | 26 Iulie 2024, 16:16 | Scor / rezultat | Eroare de compilare |
halfsort4.cpp:2:1: error: 'ifstream' does not name a type ifstream fin("halfsort4.in"); ^ halfsort4.cpp:3:1: error: 'ofstream' does not name a type ofstream fout("halfsort4.out") ^ halfsort4.cpp: In function 'int main()': halfsort4.cpp:8:5: error: 'fin' was not declared in this scope fin>>n; ^ halfsort4.cpp:14:23: error: 'swap' was not declared in this scope swap(v[i],v[j]); ^ halfsort4.cpp:14:23: note: suggested alternatives: 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 halfsort4.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: 'std::swap' swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ In file included from /usr/include/c++/4.8/exception:152:0, from /usr/include/c++/4.8/ios:39, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from halfsort4.cpp:1: /usr/include/c++/4.8/bits/exception_ptr.h:160:5: note: 'std::__exception_ptr::swap' swap(exception_ptr& __lhs, exception_ptr& __rhs) ^ halfsort4.cpp:18:23: error: 'swap' was not declared in this scope swap(v[i],v[j]); ^ halfsort4.cpp:18:23: note: suggested alternatives: 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 halfsort4.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: 'std::swap' swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ In file included from /usr/include/c++/4.8/exception:152:0, from /usr/include/c++/4.8/ios:39, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from halfsort4.cpp:1: /usr/include/c++/4.8/bits/exception_ptr.h:160:5: note: 'std::__exception_ptr::swap' swap(exception_ptr& __lhs, exception_ptr& __rhs) ^ halfsort4.cpp:20:9: error: 'fout' was not declared in this scope fout<<v[i]<<" "; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema HalfSort4 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ă.