Submission #1224356

#TimeUsernameProblemLanguageResultExecution timeMemory
1224356JerInside information (BOI21_servers)C++20
5 / 100
1539 ms377116 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 4005; int n, k; set<int> d[MAXN]; int cnt[MAXN]; int main(){ scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) d[i].insert(i), cnt[i] = 1; char t; int a, b, c; for (int z = 0; z < n + k - 1; z++) { scanf(" %c", &t); if (t == 'S') { scanf("%d%d", &a, &b); for (auto i : d[a]) if (d[b].find(i) == d[b].end()) d[b].insert(i), cnt[i]++; for (auto i : d[b]) if (d[a].find(i) == d[a].end()) d[a].insert(i), cnt[i]++; } if (t == 'Q') { scanf("%d%d", &a, &b); printf("%s\n", (d[a].find(b) != d[a].end()) ? "yes" : "no"); } if (t == 'C') { scanf("%d", &c); printf("%d\n", cnt[c]); } } return 0; }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf(" %c", &t);
      |         ~~~~~^~~~~~~~~~~
servers.cpp:25:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:37:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:43:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |             scanf("%d", &c);
      |             ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...