Submission #1224638

#TimeUsernameProblemLanguageResultExecution timeMemory
1224638sokratisiInside information (BOI21_servers)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int n, q, a, b; char c; set<int> table[125000]; // table[{i, j}] does i have j int cq[125000]; int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; i++) table[i].insert(i); for (int i = 0; i < n + q - 1; i++) { scanf("%c", &c); scanf("%c", &c); if (c == 'S') { scanf("%d%d", &a, &b); for (auto u: table[a]) { table[b].insert(u); cq[u]++; } for (auto u: table[b]) { table[a].push_back(u); cq[u]++; } } if (c == 'Q') { scanf("%d%d", &a, &b); // does a have d if (table[a].find(b) != table[a].end()) printf("yes\n"); else printf("no\n"); } if (c == 'C') { scanf("%d", &a); printf("%d\n", cq[a] + 1); } } return 0; }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:22:26: error: 'class std::set<int>' has no member named 'push_back'
   22 |                 table[a].push_back(u);
      |                          ^~~~~~~~~
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, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%c", &c); scanf("%c", &c);
      |         ~~~~~^~~~~~~~~~
servers.cpp:14:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%c", &c); scanf("%c", &c);
      |                          ~~~~~^~~~~~~~~~
servers.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |             scanf("%d%d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |             scanf("%d%d", &a, &b); // does a have d
      |             ~~~~~^~~~~~~~~~~~~~~~
servers.cpp:32:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |             scanf("%d", &a);
      |             ~~~~~^~~~~~~~~~