Detalii evaluare #36436271

Rezumat problemă

Să se determine o modalitate de parcurgere a unei tablei de către un cal care se deplasează în maniera specifică piesei de șah, astfel încât acesta să nu treacă de două ori prin aceeaşi poziţie.

Detalii

Problema Saritura_Calului1 Operații I/O saritura_calului1.in/saritura_calului1.out
Limita timp 1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #36436271 Utilizator Oros Vlad-Stefan (vlad_stefan12)
Fișier saritura_calului1.cpp Dimensiune 1.14 KB
Data încărcării 02 Mai 2022, 10:47 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

saritura_calului1.cpp: In function 'int nngh(int, int)':
saritura_calului1.cpp:17:20: error: reference to 'next' is ambiguous
         inxt = i + next[k].first; jnxt = j + next[k].second;

                    ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp:17:46: error: reference to 'next' is ambiguous
         inxt = i + next[k].first; jnxt = j + next[k].second;

                                              ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp: In function 'int main()':
saritura_calului1.cpp:25:13: error: 'j' was not declared in this scope
     int i = j = 1, nghi, nghj, val = 0, k = 1;

             ^
saritura_calului1.cpp:28:4: error: 'val' was not declared in this scope
    val = 0;

    ^
saritura_calului1.cpp:29:50: error: reference to 'next' is ambiguous
         for (int k = 0; k < 8; ++k) if (nngh(i + next[k].first, j + next[k].second) > val) {

                                                  ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp:29:69: error: reference to 'next' is ambiguous
         for (int k = 0; k < 8; ++k) if (nngh(i + next[k].first, j + next[k].second) > val) {

                                                                     ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp:30:28: error: reference to 'next' is ambiguous
             val = nngh(i + next[k].first, j + next[k].second);

                            ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp:30:47: error: reference to 'next' is ambiguous
             val = nngh(i + next[k].first, j + next[k].second);

                                               ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp:31:13: error: 'nghi' was not declared in this scope
             nghi = i + next[k].first; nghj = j + next[k].second;

             ^
saritura_calului1.cpp:31:24: error: reference to 'next' is ambiguous
             nghi = i + next[k].first; nghj = j + next[k].second;

                        ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp:31:39: error: 'nghj' was not declared in this scope
             nghi = i + next[k].first; nghj = j + next[k].second;

                                       ^
saritura_calului1.cpp:31:50: error: reference to 'next' is ambiguous
             nghi = i + next[k].first; nghj = j + next[k].second;

                                                  ^
saritura_calului1.cpp:12:16: note: candidates are: std::pair<int, int> next [8]
 pair<int, int> next[8] = {{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2, 1}, {1, 2}};

                ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66: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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from saritura_calului1.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
saritura_calului1.cpp:33:13: error: 'nghi' was not declared in this scope
         i = nghi; j = nghj; isVisited[i][j] = ++k;

             ^
saritura_calului1.cpp:33:23: error: 'nghj' was not declared in this scope
         i = nghi; j = nghj; isVisited[i][j] = ++k;

                       ^
saritura_calului1.cpp:33:49: error: 'k' was not declared in this scope
         i = nghi; j = nghj; isVisited[i][j] = ++k;

                                                 ^

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