#4203
NumberOfPoints
În planul xOy
se găsesc n
puncte de coordonate numere naturale, nu neapărat aflate pe poziții distincte. Pentru fiecare punct din plan de coordonate (x, y)
trebuie să spuneți câte alte puncte au coordonatele (p, q)
cu proprietatea că 0 ≤ p < x
și 0 ≤ q ≤ y
(atenție, p
este strict mai mic decât x
, iar q
este mai mic sau egal cu y
).
Folclorul informatic
Problema | NumberOfPoints | Operații I/O |
![]() numberofpoints.in /numberofpoints.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
Id soluție | #51373893 | Utilizator | |
Fișier | numberofpoints.cpp | Dimensiune | 2.11 KB |
Data încărcării | 11 Iunie 2024, 11:33 | Scor / rezultat | Eroare de compilare |
numberofpoints.cpp:33:40: error: ISO C++ forbids declaration of 'ipair' with no type [-fpermissive] bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:46: error: expected ',' or '...' before 'b' bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp: In member function 'bool compare::operator()(const ipair&, const int&)': numberofpoints.cpp:35:26: error: request for member 'second' in 'b', which is of non-class type 'int' if(a.second.first<b.second.first)return 1; ^ numberofpoints.cpp:36:26: error: request for member 'second' in 'b', which is of non-class type 'int' if(a.second.first>b.second.first) return 0; ^ numberofpoints.cpp:37:27: error: request for member 'second' in 'b', which is of non-class type 'int' if(a.second.second<b.second.second)return 1; ^ numberofpoints.cpp: In function 'int main()': numberofpoints.cpp:66:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j=0;j<q.size();j++) ^ numberofpoints.cpp:70:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j=0;j<q.size();j++) ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Compare = compare]': /usr/include/c++/4.8/bits/stl_algo.h:2226:70: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:5500:55: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' numberofpoints.cpp:56:28: required from here /usr/include/c++/4.8/bits/stl_algo.h:2159:29: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' if (__comp(*__i, *__first)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Compare = compare]': /usr/include/c++/4.8/bits/stl_algo.h:5349:59: required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:2332:68: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Size = int; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' numberofpoints.cpp:56:28: required from here /usr/include/c++/4.8/bits/stl_algo.h:1948:27: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' if (__comp(*__i, *__first)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = std::pair<int, std::pair<int, int> >*; _Compare = compare]': /usr/include/c++/4.8/bits/stl_algo.h:2295:13: required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:2337:62: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Size = int; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' numberofpoints.cpp:56:28: required from here /usr/include/c++/4.8/bits/stl_algo.h:114:28: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' if (__comp(*__a, *__b)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:116:25: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' if (__comp(*__b, *__c)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:118:30: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' else if (__comp(*__a, *__c)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:123:33: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' else if (__comp(*__a, *__c)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:125:33: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' else if (__comp(*__b, *__c)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of '_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Tp = std::pair<int, std::pair<int, int> >; _Compare = compare]': /usr/include/c++/4.8/bits/stl_algo.h:2296:78: required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:2337:62: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Size = int; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' numberofpoints.cpp:56:28: required from here /usr/include/c++/4.8/bits/stl_algo.h:2263:35: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, const std::pair<int, std::pair<int, int> >&)' while (__comp(*__first, __pivot)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'const std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/algorithm:62:0, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:2266:34: error: no match for call to '(compare) (const std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' while (__comp(__pivot, *__last)) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&' In file included from /usr/include/c++/4.8/bits/stl_algo.h:61:0, from /usr/include/c++/4.8/algorithm:62, from numberofpoints.cpp:2: /usr/include/c++/4.8/bits/stl_heap.h: In instantiation of 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Distance = int; _Tp = std::pair<int, std::pair<int, int> >; _Compare = compare]': /usr/include/c++/4.8/bits/stl_heap.h:448:15: required from 'void std::make_heap(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:1946:47: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:5349:59: required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:2332:68: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, int> >*; _Size = int; _Compare = compare]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, int> >*; _Compare = compare]' numberofpoints.cpp:56:28: required from here /usr/include/c++/4.8/bits/stl_heap.h:313:40: error: no match for call to '(compare) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' *(__first + (__secondChild - 1)))) ^ numberofpoints.cpp:32:8: note: candidate is: struct compare{ ^ numberofpoints.cpp:33:7: note: bool compare::operator()(const ipair&, const int&) bool operator()(const ipair &a,const &ipair b) ^ numberofpoints.cpp:33:7: note: no known conversion for argument 2 from 'std::pair<int, std::pair<int, int> >' to 'const int&'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NumberOfPoints 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ă.