In recent years, more and more museums in China have been opened to the public for free. The number of museums exhibitions and visitors have increased significantly. Queuing up in front of some popular museums is very common, and these museums must take measures to restrict the number of visitors. Today, the form of exhibitions is becoming more diverse. Some large museums use advanced technologies such as multimedia and virtual reality, to make exhibitions more attractive. Many museums also hold online exhibitions where people can view rare exhibits on the Internet. However, the experience of viewing exhibits on site is still more attractive to most visitors.
Closest-Pair(p1, …, pn) { //O(n log n) Compute separation line L such that half the points are on one side and half on the other side. //2T(n / 2) δ1= Closest-Pair(left half) δ2= Closest-Pair(right half) δ= min(δ1, δ2) //O(n) Delete all points further than δ from separation line L //O(n log n) 改进时,通过预处理去掉这一步排序 Sort remaining points by y-coordinate. //O(n) Scan points in y-order and compare distance between each point and next 7 neighbors. If any of these distances is less than δ, update δ. return δ. }
Closest-Pair-Rec(Px,Py) { If |P|<=3 then 进行简单穷举排序 //在这里按y坐标将点排序,方便下面直接对窄带内的点归并排序 End if 构造Qx,Qy,Rx,Ry(O(n)时间) (q0*,q1*)=Closest-Pair-Rec(Qx,Qy) (r0*,r1*)=Closest-Pair-Rec(Rx,Ry) Delta=min(d(qo*,q1*),(r0*,r1*)) x*=集合Q中的点的大的x坐标 L={(x,y):x=x*} S=P中与L相距在Delta之内的点集
structEdge { int to, w; booloperator<(const Edge &other) const { return w > other.w; } };
vector<Edge> v[N]; bool vis[N];
intPrime(){ priority_queue<Edge> q; int cnt = 0, x, ans = 0; for (int i = 0; i < v[1].size(); ++i)q.push(v[1][i]); vis[1] = 1; while (cnt < n - 1) { Edge e = q.top();//排序每次需要logn的时间 q.pop(); x = e.to; if (!vis[x]) {//最多走m条边 vis[x] = 1; ans += e.w, cnt++; for (int i = 0; i < v[x].size(); ++i)q.push(v[x][i]); } } return ans; }
intmain(){ cin >> n >> m; for (int i = 0; i < m; ++i) { int x, y, w; cin >> x >> y >> w; v[x].push_back(Edge{y, w}); v[y].push_back(Edge{x, w}); } cout << Prime() << endl; return0; }
China is paying more and more attention to public libraries, and people are encouraged to make full use of them. The newly published statistics show that the number of public libraries in China is increasing year by year. Many libraries have created a quieter and more comfortable environment for readers through refurbishment and expansion. Large public libraries not only provide a wide variety of reference materials, but also regularly hold activities such as lectures, exhibitions and so on. In recent years, there have been many digital libraries which can save the space to store books. Some libraries have also introduced self-services systems, making it more convenient for readers to borrow and return books, which further meets the needs of readers.
notes
refurbishment [ˌriːˈfɜːrbɪʃmənt] n. 翻新;整修 The office looks so much better following its refurbishment.办公室翻新后看上去好多了。
Question2: If we convert the E/R diagram to relations in the standard way, which set of attributes would not appear in the schema of some relation?(图同Q1)
Dijkstra算法(G,l) 设S是被探查的结点集合 对每个S中的u,存储一个d(u); 初始S={s}且d(s)=0 While S!=V 选择一个结点不在S中的结点v,使得从S到v至少有一条边连接并且 d'(v)=min_{e=(u,v), u in S}d(u)+le 最小 将v加入S并且定义d(v)=d'(v) Endwhile
Initialize each person to be free. while(some man is freeand hasn't proposed to every woman) { Choose such a man m w = 1st woman on m's list to whom m has not yet proposed if (w is free) assign m and w to be engaged elseif (w prefers m to m') assign m and w to be engaged, and m' to be freeelse w rejects m }
Taihu Lake, a freshwater lake in eastern China, with an area of 2250 square kilometers, is the third largest freshwater lake in China, second to Poyang and Dongting Lake. Taihu Lake encompasses about 90 islands, ranging in size from several square meters to several square kilometers. Taihu Lake is famous for its unique “Taihu Stone”, which is often used to decorate traditional Chinese gardens. Taihu Lake is also well-known for its high-yield fishing industry. Fishing for fish and crabs since the late 1970s has been of great importance to inhabitants there and made great contribution to the economy of the surrounding areas. Taihu Lake region is also a base for China’s ceramic industry, where manufacturers in Yixing produce the world-famous Yixing clay teapot.