#4786
teren1
Lordul John a decis că a venit vremea să însămânțeze terenul său. Terenul a fost împărțit în parcele organizate în N
linii, pe fiecare linie fiind câte N
parcele pătrate, fiecare cu suprafața de un metru pătrat. Liniile au fost numerotate de sus în jos de la 1
la N
, iar coloanele de la stânga la dreapta de la 1
la N
. Fiind un aviator pasionat, a folosit avionul său pentru a survola terenul în vederea însămânțării. La final, după însămânțare, Lordul John dorește să împrejmuiască cu gard parcelele însămânțate, pentru a le separa de cele rămase neînsămânțate sau de marginea terenului.
1. Determinați numărul semințelor care sunt aruncate.
2. Determinați numărul de parcele care sunt însămânțate.
3. Determinați lungimea gardului care trebuie să separe suprafețele însămânțate de cele neînsămânțate sau de marginea terenului.
OJI 2025, clasa a 7-a
Problema | teren1 | Operații I/O |
![]() teren.in /teren.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57301030 | Utilizator | |
Fișier | teren1.cpp | Dimensiune | 2.57 KB |
Data încărcării | 25 Martie 2025, 08:34 | Scor / rezultat | Eroare de compilare |
teren1.cpp: In function 'int main()': teren1.cpp:18:30: error: 'get' was not declared in this scope fin >> get(zboruri[i]) >> get(zboruri[i]) >> get(zboruri[i]) >> get(zboruri[i]); ^ teren1.cpp:25:30: error: 'get' was not declared in this scope int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor); ^ teren1.cpp:26:37: error: 'lf' was not declared in this scope totalSeminte += max(abs(lf - ls), abs(cf - cs)) + 1; ^ teren1.cpp:26:51: error: 'cf' was not declared in this scope totalSeminte += max(abs(lf - ls), abs(cf - cs)) + 1; ^ teren1.cpp:26:56: error: 'cs' was not declared in this scope totalSeminte += max(abs(lf - ls), abs(cf - cs)) + 1; ^ teren1.cpp:33:30: error: 'get' was not declared in this scope int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor); ^ teren1.cpp:34:27: error: 'lf' was not declared in this scope int deltaL = (lf == ls) ? 0 : (lf - ls > 0 ? 1 : -1); ^ teren1.cpp:35:27: error: 'cf' was not declared in this scope int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1); ^ teren1.cpp:35:33: error: 'cs' was not declared in this scope int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1); ^ teren1.cpp:49:30: error: 'get' was not declared in this scope int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor); ^ teren1.cpp:50:27: error: 'lf' was not declared in this scope int deltaL = (lf == ls) ? 0 : (lf - ls > 0 ? 1 : -1); ^ teren1.cpp:51:27: error: 'cf' was not declared in this scope int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1); ^ teren1.cpp:51:33: error: 'cs' was not declared in this scope int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1); ^ In file included from /usr/include/c++/4.8/vector:64:0, from teren1.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h: In instantiation of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::vector<_Tp, _Alloc>::reference = std::tuple<int, int, int, int>&; std::vector<_Tp, _Alloc>::size_type = unsigned int]': teren1.cpp:18:29: required from here /usr/include/c++/4.8/bits/stl_vector.h:771:41: error: invalid use of incomplete type 'class std::tuple<int, int, int, int>' { return *(this->_M_impl._M_start + __n); } ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 teren1.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<int, int, int, int>' class tuple; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 teren1.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h: In instantiation of '__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::tuple<int, int, int, int>*; _Container = std::vector<std::tuple<int, int, int, int> >]': teren1.cpp:24:33: required from here /usr/include/c++/4.8/bits/stl_iterator.h:748:2: error: cannot increment a pointer to incomplete type 'std::tuple<int, int, int, int>' ++_M_current; ^ In file included from /usr/include/c++/4.8/vector:64:0, from teren1.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >]': /usr/include/c++/4.8/bits/stl_vector.h:270:23: required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' teren1.cpp:16:48: required from here /usr/include/c++/4.8/bits/stl_vector.h:161:9: error: invalid use of incomplete type 'class std::tuple<int, int, int, int>' - this->_M_impl._M_start); } ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 teren1.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<int, int, int, int>' class tuple; ^ In file included from /usr/include/c++/4.8/vector:64:0, from teren1.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h: In instantiation of 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::size_t = unsigned int]': /usr/include/c++/4.8/bits/stl_vector.h:136:30: required from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::size_t = unsigned int; std::_Vector_base<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' /usr/include/c++/4.8/bits/stl_vector.h:270:23: required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' teren1.cpp:16:48: required from here /usr/include/c++/4.8/bits/stl_vector.h:183:59: error: invalid use of incomplete type 'class std::tuple<int, int, int, int>' this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 teren1.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<int, int, int, int>' class tuple; ^ In file included from /usr/include/c++/4.8/vector:62:0, from teren1.cpp:3: /usr/include/c++/4.8/bits/stl_construct.h: In instantiation of 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::tuple<int, int, int, int>*]': /usr/include/c++/4.8/bits/stl_construct.h:151:31: required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_T2>&) [with _ForwardIterator = std::tuple<int, int, int, int>*; _Tp = std::tuple<int, int, int, int>]' /usr/include/c++/4.8/bits/stl_vector.h:416:30: required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >]' teren1.cpp:16:48: required from here /usr/include/c++/4.8/bits/stl_construct.h:127:27: error: invalid use of incomplete type '_Value_type {aka class std::tuple<int, int, int, int>}' __destroy(__first, __last); ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 teren1.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of '_Value_type {aka class std::tuple<int, int, int, int>}' class tuple; ^ In file included from /usr/include/c++/4.8/vector:63:0, from teren1.cpp:3: /usr/include/c++/4.8/bits/stl_uninitialized.h: In instantiation of 'void std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = std::tuple<int, int, int, int>*; _Size = unsigned int]': /usr/include/c++/4.8/bits/stl_uninitialized.h:605:50: required from 'void std::__uninitialized_default_n_a(_ForwardIterator, _Size, std::allocator<_Tp>&) [with _ForwardIterator = std::tuple<int, int, int, int>*; _Size = unsigned int; _Tp = std::tuple<int, int, int, int>]' /usr/include/c++/4.8/bits/stl_vector.h:1225:28: required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::vector<_Tp, _Alloc>::size_type = unsigned int]' /usr/include/c++/4.8/bits/stl_vector.h:271:34: required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' teren1.cpp:16:48: required from here /usr/include/c++/4.8/bits/stl_uninitialized.h:544:33: error: invalid use of incomplete type '_ValueType {aka class std::tuple<int, int, int, int>}' __uninit_default_n(__first, __n); ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 teren1.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of '_ValueType {aka class std::tuple<int, int, int, int>}' class tuple; ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/c++allocator.h:33:0, from /usr/include/c++/4.8/bits/allocator.h:46, from /usr/include/c++/4.8/string:41, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from teren1.cpp:1: /usr/include/c++/4.8/ext/new_allocator.h: In instantiation of '_Tp* __gnu_cxx::new_allocator<_Tp>::allocate(__gnu_cxx::new_allocator<_Tp>::size_type, const void*) [with _Tp = std::tuple<int, int, int, int>; __gnu_cxx::new_allocator<_Tp>::pointer = std::tuple<int, int, int, int>*; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]': /usr/include/c++/4.8/bits/stl_vector.h:168:25: required from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::_Vector_base<_Tp, _Alloc>::pointer = std::tuple<int, int, int, int>*; std::size_t = unsigned int]' /usr/include/c++/4.8/bits/stl_vector.h:181:25: required from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::size_t = unsigned int]' /usr/include/c++/4.8/bits/stl_vector.h:136:30: required from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::size_t = unsigned int; std::_Vector_base<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' /usr/include/c++/4.8/bits/stl_vector.h:270:23: required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' teren1.cpp:16:48: required from here /usr/include/c++/4.8/ext/new_allocator.h:104:54: error: invalid application of 'sizeof' to incomplete type 'std::tuple<int, int, int, int>' return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); ^ /usr/include/c++/4.8/ext/new_allocator.h: In instantiation of '__gnu_cxx::new_allocator<_Tp>::size_type __gnu_cxx::new_allocator<_Tp>::max_size() const [with _Tp = std::tuple<int, int, int, int>; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]': /usr/include/c++/4.8/ext/new_allocator.h:101:10: required from '_Tp* __gnu_cxx::new_allocator<_Tp>::allocate(__gnu_cxx::new_allocator<_Tp>::size_type, const void*) [with _Tp = std::tuple<int, int, int, int>; __gnu_cxx::new_allocator<_Tp>::pointer = std::tuple<int, int, int, int>*; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]' /usr/include/c++/4.8/bits/stl_vector.h:168:25: required from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::_Vector_base<_Tp, _Alloc>::pointer = std::tuple<int, int, int, int>*; std::size_t = unsigned int]' /usr/include/c++/4.8/bits/stl_vector.h:181:25: required from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::size_t = unsigned int]' /usr/include/c++/4.8/bits/stl_vector.h:136:30: required from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::size_t = unsigned int; std::_Vector_base<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' /usr/include/c++/4.8/bits/stl_vector.h:270:23: required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::tuple<int, int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int, int> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::tuple<int, int, int, int> >]' teren1.cpp:16:48: required from here /usr/include/c++/4.8/ext/new_allocator.h:114:35: error: invalid application of 'sizeof' to incomplete type 'std::tuple<int, int, int, int>' { return size_t(-1) / sizeof(_Tp); } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema teren1 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ă.