#4612
acoperire2
Floricel vrea să facă cât mai mulți bani. Ca să aibă suficienţi bani să-şi poată cumpăra un apartament, are de rezolvat o problemă care se poate modela astfel: El are N
intervale inițiale, date prin capetele lor. Floricel mai trebuie să creeze intervale noi, denumite intervale de acoperire. Prietenul său, Ted, îi spune că are nevoie de mai multe provocări în viață să fie mai fericit, și îi pune Q
întrebări de forma: “Dacă ai voie să creezi cel mult K
intervale de acoperire, care ar fi lungimea minimă a celui mai lung interval de acoperire astfel încât toate intervalele inițiale să fie acoperite? Și dacă poți, care este soluția minimă lexicografic? O soluție este minimă lexicografic dacă este minimă întâi după numărul intervalelor de acoperire, iar după aceea comparând intervalele după capetele de stânga și de dreapta, ordonând intervalele după capetele din stânga.”
OJI 2024, clasele 11-12
Problema | acoperire2 | Operații I/O |
acoperire.in /acoperire.out
|
---|---|---|---|
Limita timp | 0.25 secunde | Limita memorie |
Total: 128 MB
/
Stivă 8 MB
|
Id soluție | #50136958 | Utilizator | |
Fișier | acoperire2.cpp | Dimensiune | 2.41 KB |
Data încărcării | 28 Martie 2024, 11:20 | Scor / rezultat | Eroare de compilare |
acoperire2.cpp:1:33: note: #pragma message: eu imi bag pl #pragma message ("eu imi bag pl") ^ acoperire2.cpp: In lambda function: acoperire2.cpp:81:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (tmp[0].first!=-69420&&tmp.size()<=k) { ^ acoperire2.cpp: In function 'void solve_testcase()': acoperire2.cpp:103:15: error: cannot convert 'std::vector<std::pair<int, int> >' to 'int' for argument '1' to 'void print_half(int)' print_half(l); fout << " "; print_half(r); fout << "\n"; ^ acoperire2.cpp:103:43: error: cannot convert 'std::vector<std::pair<int, int> >' to 'int' for argument '1' to 'void print_half(int)' print_half(l); fout << " "; print_half(r); fout << "\n"; ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from acoperire2.cpp:8: /usr/include/c++/4.8/tuple: In instantiation of 'std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = int; _U2 = int; _T1 = std::vector<std::pair<int, int> >&; _T2 = std::vector<std::pair<int, int> >&]': acoperire2.cpp:102:23: required from here /usr/include/c++/4.8/tuple:652:25: error: no match for 'operator=' (operand types are 'std::vector<std::pair<int, int> >' and 'const int') this->_M_head(*this) = __in.first; ^ /usr/include/c++/4.8/tuple:652:25: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from acoperire2.cpp:5: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'const int' to 'const std::vector<std::pair<int, int> >&' In file included from /usr/include/c++/4.8/vector:64:0, from acoperire2.cpp:5: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'const int' to 'std::vector<std::pair<int, int> >&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'const int' to 'std::initializer_list<std::pair<int, int> >' In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from acoperire2.cpp:8: /usr/include/c++/4.8/tuple:653:40: error: no match for 'operator=' (operand types are 'std::vector<std::pair<int, int> >' and 'const int') this->_M_tail(*this)._M_head(*this) = __in.second; ^ /usr/include/c++/4.8/tuple:653:40: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from acoperire2.cpp:5: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'const int' to 'const std::vector<std::pair<int, int> >&' In file included from /usr/include/c++/4.8/vector:64:0, from acoperire2.cpp:5: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'const int' to 'std::vector<std::pair<int, int> >&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'const int' to 'std::initializer_list<std::pair<int, int> >'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema acoperire2 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ă.