Submission #68934

#TimeUsernameProblemLanguageResultExecution timeMemory
68934imsifileChocolate Cookie Machine (FXCUP3_chocolate)C++98
100 / 100
1280 ms29472 KiB
#include<stdio.h> #include<vector> using namespace std; int N, M, K, E, chk[301010], cnt[301010], rval, isok; vector<int> con[301010], dap; int main(){ scanf("%d%d%d", &N, &M, &K); for(int i=0; i<M; i++){ int a; scanf("%d", &a); chk[a]=1; } for(int i=0; i<K; i++){ int a, b; scanf("%d%d", &a, &b); if(chk[a] || chk[b]) continue; con[a].push_back(b), con[b].push_back(a); } for(scanf("%d", &E); E--;){ int a; char st[6]; scanf("\nL + %d = %s", &a, &st); if(chk[a]) continue; if(st[0]=='O'){ isok = 1; for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]--; } else{ rval++; for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]++; } } for(int i=1; i<=N; i++){ if(chk[i]){ if(!isok) dap.push_back(i); continue; } if(cnt[i] == rval) dap.push_back(i); } printf("%d\n", dap.size()); for(int i=0; i<dap.size(); i++){ printf("%d", dap[i]); if(i < dap.size()-1) printf(" "); else printf("\n"); } return 0; }

Compilation message (stderr)

chocolate.cpp: In function 'int main()':
chocolate.cpp:21:33: warning: format '%s' expects argument of type 'char*', but argument 3 has type 'char (*)[6]' [-Wformat=]
   scanf("\nL + %d = %s", &a, &st);
                              ~~~^
chocolate.cpp:25:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]--;
                 ~^~~~~~~~~~~~~~
chocolate.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]++;
                 ~^~~~~~~~~~~~~~
chocolate.cpp:39:27: 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", dap.size());
                 ~~~~~~~~~~^
chocolate.cpp:40:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<dap.size(); i++){
               ~^~~~~~~~~~~
chocolate.cpp:42:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i < dap.size()-1) printf(" ");
      ~~^~~~~~~~~~~~~~
chocolate.cpp:9:7: 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:11:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a; scanf("%d", &a);
          ~~~~~^~~~~~~~~~
chocolate.cpp:15:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d%d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~
chocolate.cpp:19:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(scanf("%d", &E); E--;){
      ~~~~~^~~~~~~~~~
chocolate.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("\nL + %d = %s", &a, &st);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...