Submission #970938

#TimeUsernameProblemLanguageResultExecution timeMemory
970938kl0989eInside information (BOI21_servers)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pb push_back #define vi vector<int> #define pi pair<int, int> #define all(x) (x).begin(),(x).end() int main() { ios::sync_with_stdio(0); cin.tie(0); int n,k; cin >> n >> k; vector<unordered_set<int>> servers(n); vi count(n,1); for (int i=0; i<n; i++) { servers[i].insert(i); } char c; int a,b; for (int i=0; i<k+n-1; i++) { cin >> c; if (c=='S') {//S a b means servers 𝑎 and 𝑏 Share all their data. cin >> a >> b; a--; b--; if (servers[a].size()<servers[b].size()) { swap(a,b); } servers[a].merge(servers[b]); servers[b]=servers[a]; for (auto aa:servers[a]) { count[aa]++; } } else if (c=='Q') {//Q a d means you Query whether server 𝑎 currently stores data chunk 𝑑. cin >> a >> b; a--; b--; if (servers[a].contains(b)) { cout << "yes\n"; } else { cout << "no\n"; } } else {//C d means you query the Count (number) of servers that currently store data chunk 𝑑. cin >> a; a--; cout << count[a] << '\n'; } } return 0; }

Compilation message (stderr)

servers.cpp: In function 'int main()':
servers.cpp:43:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::unordered_set<int> >, std::unordered_set<int> >::value_type' {aka 'class std::unordered_set<int>'} has no member named 'contains'
   43 |             if (servers[a].contains(b)) {
      |                            ^~~~~~~~