# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1102062 |
2024-10-17T11:26:14 Z |
razivo |
Viruses (BOI20_viruses) |
C++14 |
|
1 ms |
560 KB |
#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
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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
560 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
560 KB |
Output is correct |
3 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
560 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
560 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |