#include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 10003,null=0xf3f3f3; int h[N]; int find(int x) { int k = (x % N + N) % N; while (h[k] != null&&h[k]!=x) { k++; if (k == N)k = 0; } } int main() { memset(h, null, sizeof(h)); int n,x; string a; cin >> n; while (n--) { cin >> a >> x; if (a == "I") { h[find(x)]; } else { if (find(x)!=null) { cout << "Yes"; } else cout << "No"; } } return 0; }
算法.开放寻址法
最新推荐文章于 2024-09-12 19:02:20 发布