Description You are not given n non-negative integersX0,X1,..., Xn-1 less than220, but they do exist, and their values never change. I'll gradually provide you some facts about them, and ask you some questions. There are two kinds of facts, plus one…
题意:给你n个数,接着三种操作: I p v :告诉你 Xp = v I p q v :告诉你 Xp ^ Xq = v Q k p1 p2 … pk:问你k个数连续异或的结果 注意前两类操作可能会出现与之前告诉你的相矛盾,此时输出“The first n(第几个I) facts are conflicting.”接着一直保持沉默,否则不输出.最后一类询问可能得不到值,就输出“I don’t know.”,否则输出结果 题解:告诉你时使用并查集的合并操作,可以记录权值为此点异或父亲节点的值,祖先节…
G - A Bug's Life Time Limit:10000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2492 Appoint description: Description BackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. H…
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others. In the Not-Sprea…
//思路详见课本 P 214 页 思路:直接用并查集,set [ k ] 存 k 的朋友所在集合的代表元素,set [ k + n ] 存 k 的敌人 所在集合的代表元素. #include<iostream> #include<cstring> using namespace std; const int maxn=2 *10000 +100; int set[maxn]; int n; int set_find(int d) { if(set[d]<0) return…
Almost Union-Find I hope you know the beautiful Union-Find structure. In this problem, you're to implement something similar, but not identical. The data structure you need to write is also a collection of disjoint sets, supporting 3 operations: 1 p…