Submission #1224339

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

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%c", &t);
      |         ~~~~~^~~~~~~~~~
servers.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:31:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |             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", &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...