Detalii evaluare #50168722

Rezumat problemă

#3283 Lee1 C++

Se dă o matrice cu n linii și m coloane. Pentru k poziții date, se cere să se determine drumul de lungime minimă care pleacă de la poziția i1 și j1 și trece prin toate cele k poziții (nu contează în ce ordine), ajungând în final în poziția i2 si j2.

Detalii

Problema Lee1 Operații I/O lee1.in/lee1.out
Limita timp 0.5 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #50168722 Utilizator ANDREEA STRIMBEANU (andreea2205006)
Fișier lee1.cpp Dimensiune 2.65 KB
Data încărcării 29 Martie 2024, 13:32 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

lee1.cpp:15:49: error: declaration of 'cost' as multidimensional array must have bounds for all dimensions except the first
 void lee(int x, int y, int nivel, int cost[105][]) {

                                                 ^
lee1.cpp: In function 'void lee(...)':
lee1.cpp:20:13: error: expected initializer before 'coada'
     int Nod coada(100001);

             ^
lee1.cpp:22:5: error: 'coada' was not declared in this scope
     coada[1] = {x, y, 1};

     ^
lee1.cpp:22:17: error: 'x' was not declared in this scope
     coada[1] = {x, y, 1};

                 ^
lee1.cpp:22:20: error: 'y' was not declared in this scope
     coada[1] = {x, y, 1};

                    ^
lee1.cpp:23:5: error: 'cost' was not declared in this scope
     cost[x][y] = 1;

     ^
lee1.cpp: In function 'void miscare(int, int, int)':
lee1.cpp:40:22: error: 'pozitii' cannot be used as a function
     if (k == pozitii()) {

                      ^
lee1.cpp:42:36: error: 'traseu' cannot be used as a function
         for (int i = 0; i < traseu() - 1; i++) {

                                    ^
lee1.cpp:43:52: error: invalid types 'int[int]' for array subscript
             cost_curent += matrice[pozitii[traseu[i]].x][pozitii[traseu[i]].y] - 1;

                                                    ^
lee1.cpp:43:74: error: invalid types 'int[int]' for array subscript
             cost_curent += matrice[pozitii[traseu[i]].x][pozitii[traseu[i]].y] - 1;

                                                                          ^
lee1.cpp:49:24: error: no match for call to '(Pozitie) ()'
             drum_minim();

                        ^
lee1.cpp:50:29: error: no match for call to '(Pozitie) (Pozitie&)'
             drum_minim(start);

                             ^
lee1.cpp:51:28: error: no matching function for call to 'begin(int&)'
             for (int idx : traseu) {

                            ^
lee1.cpp:51:28: note: candidates are:
In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0,
                 from /usr/include/c++/4.8/string:52,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)
     begin(initializer_list<_Tp> __ils) noexcept
     ^
/usr/include/c++/4.8/initializer_list:89:5: note:   template argument deduction/substitution failed:
lee1.cpp:51:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
             for (int idx : traseu) {

                            ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm])
     begin(_Tp (&__arr)[_Nm])
     ^
/usr/include/c++/4.8/bits/range_access.h:87:5: note:   template argument deduction/substitution failed:
lee1.cpp:51:28: note:   mismatched types '_Tp [_Nm]' and 'int'
             for (int idx : traseu) {

                            ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)
     begin(const _Container& __cont) -> decltype(__cont.begin())
     ^
/usr/include/c++/4.8/bits/range_access.h:58:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = int]':
lee1.cpp:51:28:   required from here
/usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&)
     begin(_Container& __cont) -> decltype(__cont.begin())
     ^
/usr/include/c++/4.8/bits/range_access.h:48:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = int]':
lee1.cpp:51:28:   required from here
/usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'int'
lee1.cpp:51:28: error: no matching function for call to 'end(int&)'
             for (int idx : traseu) {

                            ^
lee1.cpp:51:28: note: candidates are:
In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0,
                 from /usr/include/c++/4.8/string:52,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)
     end(initializer_list<_Tp> __ils) noexcept
     ^
/usr/include/c++/4.8/initializer_list:99:5: note:   template argument deduction/substitution failed:
lee1.cpp:51:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
             for (int idx : traseu) {

                            ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])
     end(_Tp (&__arr)[_Nm])
     ^
/usr/include/c++/4.8/bits/range_access.h:97:5: note:   template argument deduction/substitution failed:
lee1.cpp:51:28: note:   mismatched types '_Tp [_Nm]' and 'int'
             for (int idx : traseu) {

                            ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&)
     end(const _Container& __cont) -> decltype(__cont.end())
     ^
/usr/include/c++/4.8/bits/range_access.h:78:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = int]':
lee1.cpp:51:28:   required from here
/usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&)
     end(_Container& __cont) -> decltype(__cont.end())
     ^
/usr/include/c++/4.8/bits/range_access.h:68:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = int]':
lee1.cpp:51:28:   required from here
/usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'int'
lee1.cpp:52:40: error: no match for call to '(Pozitie) (Pozitie&)'
                 drum_minim(pozitii[idx]);

                                        ^
lee1.cpp:54:38: error: no match for call to '(Pozitie) (Pozitie&)'
             drum_minim(pozitie_finala);

                                      ^
lee1.cpp:59:33: error: 'pozitii' cannot be used as a function
     for (int j = 0; j < pozitii(); j++) {

                                 ^
lee1.cpp:60:23: error: invalid types 'int[int]' for array subscript
         if (!vizitat[j]) {

                       ^
lee1.cpp:61:22: error: invalid types 'int[int]' for array subscript
             vizitat[j] = 1;

                      ^
lee1.cpp:62:21: error: invalid types 'int[int]' for array subscript
             traseu[k] = j;

                     ^
lee1.cpp:64:22: error: invalid types 'int[int]' for array subscript
             vizitat[j] = 0;

                      ^
lee1.cpp: In function 'int main()':
lee1.cpp:74:31: error: 'matrice' cannot be used as a function
     matrice(n + 1, int (m + 1));

                               ^
lee1.cpp:86:14: error: 'pozitii' cannot be used as a function
     pozitii(k);

              ^
lee1.cpp:91:32: error: expression list treated as compound expression in initializer [-fpermissive]
     int cost(n + 1, int (m + 1));

                                ^
lee1.cpp:91:16: warning: left operand of comma operator has no effect [-Wunused-value]
     int cost(n + 1, int (m + 1));

                ^
lee1.cpp:101:21: error: no matching function for call to 'begin(Pozitie&)'
     for (auto pos : drum_minim) {

                     ^
lee1.cpp:101:21: note: candidates are:
In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0,
                 from /usr/include/c++/4.8/string:52,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)
     begin(initializer_list<_Tp> __ils) noexcept
     ^
/usr/include/c++/4.8/initializer_list:89:5: note:   template argument deduction/substitution failed:
lee1.cpp:101:21: note:   'Pozitie' is not derived from 'std::initializer_list<_Tp>'
     for (auto pos : drum_minim) {

                     ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm])
     begin(_Tp (&__arr)[_Nm])
     ^
/usr/include/c++/4.8/bits/range_access.h:87:5: note:   template argument deduction/substitution failed:
lee1.cpp:101:21: note:   mismatched types '_Tp [_Nm]' and 'Pozitie'
     for (auto pos : drum_minim) {

                     ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)
     begin(const _Container& __cont) -> decltype(__cont.begin())
     ^
/usr/include/c++/4.8/bits/range_access.h:58:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = Pozitie]':
lee1.cpp:101:21:   required from here
/usr/include/c++/4.8/bits/range_access.h:58:5: error: 'const struct Pozitie' has no member named 'begin'
/usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&)
     begin(_Container& __cont) -> decltype(__cont.begin())
     ^
/usr/include/c++/4.8/bits/range_access.h:48:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = Pozitie]':
lee1.cpp:101:21:   required from here
/usr/include/c++/4.8/bits/range_access.h:48:5: error: 'struct Pozitie' has no member named 'begin'
lee1.cpp:101:21: error: no matching function for call to 'end(Pozitie&)'
     for (auto pos : drum_minim) {

                     ^
lee1.cpp:101:21: note: candidates are:
In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0,
                 from /usr/include/c++/4.8/string:52,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)
     end(initializer_list<_Tp> __ils) noexcept
     ^
/usr/include/c++/4.8/initializer_list:99:5: note:   template argument deduction/substitution failed:
lee1.cpp:101:21: note:   'Pozitie' is not derived from 'std::initializer_list<_Tp>'
     for (auto pos : drum_minim) {

                     ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])
     end(_Tp (&__arr)[_Nm])
     ^
/usr/include/c++/4.8/bits/range_access.h:97:5: note:   template argument deduction/substitution failed:
lee1.cpp:101:21: note:   mismatched types '_Tp [_Nm]' and 'Pozitie'
     for (auto pos : drum_minim) {

                     ^
In file included from /usr/include/c++/4.8/string:51:0,
                 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 lee1.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&)
     end(const _Container& __cont) -> decltype(__cont.end())
     ^
/usr/include/c++/4.8/bits/range_access.h:78:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = Pozitie]':
lee1.cpp:101:21:   required from here
/usr/include/c++/4.8/bits/range_access.h:78:5: error: 'const struct Pozitie' has no member named 'end'
/usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&)
     end(_Container& __cont) -> decltype(__cont.end())
     ^
/usr/include/c++/4.8/bits/range_access.h:68:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = Pozitie]':
lee1.cpp:101:21:   required from here
/usr/include/c++/4.8/bits/range_access.h:68:5: error: 'struct Pozitie' has no member named 'end'

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