Submission #832326

#TimeUsernameProblemLanguageResultExecution timeMemory
832326radaiosm7Inside information (BOI21_servers)C++98
0 / 100
26 ms980 KiB
#include <bits/stdc++.h> using namespace std; #define X first #define Y second int n, k, i, a, b; char quer; int par[120005]; bitset<120001> bts[120005]; int main() { scanf("%d%d", &n, &k); for (i=1; i <= n; ++i) { bts[i].set(i); par[i] = i; } for (i=1; i <= n+k-1; ++i) { scanf("\n%c", &quer); if (quer == 'S') { scanf("%d%d", &a, &b); if (bts[par[a]].count() < bts[par[b]].count()) swap(a, b); bts[par[a]] = bts[par[a]]|bts[par[b]]; par[b] = par[a]; } else if (quer == 'Q') { scanf("%d%d", &a, &b); if (bts[par[a]][b]) printf("yes\n"); else printf("no\n"); } else { scanf("%d", &a); printf("0\n"); } } }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:11:8: 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:19:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("\n%c", &quer);
      |     ~~~~~^~~~~~~~~~~~~~~
servers.cpp:22:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |       scanf("%d%d", &a, &b);
      |       ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:29:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |       scanf("%d%d", &a, &b);
      |       ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:35:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |       scanf("%d", &a);
      |       ~~~~~^~~~~~~~~~
#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...