#2720
Metoda Bucket Sort constă în distribuirea elementelor în mai multe grupe, numite “bucket-uri”. Apoi fiecare bucket este sortat individual folosind un algoritm de sortare oarecare.
Problema | BucketSort | Operații I/O |
![]() bucketsort.in /bucketsort.out
|
---|---|---|---|
Limita timp | 0.04 secunde | Limita memorie |
Total: 1.5 MB
/
Stivă 1 MB
|
Id soluție | #56127382 | Utilizator | |
Fișier | bucketsort.cpp | Dimensiune | 1.06 KB |
Data încărcării | 06 Februarie 2025, 20:27 | Scor / rezultat | Eroare de compilare |
bucketsort.cpp:8:1: error: 'vector' does not name a type vector<l> v[100000]; ^ bucketsort.cpp:9:18: error: 'desc' declared as an 'inline' variable inline bool desc(l a,l b){ ^ bucketsort.cpp:9:18: error: 'l' was not declared in this scope bucketsort.cpp:9:22: error: 'l' was not declared in this scope inline bool desc(l a,l b){ ^ bucketsort.cpp:9:25: error: expression list treated as compound expression in initializer [-fpermissive] inline bool desc(l a,l b){ ^ bucketsort.cpp:9:26: error: expected ',' or ';' before '{' token inline bool desc(l a,l b){ ^ bucketsort.cpp: In function 'int main()': bucketsort.cpp:13:6: error: 'fin' was not declared in this scope fin>>n; ^ bucketsort.cpp:16:9: error: 'v' was not declared in this scope v[x/1000].push_back(x); ^ bucketsort.cpp:17:9: error: 'maxi' was not declared in this scope maxi=max(maxi,x/1000); ^ bucketsort.cpp:17:14: error: reference to 'max' is ambiguous maxi=max(maxi,x/1000); ^ bucketsort.cpp:7:13: note: candidates are: int max int n,x,c=0,max,d; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from bucketsort.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ bucketsort.cpp:21:19: error: 'maxi' was not declared in this scope for(int i=maxi;i>=0;i--){ ^ bucketsort.cpp:22:17: error: 'v' was not declared in this scope if(!v[i].empty()){ ^ bucketsort.cpp:23:50: error: 'sort' was not declared in this scope sort(v[i].begin(),v[i].end(),desc); ^ bucketsort.cpp:24:21: error: 'l' was not declared in this scope for(l x:v[i]){ ^ bucketsort.cpp:24:23: error: expected ';' before 'x' for(l x:v[i]){ ^ bucketsort.cpp:28:13: error: expected primary-expression before '}' token } ^ bucketsort.cpp:28:13: error: expected ';' before '}' token bucketsort.cpp:28:13: error: expected primary-expression before '}' token bucketsort.cpp:28:13: error: expected ')' before '}' token bucketsort.cpp:28:13: error: expected primary-expression before '}' token bucketsort.cpp:28:13: error: expected ';' before '}' token bucketsort.cpp:35:24: error: 'maxi' was not declared in this scope for(int i=0;i<=maxi;i++){ ^ bucketsort.cpp:36:17: error: 'v' was not declared in this scope if(!v[i].empty()){ ^ bucketsort.cpp:37:45: error: 'sort' was not declared in this scope sort(v[i].begin(),v[i].end()); ^ bucketsort.cpp:38:21: error: 'l' was not declared in this scope for(l x:v[i]){ ^ bucketsort.cpp:38:23: error: expected ';' before 'x' for(l x:v[i]){ ^ bucketsort.cpp:42:13: error: expected primary-expression before '}' token } ^ bucketsort.cpp:42:13: error: expected ';' before '}' token bucketsort.cpp:42:13: error: expected primary-expression before '}' token bucketsort.cpp:42:13: error: expected ')' before '}' token bucketsort.cpp:42:13: error: expected primary-expression before '}' token bucketsort.cpp:42:13: error: expected ';' before '}' token
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BucketSort 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ă.