#2874
SortMatrixCol
Se dă o matrice cu n
linii și m
coloane și un caracter c
care poate fi +
sau -
. Să se sorteze, după linii, matricea crescător dacă semnul este +
sau descrescător dacă semnul este -
.
Sortarea matricei după coloane este rearanjarea elementelor astfel încât, parcurgând matricea pe coloane, de la stânga la dreapta și de sus în jos, elementele sunt în ordine crescătoare/descrescătoare.
Problema | SortMatrixCol | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 1 MB
/
Stivă 1 MB
|
Id soluție | #54622597 | Utilizator | |
Fișier | sortmatrixcol.cpp | Dimensiune | 1010 B |
Data încărcării | 03 Decembrie 2024, 21:48 | Scor / rezultat | Eroare de compilare |
sortmatrixcol.cpp: In function 'int main()': sortmatrixcol.cpp:5:5: error: 'cin' was not declared in this scope cin >> n >> m; ^ sortmatrixcol.cpp:5:5: note: suggested alternative: In file included from sortmatrixcol.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ sortmatrixcol.cpp:17:40: error: 'swap' was not declared in this scope swap(s[j], s[j + 1]); ^ sortmatrixcol.cpp:17:40: 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 sortmatrixcol.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 sortmatrixcol.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) ^ sortmatrixcol.cpp:26:40: error: 'swap' was not declared in this scope swap(s[j], s[j + 1]); ^ sortmatrixcol.cpp:26:40: 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 sortmatrixcol.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 sortmatrixcol.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) ^ sortmatrixcol.cpp:36:13: error: 'cout' was not declared in this scope cout << v[i][j] << " "; ^ sortmatrixcol.cpp:36:13: note: suggested alternative: In file included from sortmatrixcol.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ sortmatrixcol.cpp:38:9: error: 'cout' was not declared in this scope cout << endl; ^ sortmatrixcol.cpp:38:9: note: suggested alternative: In file included from sortmatrixcol.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ sortmatrixcol.cpp:38:17: error: 'endl' was not declared in this scope cout << endl; ^ sortmatrixcol.cpp:38:17: note: suggested alternative: In file included from /usr/include/c++/4.8/iostream:39:0, from sortmatrixcol.cpp:1: /usr/include/c++/4.8/ostream:564:5: note: 'std::endl' endl(basic_ostream<_CharT, _Traits>& __os) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SortMatrixCol 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ă.