#3011
lastk
Se dă un șir a[1]
, a[2]
, …, a[n]
de numere naturale și un număr natural k
. Să se determine cele mai mari k
numere din șir.
Folclorul informatic
Problema | lastk | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #50320213 | Utilizator | |
Fișier | lastk.cpp | Dimensiune | 1.46 KB |
Data încărcării | 04 Aprilie 2024, 13:49 | Scor / rezultat | Eroare de compilare |
lastk.cpp: In function 'void minHeapify(std::vector<int>&, int)': lastk.cpp:28:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (l < h.size() && h[l] < h[i]) ^ lastk.cpp:30:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (r < h.size() && h[r] < h[smallest]) ^ lastk.cpp: In function 'int main()': lastk.cpp:58:30: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>' minHeapInsert(h, v[i]); ^ lastk.cpp:17:6: error: in passing argument 1 of 'void minHeapInsert(std::vector<int>&, int)' void minHeapInsert(vector<int> &h, int x) ^ lastk.cpp:65:28: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>' minHeapify(h, 0); ^ lastk.cpp:23:6: error: in passing argument 1 of 'void minHeapify(std::vector<int>&, int)' void minHeapify(vector<int> &h, int i) ^ lastk.cpp:69:29: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>' cout << extractMin(h) << " "; ^ lastk.cpp:39:5: error: in passing argument 1 of 'int extractMin(std::vector<int>&)' int extractMin(vector<int> &h) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema lastk 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ă.