Submission #72552

# Submission time Handle Problem Language Result Execution time Memory
72552 2018-08-26T08:58:54 Z 신딩없는 신딩팀(#2212, willi19, andy627, maruii) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
0 / 100
3000 ms 107628 KB
#include<bits/stdc++.h>
using namespace std;

int dng[300005],bm[300005],ok[300005],vis[300005];
set<int>edge[300005];
set<int> sb,so;
int N,M,K,E;
int main(){
    scanf("%d%d%d",&N,&M,&K);
    for(int i=1;i<=N;i++){
        sb.insert(i);
        so.insert(i);
    }
    for(int i=0,x;i<M;i++){
        scanf("%d",&x);
        dng[x]=1;
        edge[x].insert(x);
    }
    for(int i=0,x,y;i<K;i++){
        scanf("%d%d",&x,&y);
        edge[x].insert(y);
        edge[y].insert(x);
    }
    scanf("%d",&E);
    int flag=1;
    for(int i=0;i<E;i++){
        char z[10];
        int x;
        scanf("%s %s %d %s %s",z,z,&x,z,z);
        if(vis[x])continue;
        vis[x]=1;

        string str=z;
        if(str=="OK"){
            flag=0;
            vector<int>vec;
            for(auto j=so.begin();j!=so.end();j++){
                if(*edge[x].lower_bound(*j)!=*j)continue;
                ok[*j]=1;
                vec.push_back(*j);
            }
            for(auto j:vec)so.erase(j);
            continue;
        }
        if(dng[x])continue;
        vector<int>vec;
       for(auto j=so.begin();j!=so.end();j++){
            if(*edge[x].lower_bound(*j)!=*j)continue;
            bm[*j]=1;
            vec.push_back(*j);
        }
        for(auto j:vec)sb.erase(j);
    }
    vector<int>ans;
    for(int i=1;i<=N;i++){
        if((flag and dng[i]) or (bm[i] and !ok[i]))ans.push_back(i);
    }
    printf("%d\n",ans.size());
    for(auto i:ans)printf("%d ",i);
    return 0;
}

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:58:29: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n",ans.size());
                   ~~~~~~~~~~^
chocolate.cpp:9: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:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
         ~~~~~^~~~~~~~~
chocolate.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x,&y);
         ~~~~~^~~~~~~~~~~~~~
chocolate.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&E);
     ~~~~~^~~~~~~~~
chocolate.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s %s %d %s %s",z,z,&x,z,z);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 14456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3082 ms 107628 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 14456 KB Output isn't correct
2 Halted 0 ms 0 KB -