제출 #72387

#제출 시각아이디문제언어결과실행 시간메모리
72387신딩없는 신딩팀 (#118)초코쿠키 기계 (FXCUP3_chocolate)C++17
0 / 100
345 ms8352 KiB
#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
*/

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...