#1157
KSort2
Se dă un vector cu n
elemente, numere naturale și un număr k
. Ordonați crescător primele k
elemente ale vectorului și descrescător ultimele n-k
elemente.
Pentru sortare se va folosit metoda QuickSort sau MergeSort.
Problema | KSort2 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54728049 | Utilizator | |
Fișier | ksort2.cpp | Dimensiune | 684 B |
Data încărcării | 06 Decembrie 2024, 14:58 | Scor / rezultat | Eroare de compilare |
ksort2.cpp: In function 'int pivot(int, int)': ksort2.cpp:3:11: error: 'v' was not declared in this scope int x=v[st]; ^ ksort2.cpp: In function 'int main()': ksort2.cpp:24:5: error: 'cin' was not declared in this scope cin>>n>>k; ^ ksort2.cpp:24:10: error: 'n' was not declared in this scope cin>>n>>k; ^ ksort2.cpp:24:13: error: 'k' was not declared in this scope cin>>n>>k; ^ ksort2.cpp:25:14: error: expected unqualified-id before '=' token for (int =1; i<=n; i++) ^ ksort2.cpp:25:14: error: expected ';' before '=' token ksort2.cpp:25:14: error: expected primary-expression before '=' token ksort2.cpp:25:18: error: 'i' was not declared in this scope for (int =1; i<=n; i++) ^ ksort2.cpp:25:22: error: expected ')' before ';' token for (int =1; i<=n; i++) ^ ksort2.cpp:25:24: error: 'i' was not declared in this scope for (int =1; i<=n; i++) ^ ksort2.cpp:25:27: error: expected ';' before ')' token for (int =1; i<=n; i++) ^ ksort2.cpp:31:15: error: expected ';' before '<=' token for (int i<=n-k+1; j=n; i<j; i++; j--) ^ ksort2.cpp:31:15: error: expected primary-expression before '<=' token ksort2.cpp:31:24: error: 'j' was not declared in this scope for (int i<=n-k+1; j=n; i<j; i++; j--) ^ ksort2.cpp:31:27: error: expected ')' before ';' token for (int i<=n-k+1; j=n; i<j; i++; j--) ^ ksort2.cpp:31:14: warning: unused variable 'i' [-Wunused-variable] for (int i<=n-k+1; j=n; i<j; i++; j--) ^ ksort2.cpp:31:31: error: 'j' was not declared in this scope for (int i<=n-k+1; j=n; i<j; i++; j--) ^ ksort2.cpp:31:42: error: expected ';' before ')' token for (int i<=n-k+1; j=n; i<j; i++; j--) ^ ksort2.cpp:34:9: error: 'cout' was not declared in this scope cout<<v[i]<<" "; ^ ksort2.cpp:34:15: error: 'v' was not declared in this scope cout<<v[i]<<" "; ^ ksort2.cpp: In function 'int pivot(int, int)': ksort2.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema KSort2 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ă.