#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef long long ll;
const int inf=2e9, MX=300010;
vector<int> G[MX];
int n, m, k, cnt[MX], e, f;
bool boom[MX];
pib in(){
int v; char c; string S;
cin>>c>>c>>v>>c>>S;
return {v, S=="BOOM"};
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n>>m>>k;
for(int i=1,x ; i<=m; i++) cin>>x, boom[x]=true;
for(int i=1; i<=k; i++){
int u,v; cin>>u>>v;
G[u].push_back(v);
G[v].push_back(u);
}
cin>>e;
for(int i=1; i<=e; i++){
int v; bool b; tie(v,b)=in();
if(boom[v]){ f++; continue; }
if(b) for(int x:G[v]) cnt[x]++;
else assert(false);
}
vector<int> ans;
for(int i=1; i<=n; i++){
if(boom[i] || cnt[i]==e-f) ans.push_back(i);
}
cout<<ans.size()<<'\n';
for(int x:ans) cout<<x<<' ';
cout<<'\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
15 ms |
14584 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
517 ms |
26516 KB |
Output is correct |
2 |
Correct |
91 ms |
26516 KB |
Output is correct |
3 |
Correct |
319 ms |
26516 KB |
Output is correct |
4 |
Correct |
815 ms |
31408 KB |
Output is correct |
5 |
Correct |
368 ms |
31408 KB |
Output is correct |
6 |
Correct |
61 ms |
31408 KB |
Output is correct |
7 |
Correct |
931 ms |
33296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
15 ms |
14584 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |