Detalii evaluare #51858609

Rezumat problemă

Se dau un arbore cu N noduri și rădăcina în nodul 1 al cărui muchii au lungimi exprimate prin numere naturale nenule și Q query-uri de forma u v. Pentru fiecare query să se afle suma lungimilor tuturor drumurilor distincte de la un nod aflat în subarborele cu rădăcina în nodul u la un nod aflat în subarborele cu rădăcina în nodul v modulo \( {10}^{9} + 7 \)(lungimea unui drum este egală cu suma lungimilor tuturor muchiilor ce îl alcătuiesc).

Detalii

Problema paths_sums Operații I/O tastatură/ecran
Limita timp 0.6 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #51858609 Utilizator Cazacu Cosmin (ccc7)
Fișier paths_sums.cpp Dimensiune 302 B
Data încărcării 30 August 2024, 16:06 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

paths_sums.cpp: In function 'void distanta(int)':
paths_sums.cpp:7:21: error: no matching function for call to 'begin(int&)'
 {for(auto x:muchii[k])

                     ^
paths_sums.cpp:7:21: note: candidates are:
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0,
                 from paths_sums.cpp:1:
/usr/include/c++/4.8/valarray:1206:5: note: template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&)
     begin(const valarray<_Tp>& __va)
     ^
/usr/include/c++/4.8/valarray:1206:5: note:   template argument deduction/substitution failed:
paths_sums.cpp:7:21: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
 {for(auto x:muchii[k])

                     ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0,
                 from paths_sums.cpp:1:
/usr/include/c++/4.8/valarray:1196:5: note: template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&)
     begin(valarray<_Tp>& __va)
     ^
/usr/include/c++/4.8/valarray:1196:5: note:   template argument deduction/substitution failed:
paths_sums.cpp:7:21: note:   mismatched types 'std::valarray<_Tp>' and 'int'
 {for(auto x:muchii[k])

                     ^
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/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 paths_sums.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:
paths_sums.cpp:7:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
 {for(auto x:muchii[k])

                     ^
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/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 paths_sums.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:
paths_sums.cpp:7:21: note:   mismatched types '_Tp [_Nm]' and 'int'
 {for(auto x:muchii[k])

                     ^
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/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 paths_sums.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]':
paths_sums.cpp:7:21:   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]':
paths_sums.cpp:7:21:   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'
paths_sums.cpp:7:21: error: no matching function for call to 'end(int&)'
 {for(auto x:muchii[k])

                     ^
paths_sums.cpp:7:21: note: candidates are:
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0,
                 from paths_sums.cpp:1:
/usr/include/c++/4.8/valarray:1226:5: note: template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)
     end(const valarray<_Tp>& __va)
     ^
/usr/include/c++/4.8/valarray:1226:5: note:   template argument deduction/substitution failed:
paths_sums.cpp:7:21: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
 {for(auto x:muchii[k])

                     ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0,
                 from paths_sums.cpp:1:
/usr/include/c++/4.8/valarray:1216:5: note: template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)
     end(valarray<_Tp>& __va)
     ^
/usr/include/c++/4.8/valarray:1216:5: note:   template argument deduction/substitution failed:
paths_sums.cpp:7:21: note:   mismatched types 'std::valarray<_Tp>' and 'int'
 {for(auto x:muchii[k])

                     ^
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/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 paths_sums.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:
paths_sums.cpp:7:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
 {for(auto x:muchii[k])

                     ^
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/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 paths_sums.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:
paths_sums.cpp:7:21: note:   mismatched types '_Tp [_Nm]' and 'int'
 {for(auto x:muchii[k])

                     ^
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/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 paths_sums.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]':
paths_sums.cpp:7:21:   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]':
paths_sums.cpp:7:21:   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'
paths_sums.cpp:9:10: error: expected unqualified-id before '[' token
 for(auto [muchie,cost]:dis[x])

          ^
paths_sums.cpp:9:10: error: expected ';' before '[' token
paths_sums.cpp:9:11: error: 'muchie' was not declared in this scope
 for(auto [muchie,cost]:dis[x])

           ^
paths_sums.cpp:9:18: error: 'cost' was not declared in this scope
 for(auto [muchie,cost]:dis[x])

                  ^
paths_sums.cpp: In lambda function:
paths_sums.cpp:9:23: error: expected '{' before ':' token
 for(auto [muchie,cost]:dis[x])

                       ^
paths_sums.cpp: In function 'void distanta(int)':
paths_sums.cpp:9:23: error: expected ';' before ':' token
paths_sums.cpp:9:23: error: expected primary-expression before ':' token
paths_sums.cpp:9:23: error: expected ')' before ':' token
paths_sums.cpp:9:23: error: expected primary-expression before ':' token
paths_sums.cpp:9:23: error: expected ';' before ':' token

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