#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 | #50713258 | Utilizator | |
Fișier | ksort2.cpp | Dimensiune | 757 B |
Data încărcării | 23 Aprilie 2024, 22:31 | Scor / rezultat | Eroare de compilare |
ksort2.cpp: In function 'void interclasare(int, int, int)': ksort2.cpp:11:16: error: expected ',' or ';' before '/' token int mij (ls+ld)/2; ^ ksort2.cpp:13:7: error: unable to find numeric literal operator 'operator"" s' int i=1s; ^ ksort2.cpp:23:1: error: expected ')' before 'if' if(v[i]*sm<v[j]*sm) ^ ksort2.cpp:29:1: error: 'else' without a previous 'if' else ^ ksort2.cpp:39:7: error: unable to find numeric literal operator 'operator"" s' for(i=1s,j=1;j<=k; i++, j++) ^ ksort2.cpp: At global scope: ksort2.cpp:43:18: error: expected ',' or '...' before numeric constant } void Merge(int 1s, int ld, int sm) ^ ksort2.cpp: In function 'void Merge(int)': ksort2.cpp:47:4: error: 'ls' was not declared in this scope if(ls<ld) ^ ksort2.cpp:47:7: error: 'ld' was not declared in this scope if(ls<ld) ^ ksort2.cpp:51:16: error: expected ',' or ';' before '/' token int mij (ls+ld)/2; ^ ksort2.cpp:53:14: error: 'sm' was not declared in this scope Merge(ls,mij,sm); Merge(mij+1,ld, sm); ^ ksort2.cpp: In function 'int main()': ksort2.cpp:71:12: error: too many arguments to function 'void Merge(int)' Merge(1,k,1); ^ ksort2.cpp:43:8: note: declared here } void Merge(int 1s, int ld, int sm) ^ ksort2.cpp:73:15: error: too many arguments to function 'void Merge(int)' Merge(k+1,n,-1); ^ ksort2.cpp:43:8: note: declared here } void Merge(int 1s, int ld, int sm) ^
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ă.