제출 #1030956

#제출 시각아이디문제언어결과실행 시간메모리
1030956thinknoexitViruses (BOI20_viruses)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 111; vector<int> adj[N]; vector<vector<int>> mu[N]; int deg[N]; int dp[N]; int main() { cin.tie(nullptr)->sync_with_stdio(false); int g, n, m; cin >> g >> n >> m; for (int i = 1;i <= n;i++) { int a, k; cin >> a >> k; vector<int> mut(k); for (auto& x : mut) cin >> x; mu[a].push_back(mut); } memset(dp, 0x3f, sizeof dp); dp[0] = dp[1] = 1; for (int _ = 1;_ <= g + 1;_++) { for (int i = 2;i < g;i++) { for (auto& x : mu[i]) { ll res = 0; for (auto& y : x) res += dp[y]; dp[i] = min(dp[i], res); } } } for (int i = 2;i < g;i++) { if (dp[i] > 1e9) cout << "YES\n"; else cout << "NO " << dp[i] << '\n'; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Viruses.cpp: In function 'int main()':
Viruses.cpp:27:39: error: no matching function for call to 'min(int&, ll&)'
   27 |                 dp[i] = min(dp[i], res);
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Viruses.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
Viruses.cpp:27:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   27 |                 dp[i] = min(dp[i], res);
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Viruses.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
Viruses.cpp:27:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   27 |                 dp[i] = min(dp[i], res);
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Viruses.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
Viruses.cpp:27:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |                 dp[i] = min(dp[i], res);
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Viruses.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
Viruses.cpp:27:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |                 dp[i] = min(dp[i], res);
      |                                       ^