# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72405 | cat > /dev/null (#118) | Chocolate Cookie Machine (FXCUP3_chocolate) | C++17 | 1894 ms | 41200 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <set>
#include <vector>
#define N 300010
using namespace std;
int n, m, k, e;
bool danger[N];
vector<int> shakeItBoomBoom[N];
set<int> rocadium;
int main()
{
scanf("%d %d %d", &n, &m, &k);
while(m--)
{
int v;
scanf("%d", &v);
danger[v] = true;
}
while(k--)
{
int a, b;
scanf("%d %d", &a, &b);
shakeItBoomBoom[a].push_back(b);
shakeItBoomBoom[b].push_back(a);
}
for(int i=1; i<=n; ++i)
rocadium.insert(i);
bool ok = false;
scanf("%d", &e);
while(e--)
{
int v;
char c;
scanf(" L + %d = %c%*s", &v, &c);
if(c == 'O')
{
ok = true;
for(int to : shakeItBoomBoom[v])
rocadium.erase(to);
}
else if(!danger[v])
{
set<int> list;
for(int to : shakeItBoomBoom[v])
if(rocadium.find(to) != rocadium.end())
list.insert(to);
rocadium.clear();
for(int to : list)
rocadium.insert(to);
}
}
if(ok)
{
for(int i=1; i<=n; ++i)
if(danger[i])
rocadium.erase(i);
}
else
{
for(int i=1; i<=n; ++i)
if(danger[i])
rocadium.insert(i);
}
printf("%d\n", (int)rocadium.size());
for(int v : rocadium)
printf("%d ", v);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |