Submission #743183

# Submission time Handle Problem Language Result Execution time Memory
743183 2023-05-17T08:39:11 Z hmm789 Viruses (BOI20_viruses) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1000000000000000000

vector<vector<int>> adj2[200];
//~ set<int> adj[200];
int ans[200];
bool v[200];

//~ bool cyc(int x) {
	//~ if(v[x]) return true;
	//~ v[x] = 1;
	//~ for(int i : adj[x]) {
		//~ bool f = cyc(i);
		//~ cout << "a " << x << " " << i << " " << f << endl;
		//~ if(f) return true;
	//~ }
	//~ v[x] = 0;
	//~ return false;
//~ }

int dp(int x) {
	if(x == 0 || x == 1) return 1;
	if(ans[x] == -2) return INF;
	if(ans[x] != -1) return ans[x];
	if(v[x]) return INF;
	v[x] = 1;
	ans[x] = INF;
	for(vector<int> v : adj2[x]) {
		int tmp = 0;
		for(int i : v) {
			tmp += dp(i);
			tmp = min(tmp, INF);
		}
		//~ cout << " a  " << x << " " << v[0] << " " << tmp << endl;
		ans[x] = min(ans[x], tmp);
	}
	//~ cout << " b " << x << " " << ans[x] << endl;
	if(ans[x] == INF) ans[x] = -2;
	v[x] = 0;
	if(ans[x] == -2) return INF;
	return ans[x];
}


int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int g, n, m, x, y, a;
	cin >> g >> n >> m;
	for(int i = 0; i < n; i++) {
		cin >> x >> a;
		vector<int> tmp;
		for(int j = 0; j < a; j++) {
			cin >> y;
			//~ adj[x].insert(y);
			tmp.push_back(y);
		}
		adj2[x].push_back(tmp);
	}
	memset(ans, -1, sizeof(ans));
	for(int i = 2; i < g; i++) {
		if(dp(i) == INF) cout << "YES\n";
		else cout << "NO " << dp(i) << '\n';
	}
}

Compilation message

Viruses.cpp: In function 'long long int dp(long long int)':
Viruses.cpp:34:22: error: no matching function for call to 'min(long long int&, long int)'
   34 |    tmp = min(tmp, INF);
      |                      ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 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:34:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   34 |    tmp = min(tmp, INF);
      |                      ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 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:34:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   34 |    tmp = min(tmp, INF);
      |                      ^
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:34:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |    tmp = min(tmp, INF);
      |                      ^
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:34:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |    tmp = min(tmp, INF);
      |                      ^