Submission #72389

# Submission time Handle Problem Language Result Execution time Memory
72389 2018-08-26T07:38:32 Z cat > /dev/null(#2231, lobo_prix, jms100300, enochjung) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
28 / 100
584 ms 19364 KB
#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);
     
    printf("%d\n", (int)rocadium.size());
    for(int v : rocadium)
        printf("%d ", v);
    
    return 0;
}

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &n, &m, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
chocolate.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &v);
         ~~~~~^~~~~~~~~~
chocolate.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~
chocolate.cpp:35:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &e);
     ~~~~~^~~~~~~~~~
chocolate.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" L + %d = %c%*s", &v, &c);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 7416 KB Output is correct
2 Correct 8 ms 7516 KB Output is correct
3 Correct 12 ms 7580 KB Output is correct
4 Correct 101 ms 12036 KB Output is correct
5 Correct 11 ms 12036 KB Output is correct
6 Correct 8 ms 12036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 584 ms 19364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 7416 KB Output is correct
2 Correct 8 ms 7516 KB Output is correct
3 Correct 12 ms 7580 KB Output is correct
4 Correct 101 ms 12036 KB Output is correct
5 Correct 11 ms 12036 KB Output is correct
6 Correct 8 ms 12036 KB Output is correct
7 Incorrect 584 ms 19364 KB Output isn't correct
8 Halted 0 ms 0 KB -