Detalii evaluare #41374237

Rezumat problemă

#2431 cover

Se consideră N intervale închise, având extremităţile numere naturale cuprinse între 1 şi L. Fiecare număr natural i din intervalul [1, L] are asociată o pondere c[i]. Numim acoperire o mulţime de numere naturale cuprinse între 1 şi L cu proprietatea că fiecare interval conţine cel puţin un element al mulţimii. Costul unei acoperiri este egal cu suma ponderilor numerelor din acoperire.
Pentru un set de intervale dat să se determine costul minim al unei acoperiri.

Detalii

Problema cover Operații I/O cover.in/cover.out
Limita timp 0.5 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #41374237 Utilizator Korina Karagea (chesta)
Fișier cover.cpp Dimensiune 974 B
Data încărcării 20 Ianuarie 2023, 19:27 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

cover.cpp: In function 'int main()':
cover.cpp:21:58: warning: overflow in implicit constant conversion [-Woverflow]
  vector<vector<short>> dp(n + 1, vector<short>(l + 1, 1e9));

                                                          ^
cover.cpp:22:32: warning: overflow in implicit constant conversion [-Woverflow]
  vector<short> small(n + 1, 1e9);

                                ^
cover.cpp:25:33: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<short int> >::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int> >::value_type&)'
   small[1] = min(small[1] , v[i]);

                                 ^
cover.cpp:25:33: note: candidates are:
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 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 cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:   template argument deduction/substitution failed:
cover.cpp:25:33: note:   deduced conflicting types for parameter 'const _Tp' ('short int' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
   small[1] = min(small[1] , v[i]);

                                 ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 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 cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:   template argument deduction/substitution failed:
cover.cpp:25:33: note:   deduced conflicting types for parameter 'const _Tp' ('short int' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
   small[1] = min(small[1] , v[i]);

                                 ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4221:5: note:   template argument deduction/substitution failed:
cover.cpp:25:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'short int'
   small[1] = min(small[1] , v[i]);

                                 ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4226:5: note:   template argument deduction/substitution failed:
cover.cpp:25:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'short int'
   small[1] = min(small[1] , v[i]);

                                 ^
cover.cpp:32:48: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<short int> >::value_type&, int)'
    dp[i][j] = min(dp[i][j], small[i - 1] + v[j]);

                                                ^
cover.cpp:32:48: note: candidates are:
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 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 cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:   template argument deduction/substitution failed:
cover.cpp:32:48: note:   deduced conflicting types for parameter 'const _Tp' ('short int' and 'int')
    dp[i][j] = min(dp[i][j], small[i - 1] + v[j]);

                                                ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 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 cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:   template argument deduction/substitution failed:
cover.cpp:32:48: note:   deduced conflicting types for parameter 'const _Tp' ('short int' and 'int')
    dp[i][j] = min(dp[i][j], small[i - 1] + v[j]);

                                                ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4221:5: note:   template argument deduction/substitution failed:
cover.cpp:32:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'short int'
    dp[i][j] = min(dp[i][j], small[i - 1] + v[j]);

                                                ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64,
                 from cover.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4226:5: note:   template argument deduction/substitution failed:
cover.cpp:32:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'short int'
    dp[i][j] = min(dp[i][j], small[i - 1] + v[j]);

                                                ^
cover.cpp:37:20: warning: overflow in implicit constant conversion [-Woverflow]
  short ans = 5e4 + 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 cover 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ă.