Detalii evaluare #43569788

Rezumat problemă

#740 Horse

Se consideră o tablă de şah cu n linii şi n coloane, şi n=4k+1. Liniile acestei table sunt numerotate de sus în jos începând cu linia 1, iar coloanele sunt numerotate de la stânga la dreapta începând cu 1. În fiecare dintre câmpurile acestei table se scrie câte un număr natural din mulţimea {1, 2, …, n2} după următoarele reguli:

a) se porneşte din colţul aflat în poziţia stânga sus al tablei şi se avansează utilizând săritura calului
b) se merge orizontal către dreapta şi în continuare, pe chenarul format din primele două linii, primele două coloane, ultimele două linii şi ultimele două coloane, în sensul acelor de ceasornic;
c) se efectuează mai multe tururi ale tablei, până ce se umple întregul chenar, fără să se sară de două ori în aceeaşi căsuţă, fără să se sară în afara acestui chenar şi fără să rămână vreun câmp liber;
d) din poziţia finală în care s-a ajuns, trebuie să fie posibilă săritura în colţul din stânga sus al pătratului rămas neacoperit;
e) se continuă deplasarea în interiorul pătratului rămas neacoperit, folosind regulile a), b), c), d) până ce se ajunge la pătratul interior de latură 1 care va conţine valoarea n2.

Cunoscând valoarea lui n ce reprezintă dimensiunea tablei şi un număr p, să se determine linia şi coloana căsuţei din tabelă unde este scris numărul p, după regulile de mai sus.

Lot Juniori, Bistrita, 2009

Detalii

Problema Horse Operații I/O horse.in/horse.out
Limita timp 0.25 secunde Limita memorie Total: 2 MB / Stivă 2 MB
Id soluție #43569788 Utilizator Ariton Mihai (Mihai_Ariton)
Fișier horse.cpp Dimensiune 2.28 KB
Data încărcării 03 Mai 2023, 21:24 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:115,
                 from horse.cpp:1:
/usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of 'struct std::__detail::__is_noexcept_hash<int, std::unordered_set<int> >':
/usr/include/c++/4.8/type_traits:121:12:   recursively required from 'struct std::__and_<std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > >'
/usr/include/c++/4.8/type_traits:121:12:   required from 'struct std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > >'
/usr/include/c++/4.8/type_traits:127:38:   required from 'struct std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
/usr/include/c++/4.8/bits/unordered_set.h:95:63:   required from 'class std::unordered_set<int, std::unordered_set<int> >'
horse.cpp:5:39:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:85:33: error: no match for call to '(const std::unordered_set<int>) (const int&)'
  noexcept(declval<const _Hash&>()(declval<const _Key&>()))>
                                 ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 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/istream:38,
                 from /usr/include/c++/4.8/sstream:38,
                 from /usr/include/c++/4.8/complex:45,
                 from /usr/include/c++/4.8/ccomplex:38,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from horse.cpp:1:
/usr/include/c++/4.8/type_traits: In instantiation of 'struct std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >':
/usr/include/c++/4.8/bits/unordered_set.h:95:63:   required from 'class std::unordered_set<int, std::unordered_set<int> >'
horse.cpp:5:39:   required from here
/usr/include/c++/4.8/type_traits:127:38: error: 'value' is not a member of 'std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > >'
     : public integral_constant<bool, !_Pp::value>
                                      ^
In file included from /usr/include/c++/4.8/unordered_set:48:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:116,
                 from horse.cpp:1:
/usr/include/c++/4.8/bits/unordered_set.h: In instantiation of 'class std::unordered_set<int, std::unordered_set<int> >':
horse.cpp:5:39:   required from here
/usr/include/c++/4.8/bits/unordered_set.h:95:63: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc>  _Hashtable;
                                                               ^
/usr/include/c++/4.8/bits/unordered_set.h:102:45: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::key_type key_type;
                                             ^
/usr/include/c++/4.8/bits/unordered_set.h:103:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::value_type value_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_set.h:104:43: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::hasher hasher;
                                           ^
/usr/include/c++/4.8/bits/unordered_set.h:105:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::key_equal key_equal;
                                              ^
/usr/include/c++/4.8/bits/unordered_set.h:106:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::allocator_type allocator_type;
                                                   ^
/usr/include/c++/4.8/bits/unordered_set.h:115:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::iterator  iterator;
                                              ^
/usr/include/c++/4.8/bits/unordered_set.h:116:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::const_iterator const_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_set.h:117:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::local_iterator local_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_set.h:118:57: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::const_local_iterator const_local_iterator;
                                                         ^
/usr/include/c++/4.8/bits/unordered_set.h:119:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::size_type  size_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_set.h:120:52: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       typedef typename _Hashtable::difference_type difference_type;
                                                    ^
/usr/include/c++/4.8/bits/unordered_set.h:206:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       operator=(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_set.h:300:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
  emplace(_Args&&... __args)
  ^
/usr/include/c++/4.8/bits/unordered_set.h:344:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       insert(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_set.h:348:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       insert(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/unordered_set.h:403:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       insert(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_set.h:547:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       equal_range(const key_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_set.h:551:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_default_constructible<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::is_copy_assignable<std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > >, std::__detail::__is_noexcept_hash<int, std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> > > > >'
       equal_range(const key_type& __x) const
       ^
horse.cpp:5:39: error: no matching function for call to 'std::unordered_set<int, std::unordered_set<int> >::unordered_set()'
 unordered_set<int, unordered_set<int>>f;

                                       ^
horse.cpp:5:39: note: candidates are:
In file included from /usr/include/c++/4.8/unordered_set:48:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:116,
                 from horse.cpp:1:
/usr/include/c++/4.8/bits/unordered_set.h:165:7: note: std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(std::unordered_set<_Value, _Hash, _Pred, _Alloc>&&) [with _Value = int; _Hash = std::unordered_set<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<int>]
       unordered_set(unordered_set&&) = default;
       ^
/usr/include/c++/4.8/bits/unordered_set.h:165:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/4.8/bits/unordered_set.h:162:7: note: std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const std::unordered_set<_Value, _Hash, _Pred, _Alloc>&) [with _Value = int; _Hash = std::unordered_set<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<int>]
       unordered_set(const unordered_set&) = default;
       ^
/usr/include/c++/4.8/bits/unordered_set.h:162:7: note:   candidate expects 1 argument, 0 provided
horse.cpp: In function 'int verif(int, int)':
horse.cpp:8:9: error: no match for 'operator[]' (operand types are 'std::unordered_set<int, std::unordered_set<int> >' and 'int')
     if(f[l][c]>0)

         ^
horse.cpp: In function 'int main()':
horse.cpp:66:14: error: no match for 'operator[]' (operand types are 'std::unordered_set<int, std::unordered_set<int> >' and 'int')
         s++;f[l][c]=1;

              ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Horse face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.