#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 |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64169240 | Utilizator | |
| Fișier | sortmax.cpp | Dimensiune | 580 B |
| Data încărcării | 21 Aprilie 2026, 12:47 | Scor/rezultat | Eroare de compilare |
sortmax.cpp: In function ‘int main()’: sortmax.cpp:10:10: error: overloaded function with no contextual type information 10 | max=a[1]; | ^ sortmax.cpp:11:7: error: ‘i’ was not declared in this scope 11 | for(i=2;i<=n;i++) | ^ sortmax.cpp:11:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 11 | for(i=2;i<=n;i++) | ^~~ sortmax.cpp:13:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 13 | if(max<a[i]){ | ^~ sortmax.cpp:13:14: error: ‘i’ was not declared in this scope 13 | if(max<a[i]){ | ^ sortmax.cpp:13:8: error: parse error in template argument list 13 | if(max<a[i]){ | ^~~~~~~~ sortmax.cpp:13:16: error: cannot resolve overloaded function ‘max’ based on conversion to type ‘bool’ 13 | if(max<a[i]){ | ^ sortmax.cpp:7:23: warning: unused variable ‘j’ [-Wunused-variable] 7 | long long a[1001],n,j,aux,k; | ^ sortmax.cpp:7:25: warning: unused variable ‘aux’ [-Wunused-variable] 7 | long long a[1001],n,j,aux,k; | ^~~ sortmax.cpp: At global scope: sortmax.cpp:18:1: error: expected unqualified-id before ‘for’ 18 | for(int i=1;i<k;i++){ | ^~~ sortmax.cpp:18:13: error: ‘i’ does not name a type 18 | for(int i=1;i<k;i++){ | ^ sortmax.cpp:18:17: error: ‘i’ does not name a type 18 | for(int i=1;i<k;i++){ | ^ sortmax.cpp:20:5: error: expected unqualified-id before ‘if’ 20 | if(a[i]>a[j]){ | ^~ sortmax.cpp:25:5: error: expected declaration before ‘}’ token 25 | } | ^ sortmax.cpp:26:5: error: expected declaration before ‘}’ token 26 | } | ^ sortmax.cpp:27:1: error: expected declaration before ‘}’ token 27 | } for(int i=k+1;i<n;i++){ | ^ sortmax.cpp:27:3: error: expected unqualified-id before ‘for’ 27 | } for(int i=k+1;i<n;i++){ | ^~~ sortmax.cpp:27:17: error: ‘i’ does not name a type 27 | } for(int i=k+1;i<n;i++){ | ^ sortmax.cpp:27:21: error: ‘i’ does not name a type 27 | } for(int i=k+1;i<n;i++){ | ^ sortmax.cpp:36:1: error: expected unqualified-id before ‘for’ 36 | for(int i=1;i<=n;i++) | ^~~ sortmax.cpp:36:13: error: ‘i’ does not name a type 36 | for(int i=1;i<=n;i++) | ^ sortmax.cpp:36:18: error: ‘i’ does not name a type 36 | for(int i=1;i<=n;i++) | ^ sortmax.cpp:38:5: error: expected unqualified-id before ‘return’ 38 | return 0; | ^~~~~~ sortmax.cpp:39:1: error: expected declaration before ‘}’ token 39 | } | ^
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ă.