# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145116 | 2019-08-18T19:48:26 Z | Radugnn | Alkemija (COCI18_alkemija) | C++14 | 49 ms | 9208 KB |
#include <iostream> #include <deque> #include <vector> using namespace std; struct reactie{ int L; int R; int nec; vector<int> REZ; }e[10010]; deque<int> q; vector<int> Lista[100010]; int N,M,x,C[100010],viz[100010],K,i,j,ec,sol,react,el; int main(){ cin>>N>>M; for(i=1;i<=M;i++){ cin>>x; C[x]=1; } cin>>K; for(i=1;i<=K;i++){ cin>>e[i].L>>e[i].R; e[i].nec=e[i].L; for (j=1;j<=e[i].L;j++) { cin>>x; Lista[x].push_back(i); if (C[x]) { e[i].nec--; if (e[i].nec==0) { q.push_back(i); viz[i] = 1; } } } for (j=1;j<=e[i].R;j++) { cin>>x; e[i].REZ.push_back(x); } } while (!q.empty()) { el=q.front(); q.pop_front(); for (i=0;i<e[el].REZ.size();i++) { ec = e[el].REZ[i]; if (C[ec]==0) { C[ec]=1; for (j=0;j<Lista[ec].size();j++) { react=Lista[ec][j]; if (viz[react]==0) { e[react].nec--; if (e[react].nec==0) { q.push_back(react); viz[react]=1; } } } } } } for (i=1;i<=N;i++) if (C[i]) sol++; cout<<sol<<"\n"; for (i=1;i<=N;i++) if (C[i]) cout<<i<<" "; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 43 ms | 8312 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 46 ms | 8696 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 38 ms | 8184 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 49 ms | 9208 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |