Submission #72387

# Submission time Handle Problem Language Result Execution time Memory
72387 2018-08-26T07:36:49 Z 신딩없는 신딩팀(#2212, willi19, andy627, maruii) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
0 / 100
345 ms 8352 KB
#include <stdio.h>
#include <algorithm>
#define pii pair<int,int>
#define ff first
#define ss second
using namespace std;

int n,m,k,e;
char res[11];

int exp[333333];
pii cant[1111111];
pii rkd[333333];

bool ans[333333];

void subtask1(){

}

int deg[333333];
bool com[333333];

void subtask2(){
    int cnt=0;
    for(int i=1;i<=m;i++) ans[exp[i]]=1,cnt++;

    for(int i=1;i<=e;i++) com[rkd[i].ff]=1;
    for(int i=1;i<=k;i++){
        if(com[cant[i].ff]) deg[cant[i].ss]++;
        if(com[cant[i].ss]) deg[cant[i].ff]++;
    }
    for(int i=1;i<=n;i++){
        if(ans[i]) continue;
        if(deg[i]==e) ans[i]=1,cnt++;
    }

    printf("%d\n",cnt);
    for(int i=1;i<=n;i++){
        if(ans[i]) printf("%d ",i);
    }
}

int main(){
    bool sub2=1;

    scanf("%d %d %d",&n,&m,&k);
    for(int i=1;i<=m;i++) scanf("%d",&exp[i]);
    for(int i=1;i<=k;i++) scanf("%d %d",&cant[i].ff,&cant[i].ss);
    scanf("%d",&e);
    for(int i=1;i<=e;i++){
        int num;
        char a,b,c;
        scanf(" L + %d = %s",&num,res);

        if(res[0]=='O') rkd[i]={num,0},sub2=0;
        else rkd[i]={num,1};
    }

    if(sub2) subtask2();
    else subtask1();

    return 0;
}
/*
10 3 4
3 6 9
1 2
2 4
4 8
5 10
2
L + 10 = BOOM
L + 2 = BOOM

10 3 5
3 6 9
1 2
1 10
2 4
4 8
4 10
2
L + 10 = BOOM
L + 2 = BOOM
*/

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:53:14: warning: unused variable 'a' [-Wunused-variable]
         char a,b,c;
              ^
chocolate.cpp:53:16: warning: unused variable 'b' [-Wunused-variable]
         char a,b,c;
                ^
chocolate.cpp:53:18: warning: unused variable 'c' [-Wunused-variable]
         char a,b,c;
                  ^
chocolate.cpp:47: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:48:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=m;i++) scanf("%d",&exp[i]);
                           ~~~~~^~~~~~~~~~~~~~
chocolate.cpp:49:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=k;i++) scanf("%d %d",&cant[i].ff,&cant[i].ss);
                           ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chocolate.cpp:50:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&e);
     ~~~~~^~~~~~~~~
chocolate.cpp:54:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" L + %d = %s",&num,res);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 345 ms 8352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -