Submission #1102062

#TimeUsernameProblemLanguageResultExecution timeMemory
1102062razivoViruses (BOI20_viruses)C++14
11 / 100
1 ms560 KiB
#include <iostream> #include <vector> #include <climits> typedef long long ll; using namespace std; int main() { ll g,n,m; cin>>g>>n>>m; vector<vector<vector<ll>>> mut(g); vector<vector<pair<ll,vector<ll>>>> tran(g); for (ll i = 0; i < n; ++i) { ll x,y; cin>>x>>y; ll t = mut[x].size(); mut[x].push_back({}); for (ll j = 0; j < y; ++j) { ll u; cin>>u; mut[x][t].push_back(u); } for (ll j = 0; j < y; ++j) { tran[mut[x][t][j]].push_back({x,mut[x][t]}); } } vector<vector<ll>> anti(m); for (ll i = 0; i < m; ++i) { ll l; cin>>l; for (ll j = 0; j < l; ++j) { ll u; cin>>u; anti[i].push_back(u); } } if(m==0) { vector<ll> len(g,LONG_MAX); len[0]=1; len[1]=1; vector<bool> vis(g,false); while(true) { int cur = -1; for (int i = 0; i < g; ++i) { if(vis[i]) continue; if(cur==-1) cur=i; if(len[i]<len[cur])cur = i; } if(cur==-1) break; for(auto [a,b]:tran[cur]) { ll curlength= 0; for(ll u: b) { if(len[u]==LONG_MAX||curlength==LONG_MAX)curlength=LONG_MAX; else curlength+=len[u]; } len[a]=min(len[a],curlength); } vis[cur] = true; } for (long long i = 2; i < g; ++i) { if(len[i]==LONG_MAX) cout<<"YES"<<endl; else cout<<"NO " << len[i]<<endl; } } }

Compilation message (stderr)

Viruses.cpp: In function 'int main()':
Viruses.cpp:44:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   44 |             for(auto [a,b]:tran[cur]) {
      |                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...