Submission #72465

# Submission time Handle Problem Language Result Execution time Memory
72465 2018-08-26T08:21:23 Z 신딩없는 신딩팀(#2212, willi19, andy627, maruii) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
0 / 100
499 ms 19532 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;
    }
    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:39: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:14: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:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&E);
     ~~~~~^~~~~~~~~
chocolate.cpp:23: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 9 ms 7288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 499 ms 19532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 7288 KB Output isn't correct
2 Halted 0 ms 0 KB -