Submission #72443

#TimeUsernameProblemLanguageResultExecution timeMemory
72443이시대의진정한망겜스타투 (#118)Chocolate Cookie Machine (FXCUP3_chocolate)C++17
100 / 100
1233 ms30272 KiB
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_map> #include <unordered_set> #include <list> #include <bitset> using namespace std; typedef long long ll; #define Fi first #define Se second #define pb(x) push_back(x) #define szz(x) ((int)(x).size()) #define rep(i, n) for(int i=0;i<n;i++) #define all(x) (x).begin(), (x).end() typedef tuple<int, int, int> t3; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef long double ldouble; int N, M, K; int dang[300030]; vector <int> E[300030]; vector <int> X[2]; int cnt[300030]; int main() { scanf("%d%d%d", &N, &M, &K); for(int i=1;i<=M;i++) { int x; scanf("%d", &x); dang[x] = 1; } for(int i=1;i<=K;i++) { int x, y; scanf("%d%d", &x, &y); if(dang[x] || dang[y]) continue; E[x].pb(y); E[y].pb(x); } int only_boom = 1; int Q; scanf("%d", &Q); for(int i=1;i<=Q;i++) { int x; char buf[10]; scanf(" L + %d = %s", &x, buf); if(buf[0] != 'B') only_boom = 0; if(buf[0] == 'B') { if(dang[x] == 0) X[0].pb(x); } else X[1].pb(x); } int gb = 0; for(int e : X[0]) for(int f : E[e]) cnt[f]++; for(int e : X[1]) { gb++; for(int f : E[e]) cnt[f]--; } for(int i=1;i<=N;i++) cnt[i] += gb; vector <int> v; for(int i=1;i<=N;i++) if(!dang[i] && cnt[i] == szz(X[0]) + szz(X[1])) v.pb(i); if(only_boom) for(int i=1;i<=N;i++) if(dang[i]) v.pb(i); printf("%d\n", szz(v)); sort(all(v)); for(int e : v) printf("%d ", e); puts(""); return 0; }

Compilation message (stderr)

chocolate.cpp: In function 'int main()':
chocolate.cpp:74:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int e : v) printf("%d ", e); puts("");
  ^~~
chocolate.cpp:74:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for(int e : v) printf("%d ", e); puts("");
                                   ^~~~
chocolate.cpp:39: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:41:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x; scanf("%d", &x);
          ~~~~~^~~~~~~~~~
chocolate.cpp:45:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x, y; scanf("%d%d", &x, &y);
             ~~~~~^~~~~~~~~~~~~~~~
chocolate.cpp:51:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int Q; scanf("%d", &Q);
         ~~~~~^~~~~~~~~~
chocolate.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" L + %d = %s", &x, buf);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...