【HDOJ5536】Chip Factory(Trie树)】的更多相关文章

/** 题目:hdu5536 Chip Factory 链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536 题意:给定n个数,令X=(a[i]+a[j])^a[k], i,j,k都不同.求最大的X. 思路:字典树,由于转化为二进制最大是32位.将所有数转化为二进制,不足32位补0. 然后逆序插入字典树(逆序是为了查询的时候,保证先找最大的位,这样结果才是最大的). 枚举i,j.从字典树删除i,j.然后在字典树找k.计算结果.然后把i,j的数重新插入…
Chip Factory Problem Description John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory produces n chips today, th…
Chip Factory Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5536 Description John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every proc…
给你n个数,a1....an,求(ai+aj)^ak最大的值,i不等于j不等于k 思路:先建字典树,暴力i,j每次删除他们,然后贪心找k,再恢复i,j,每次和答案取较大的,就是答案,有关异或的貌似很多都用字典树,也是醉了 /*Problem : 5536 ( Chip Factory ) Judge Status : Accepted RunId : 15506230 Language : G++ Author : qianbi08*/ #include<iostream> #include&…
Chip Factory Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1842    Accepted Submission(s): 833 Problem Description John is a manager of a CPU chip factory, the factory produces lots of chip…
题意: 给出\(n(3 \leq n \leq 1000)\)个数字,求\(max(s_i+s_j) \bigoplus s_k\),而且\(i,j,k\)互不相等. 分析: 把每个数字看成一个\(01\)字符串插入倒Trie树中去,枚举\(i\)和\(j\),然后把\(s_i\)和\(s_j\)从Trie树中删去. 然后在Trie树中贪心找到能与\(s_i+s_j\)异或得到的最大值. 具体匹配的过程中是这样的,首先看树中最高位能否异或得到\(1\). 能的话就往能的那个方向走,否则往另外一个…
题意:给定n个数字,第i个数字为a[i],求max((a[i]+a[j])^a[k]),其中i,j,k互不相同 n<=1000,0<=a[i]<=1e9 思路:队友写的,抱大腿 先对于a[i]建立Trie树 枚举i和j后删除Trie中的i和j,然后就是经典的Trie树应用:优先朝与a[i]+a[j]的当前位不同的方向走,能获得最大xor和 #include<bits/stdc++.h> using namespace std; #define LL long long ; ]…
Chip Factory http://acm.hdu.edu.cn/showproblem.php?pid=5536 Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 280    Accepted Submission(s): 158 Problem Description John is a manager of a CPU c…
Problem Description John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory produces n chips today, the i-th chip p…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536 题面; Chip Factory Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 6277    Accepted Submission(s): 2847 Problem Description John is a manager o…