Submission #72405

#TimeUsernameProblemLanguageResultExecution timeMemory
72405cat > /dev/null (#118)Chocolate Cookie Machine (FXCUP3_chocolate)C++17
100 / 100
1894 ms41200 KiB
#include <cstdio> #include <set> #include <vector> #define N 300010 using namespace std; int n, m, k, e; bool danger[N]; vector<int> shakeItBoomBoom[N]; set<int> rocadium; int main() { scanf("%d %d %d", &n, &m, &k); while(m--) { int v; scanf("%d", &v); danger[v] = true; } while(k--) { int a, b; scanf("%d %d", &a, &b); shakeItBoomBoom[a].push_back(b); shakeItBoomBoom[b].push_back(a); } for(int i=1; i<=n; ++i) rocadium.insert(i); bool ok = false; scanf("%d", &e); while(e--) { int v; char c; scanf(" L + %d = %c%*s", &v, &c); if(c == 'O') { ok = true; for(int to : shakeItBoomBoom[v]) rocadium.erase(to); } else if(!danger[v]) { set<int> list; for(int to : shakeItBoomBoom[v]) if(rocadium.find(to) != rocadium.end()) list.insert(to); rocadium.clear(); for(int to : list) rocadium.insert(to); } } if(ok) { for(int i=1; i<=n; ++i) if(danger[i]) rocadium.erase(i); } else { for(int i=1; i<=n; ++i) if(danger[i]) rocadium.insert(i); } printf("%d\n", (int)rocadium.size()); for(int v : rocadium) printf("%d ", v); return 0; }

Compilation message (stderr)

chocolate.cpp: In function 'int main()':
chocolate.cpp:16: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:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &v);
         ~~~~~^~~~~~~~~~
chocolate.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~
chocolate.cpp:35:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &e);
     ~~~~~^~~~~~~~~~
chocolate.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" L + %d = %c%*s", &v, &c);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...