#86
HalfSort
Să se scrie un program care ordonează crescător elementele din prima jumătate a unui vector și descrescător elementele din a doua jumătate.
Problema | HalfSort | Operații I/O |
halfsort.in /halfsort.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #55092439 | Utilizator | |
Fișier | halfsort.cpp | Dimensiune | 662 B |
Data încărcării | 22 Decembrie 2024, 14:21 | Scor / rezultat | Eroare de compilare |
halfsort.cpp: In function 'int main()': halfsort.cpp:4:5: error: 'ifstream' was not declared in this scope ifstream fin("halfsort.in"); ^ halfsort.cpp:4:5: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from halfsort.cpp:1: /usr/include/c++/4.8/iosfwd:157:34: note: 'std::ifstream' typedef basic_ifstream<char> ifstream; ^ halfsort.cpp:4:14: error: expected ';' before 'fin' ifstream fin("halfsort.in"); ^ halfsort.cpp:5:5: error: 'ofstream' was not declared in this scope ofstream fout("halfsort.out"); ^ halfsort.cpp:5:5: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from halfsort.cpp:1: /usr/include/c++/4.8/iosfwd:160:34: note: 'std::ofstream' typedef basic_ofstream<char> ofstream; ^ halfsort.cpp:5:14: error: expected ';' before 'fout' ofstream fout("halfsort.out"); ^ halfsort.cpp:6:12: error: 'fin' was not declared in this scope int n; fin>>n; int v[n]; ^ halfsort.cpp:13:34: error: 'swap' was not declared in this scope swap(v[j], v[j+1]); ^ halfsort.cpp:13:34: 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/ostream:38, from /usr/include/c++/4.8/iostream:39, from halfsort.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/ostream:38, from /usr/include/c++/4.8/iostream:39, from halfsort.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) ^ halfsort.cpp:20:34: error: 'swap' was not declared in this scope swap(v[j], v[j-1]); ^ halfsort.cpp:20:34: 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/ostream:38, from /usr/include/c++/4.8/iostream:39, from halfsort.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/ostream:38, from /usr/include/c++/4.8/iostream:39, from halfsort.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) ^ halfsort.cpp:25:9: error: 'fout' was not declared in this scope fout<<v[i]<<" "; ^ halfsort.cpp:28:5: error: 'fout' was not declared in this scope fout.close(); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema HalfSort 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ă.