Detalii evaluare #51530635

Rezumat problemă

Se dau n numere naturale. Să se afișeze al k-lea cel mai mic element din șir.

Detalii

Problema StatisticiOrdine Operații I/O statisticiordine.in/statisticiordine.out
Limita timp 1.5 secunde Limita memorie Total: 16 MB / Stivă 1 MB
Id soluție #51530635 Utilizator . dany (0_dany)
Fișier statisticiordine.cpp Dimensiune 1.53 KB
Data încărcării 05 Iulie 2024, 17:53 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

statisticiordine.cpp:4:16: error: 'vector' has not been declared
     void merge(vector<int>& nums, int left, int middle, int right){

                ^
statisticiordine.cpp:4:22: error: expected ',' or '...' before '<' token
     void merge(vector<int>& nums, int left, int middle, int right){

                      ^
statisticiordine.cpp:40:16: error: 'vector' has not been declared
 void MergeSort(vector<int>& nums, int l, int r){

                ^
statisticiordine.cpp:40:22: error: expected ',' or '...' before '<' token
 void MergeSort(vector<int>& nums, int l, int r){

                      ^
statisticiordine.cpp:49:24: error: 'vector' has not been declared
     int findKthLargest(vector<int>& nums, int k) {

                        ^
statisticiordine.cpp:49:30: error: expected ',' or '...' before '<' token
     int findKthLargest(vector<int>& nums, int k) {

                              ^
statisticiordine.cpp: In member function 'void Solution::merge(int)':
statisticiordine.cpp:5:13: error: 'left' was not declared in this scope
     int i = left;

             ^
statisticiordine.cpp:6:13: error: 'middle' was not declared in this scope
     int j = middle + 1;

             ^
statisticiordine.cpp:9:25: error: 'right' was not declared in this scope
     int *temp = new int[right - left + 1]; // Dynamically allocate memory

                         ^
statisticiordine.cpp:12:12: error: 'nums' was not declared in this scope
         if(nums[i] <= nums[j]){

            ^
statisticiordine.cpp:23:26: error: 'nums' was not declared in this scope
         temp[k - left] = nums[i];

                          ^
statisticiordine.cpp:28:26: error: 'nums' was not declared in this scope
         temp[k - left] = nums[j];

                          ^
statisticiordine.cpp:34:9: error: 'nums' was not declared in this scope
         nums[w] = temp[w - left];

         ^
statisticiordine.cpp: In member function 'void Solution::MergeSort(int)':
statisticiordine.cpp:41:8: error: 'l' was not declared in this scope
     if(l < r){

        ^
statisticiordine.cpp:41:12: error: 'r' was not declared in this scope
     if(l < r){

            ^
statisticiordine.cpp:43:19: error: 'nums' was not declared in this scope
         MergeSort(nums, l, m);

                   ^
statisticiordine.cpp: In member function 'int Solution::findKthLargest(int)':
statisticiordine.cpp:50:17: error: 'nums' was not declared in this scope
         int r = nums.size();

                 ^
statisticiordine.cpp:64:21: error: 'k' was not declared in this scope
         return nums[k];

                     ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema StatisticiOrdine face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.