Submission #72336

#TimeUsernameProblemLanguageResultExecution timeMemory
72336유애나 (#118)Chocolate Cookie Machine (FXCUP3_chocolate)C++17
100 / 100
1343 ms29328 KiB
#include <bits/stdc++.h> using namespace std; const int N = 300005; int n, k, m, dan[N], lnk[N], ulnk[N], q, lc, ulc; vector<int> e[N], r; int main(){ scanf("%d%d%d", &n, &k, &m); for(int x; k--; ){ scanf("%d", &x); dan[x] = 1; } for(int x, y; m--; ){ scanf("%d%d", &x, &y); if(dan[x] || dan[y]) continue; e[x].push_back(y); e[y].push_back(x); } scanf("%d ", &q); for(int x; q--; ){ char buf[10]; scanf("%*s%*s%d%*s%s", &x, buf); if(buf[0] == 'B'){ if(dan[x]) continue; for(int i : e[x]) lnk[i]++; lc++; } else{ for(int i : e[x]) ulnk[i]++; ulc++; } } for(int i = 1; i <= n; i++){ if(ulc && (!dan[i] && lnk[i] == lc && !ulnk[i])) r.push_back(i); if(!ulc && (dan[i] || lnk[i] == lc)) r.push_back(i); } printf("%d\n", r.size()); for(int i : r) printf("%d ", i); puts(""); return 0; }

Compilation message (stderr)

chocolate.cpp: In function 'int main()':
chocolate.cpp:39:28: 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", r.size());
                    ~~~~~~~~^
chocolate.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &k, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
chocolate.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x);
         ~~~~~^~~~~~~~~~
chocolate.cpp:16: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:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d ", &q);
     ~~~~~^~~~~~~~~~~
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", &x, buf);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...