#2424
puncte3
Considerăm că toate punctele de coordonate întregi din plan sunt colorate în negru, cu excepţia a n
puncte care sunt colorate în roşu. Două puncte roşii aflate pe aceeaşi linie orizontală sau pe aceeaşi linie verticală (adică puncte care au aceeaşi ordonată sau aceeaşi abscisă) pot fi unite printr-un segment. Colorăm în roşu toate punctele de coordonate întregi de pe acest segment. Repetăm operaţia cât timp se obţin puncte roşii noi. Cunoscând coordonatele celor n
puncte care erau iniţial roşii, aflaţi numărul maxim de puncte roşii care vor exista în final.
ONI 2004 clasa a X-a
Problema | puncte3 | Operații I/O |
![]() puncte3.in /puncte3.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #56651588 | Utilizator | |
Fișier | puncte3.cpp | Dimensiune | 2.33 KB |
Data încărcării | 28 Februarie 2025, 20:48 | Scor / rezultat | Eroare de compilare |
puncte3.cpp: In function 'void completeLinesX(unsigned int)': puncte3.cpp:21:34: error: 'completeLinesY' was not declared in this scope completeLinesY(j); ^ puncte3.cpp:25:34: error: 'completeLinesY' was not declared in this scope completeLinesY(j); ^ puncte3.cpp: In function 'int main()': puncte3.cpp:56:5: error: 'ifstream' was not declared in this scope ifstream input; ^ puncte3.cpp:56:5: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from puncte3.cpp:1: /usr/include/c++/4.8/iosfwd:157:34: note: 'std::ifstream' typedef basic_ifstream<char> ifstream; ^ puncte3.cpp:56:14: error: expected ';' before 'input' ifstream input; ^ puncte3.cpp:57:5: error: 'input' was not declared in this scope input.open("puncte3.in");; ^ puncte3.cpp:58:5: error: 'ofstream' was not declared in this scope ofstream output; ^ puncte3.cpp:58:5: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from puncte3.cpp:1: /usr/include/c++/4.8/iosfwd:160:34: note: 'std::ofstream' typedef basic_ofstream<char> ofstream; ^ puncte3.cpp:58:14: error: expected ';' before 'output' ofstream output; ^ puncte3.cpp:59:5: error: 'output' was not declared in this scope output.open("puncte3.out"); ^ puncte3.cpp:62:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i<=n; i++){ ^ puncte3.cpp:64:13: error: no match for 'operator!' (operand type is '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> > >::value_type {aka std::vector<bool>}') if (!matrix[x]){ ^ puncte3.cpp:64:13: note: candidate is: puncte3.cpp:64:13: note: operator!(bool) <built-in> puncte3.cpp:64:13: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> > >::value_type {aka std::vector<bool>}' to 'bool' puncte3.cpp:77:38: error: no matching function for call to 'min(std::vector<unsigned int>&, unsigned int&)' xStart[y] = std::min(xStart,x); ^ puncte3.cpp:77:38: note: candidates are: 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 puncte3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: puncte3.cpp:77:38: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') xStart[y] = std::min(xStart,x); ^ 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 puncte3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: puncte3.cpp:77:38: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') xStart[y] = std::min(xStart,x); ^ puncte3.cpp:78:34: error: no matching function for call to 'max(std::vector<unsigned int>&, unsigned int&)' xEnd[y] = std::max(xEnd,x); ^ puncte3.cpp:78:34: note: candidates are: 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 puncte3.cpp:1: /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) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: puncte3.cpp:78:34: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') xEnd[y] = std::max(xEnd,x); ^ 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 puncte3.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:260:5: note: template argument deduction/substitution failed: puncte3.cpp:78:34: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') xEnd[y] = std::max(xEnd,x); ^ puncte3.cpp:79:38: error: no matching function for call to 'min(std::vector<unsigned int>&, unsigned int&)' yStart[x] = std::min(yStart,y); ^ puncte3.cpp:79:38: note: candidates are: 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 puncte3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: puncte3.cpp:79:38: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') yStart[x] = std::min(yStart,y); ^ 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 puncte3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: puncte3.cpp:79:38: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') yStart[x] = std::min(yStart,y); ^ puncte3.cpp:80:34: error: no matching function for call to 'max(std::vector<unsigned int>&, unsigned int&)' yEnd[x] = std::max(yEnd,y); ^ puncte3.cpp:80:34: note: candidates are: 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 puncte3.cpp:1: /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) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: puncte3.cpp:80:34: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') yEnd[x] = std::max(yEnd,y); ^ 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 puncte3.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:260:5: note: template argument deduction/substitution failed: puncte3.cpp:80:34: note: deduced conflicting types for parameter 'const _Tp' ('std::vector<unsigned int>' and 'unsigned int') yEnd[x] = std::max(yEnd,y); ^ puncte3.cpp:84:25: error: 'CompleteLinesX' was not declared in this scope CompleteLinesX(i); ^ puncte3.cpp:87:25: error: 'CompleteLinesY' was not declared in this scope CompleteLinesY(i); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema puncte3 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ă.