Submission #72478

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

int dng[300005],bm[300005],ok[300005],vis[300005];
vector<int>edge[300005];
int N,M,K,E;
int main(){
    scanf("%d%d%d",&N,&M,&K);
    for(int i=0,x;i<M;i++){
        scanf("%d",&x);
        dng[x]=1;
        edge[x].push(x);
    }
    for(int i=0,x,y;i<K;i++){
        scanf("%d%d",&x,&y);
        edge[x].push_back(y);
        edge[y].push_back(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;
            for(auto j:edge[x])ok[j]=1;
            continue;
        }
        if(dng[x])continue;
        for(auto j:edge[x])bm[j]=1;
    }
    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:12:17: error: 'class std::vector<int>' has no member named 'push'
         edge[x].push(x);
                 ^~~~
chocolate.cpp:40: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:8: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:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
         ~~~~~^~~~~~~~~
chocolate.cpp:15: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:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&E);
     ~~~~~^~~~~~~~~
chocolate.cpp:24: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);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~