Submission #953537

# Submission time Handle Problem Language Result Execution time Memory
953537 2024-03-26T05:48:31 Z koukirocks Viruses (BOI20_viruses) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
 
namespace{using namespace std;}
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MAX=1e3+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
const ldb eps=1e-6;

ll g,n,m;
vector<vector<ll> > GT[MAX];
ll ans[MAX];

ll dfs(int v) {
	if (ans[v]!=-1) return ans[v];
	ans[v]=INF;
	for (auto st:GT[v]) {
		ll now=0;
		for (int i:st) {
			now+=dfs(i);
		}
		ans[v]=min(ans[v],now);
	}
	return ans[v];
}

int main() {
	speed;
	cin>>g>>n>>m;
	for (int i=0;i<n;i++) {
		ll a,k;
		vector<int> mut;
		cin>>a>>k;
		while (k--) {
			int x;
			cin>>x;
			mut.push_back(x);
		}
		GT[a].push_back(mut);
	}
	memset(ans,-1,sizeof(ans));
	ans[0]=1;
	ans[1]=1;
	for (int i=0;i<g;i++) {
		cout<<"NO "<<dfs(i)<<"\n";
	}
	return 0;
}

Compilation message

Viruses.cpp: In function 'int main()':
Viruses.cpp:49:22: error: no matching function for call to 'std::vector<std::vector<long long int> >::push_back(std::vector<int>&)'
   49 |   GT[a].push_back(mut);
      |                      ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Viruses.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const std::vector<long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<std::vector<long long int> >::value_type&&' {aka 'std::vector<long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~