Submission #72405

# Submission time Handle Problem Language Result Execution time Memory
72405 2018-08-26T07:46:56 Z cat > /dev/null(#2231, lobo_prix, jms100300, enochjung) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
100 / 100
1894 ms 41200 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);
    }
    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

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 7 ms 7528 KB Output is correct
3 Correct 12 ms 7612 KB Output is correct
4 Correct 88 ms 11760 KB Output is correct
5 Correct 9 ms 11760 KB Output is correct
6 Correct 9 ms 11760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 539 ms 19380 KB Output is correct
2 Correct 124 ms 19380 KB Output is correct
3 Correct 450 ms 26536 KB Output is correct
4 Correct 967 ms 38088 KB Output is correct
5 Correct 561 ms 38088 KB Output is correct
6 Correct 179 ms 38088 KB Output is correct
7 Correct 1102 ms 39680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 7416 KB Output is correct
2 Correct 7 ms 7528 KB Output is correct
3 Correct 12 ms 7612 KB Output is correct
4 Correct 88 ms 11760 KB Output is correct
5 Correct 9 ms 11760 KB Output is correct
6 Correct 9 ms 11760 KB Output is correct
7 Correct 539 ms 19380 KB Output is correct
8 Correct 124 ms 19380 KB Output is correct
9 Correct 450 ms 26536 KB Output is correct
10 Correct 967 ms 38088 KB Output is correct
11 Correct 561 ms 38088 KB Output is correct
12 Correct 179 ms 38088 KB Output is correct
13 Correct 1102 ms 39680 KB Output is correct
14 Correct 25 ms 39680 KB Output is correct
15 Correct 43 ms 39680 KB Output is correct
16 Correct 859 ms 39680 KB Output is correct
17 Correct 427 ms 39680 KB Output is correct
18 Correct 1109 ms 41200 KB Output is correct
19 Correct 1849 ms 41200 KB Output is correct
20 Correct 1151 ms 41200 KB Output is correct
21 Correct 1894 ms 41200 KB Output is correct
22 Correct 1424 ms 41200 KB Output is correct
23 Correct 1214 ms 41200 KB Output is correct