#3489
Dându-se o mulțime de puncte și o mulțime de cercuri, pentru fiecare cerc să se stabilească câte puncte conține.
| Problema | Numara punctele | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64891952 | Utilizator | |
| Fișier | numara_punctele.cpp | Dimensiune | 2.13 KB |
| Data încărcării | 10 Iunie 2026, 00:29 | Scor/rezultat | Eroare de compilare |
numara_punctele.cpp: In function ‘int main()’: numara_punctele.cpp:20:9: error: ‘vector’ was not declared in this scope 20 | vector<array<double, 2>> grid[100][100]; | ^~~~~~ numara_punctele.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 2 | #include <cmath> +++ |+#include <vector> 3 | using namespace std; numara_punctele.cpp:20:16: error: ‘array’ was not declared in this scope 20 | vector<array<double, 2>> grid[100][100]; | ^~~~~ numara_punctele.cpp:3:1: note: ‘std::array’ is defined in header ‘<array>’; did you forget to ‘#include <array>’? 2 | #include <cmath> +++ |+#include <array> 3 | using namespace std; numara_punctele.cpp:20:22: error: expected primary-expression before ‘double’ 20 | vector<array<double, 2>> grid[100][100]; | ^~~~~~ numara_punctele.cpp:27:9: error: ‘grid’ was not declared in this scope 27 | grid[row_p][col_p].push_back({xp, yp}); | ^~~~ numara_punctele.cpp:35:14: error: expected ‘;’ before ‘r_2’ 35 | k = 0 | ^ | ; 36 | r_2 = rc * rc; | ~~~ numara_punctele.cpp:51:38: error: no matching function for call to ‘max(double, double, double, double)’ 51 | double furthest = max( | ~~~^ 52 | d2(xc, yc, bottom, left), | ~~~~~~~~~~~~~~~~~~~~~~~~~ 53 | d2(xc, yc, bottom, right), | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | d2(xc, yc, top, left), | ~~~~~~~~~~~~~~~~~~~~~~ 55 | d2(xc, yc, top, right) | ~~~~~~~~~~~~~~~~~~~~~~ 56 | ); | ~ In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from numara_punctele.cpp:1: /usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: numara_punctele.cpp:51:38: note: candidate expects 2 arguments, 4 provided 51 | double furthest = max( | ~~~^ 52 | d2(xc, yc, bottom, left), | ~~~~~~~~~~~~~~~~~~~~~~~~~ 53 | d2(xc, yc, bottom, right), | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | d2(xc, yc, top, left), | ~~~~~~~~~~~~~~~~~~~~~~ 55 | d2(xc, yc, top, right) | ~~~~~~~~~~~~~~~~~~~~~~ 56 | ); | ~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed: numara_punctele.cpp:51:38: note: candidate expects 3 arguments, 4 provided 51 | double furthest = max( | ~~~^ 52 | d2(xc, yc, bottom, left), | ~~~~~~~~~~~~~~~~~~~~~~~~~ 53 | d2(xc, yc, bottom, right), | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | d2(xc, yc, top, left), | ~~~~~~~~~~~~~~~~~~~~~~ 55 | d2(xc, yc, top, right) | ~~~~~~~~~~~~~~~~~~~~~~ 56 | ); | ~ numara_punctele.cpp:58:32: error: ‘r_2’ was not declared in this scope; did you mean ‘r2’? 58 | if(furthest <= r_2) { | ^~~ | r2 numara_punctele.cpp:59:30: error: ‘grid’ was not declared in this scope 59 | k += grid[row][col].size(); | ^~~~ numara_punctele.cpp:63:37: error: no matching function for call to ‘min(double, double, double, double)’ 63 | double nearest = min( | ~~~^ 64 | d2(xc, yc, bottom, left), | ~~~~~~~~~~~~~~~~~~~~~~~~~ 65 | d2(xc, yc, bottom, right), | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 66 | d2(xc, yc, top, left), | ~~~~~~~~~~~~~~~~~~~~~~ 67 | d2(xc, yc, top, right) | ~~~~~~~~~~~~~~~~~~~~~~ 68 | ); | ~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: ‘template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: numara_punctele.cpp:63:37: note: candidate expects 2 arguments, 4 provided 63 | double nearest = min( | ~~~^ 64 | d2(xc, yc, bottom, left), | ~~~~~~~~~~~~~~~~~~~~~~~~~ 65 | d2(xc, yc, bottom, right), | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 66 | d2(xc, yc, top, left), | ~~~~~~~~~~~~~~~~~~~~~~ 67 | d2(xc, yc, top, right) | ~~~~~~~~~~~~~~~~~~~~~~ 68 | ); | ~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: template argument deduction/substitution failed: numara_punctele.cpp:63:37: note: candidate expects 3 arguments, 4 provided 63 | double nearest = min( | ~~~^ 64 | d2(xc, yc, bottom, left), | ~~~~~~~~~~~~~~~~~~~~~~~~~ 65 | d2(xc, yc, bottom, right), | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 66 | d2(xc, yc, top, left), | ~~~~~~~~~~~~~~~~~~~~~~ 67 | d2(xc, yc, top, right) | ~~~~~~~~~~~~~~~~~~~~~~ 68 | ); | ~ numara_punctele.cpp:70:30: error: ‘r_2’ was not declared in this scope; did you mean ‘r2’? 70 | if(nearest > r_2) | ^~~ | r2 numara_punctele.cpp:73:34: error: ‘grid’ was not declared in this scope 73 | for(auto point : grid[row][col]) | ^~~~ numara_punctele.cpp:18:32: warning: unused variable ‘dx’ [-Wunused-variable] 18 | double xp, yp, xc, yc, rc, dx, dy, r2; | ^~ numara_punctele.cpp:18:36: warning: unused variable ‘dy’ [-Wunused-variable] 18 | double xp, yp, xc, yc, rc, dx, dy, r2; | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Numara punctele 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ă.