题目:单点修改、树链查询。可以直接用树链剖分做。。修改是O(QlogN),查询是O(QlogNlogN),Q=N=500000;听说会超时。。这题也可以用DFS序来做。先不看修改,单单查询:可以求出每个点到根的xor值,那么对任意两点的查询就等于xor(u)^xor(v)^val(lca(u,v))...
分类:
其他好文 时间:
2015-10-17 10:38:03
阅读次数:
208
刚注册了leetcode,推荐的第一题就是Nim Game。You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you ta...
分类:
其他好文 时间:
2015-10-16 15:19:53
阅读次数:
173
Description:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove...
分类:
其他好文 时间:
2015-10-14 11:48:35
阅读次数:
159
Haha, an interesting problem. Just try to let your opponent start with a nunber that is an integer multiple of 4.1 class Solution {2 public:3 bool...
分类:
其他好文 时间:
2015-10-13 18:31:27
阅读次数:
161
Nim GameYou are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 t...
分类:
编程语言 时间:
2015-10-13 16:38:19
阅读次数:
163
Same as LintCode 'Coins in a line'. Here is mind-flow: 4 is a definite lose, for (4 + 1), (4 + 2), (4 + 3), we can put the other player into slot 4 - ...
分类:
其他好文 时间:
2015-10-13 07:01:07
阅读次数:
165
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston...
分类:
其他好文 时间:
2015-10-13 06:58:28
阅读次数:
256
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston...
分类:
其他好文 时间:
2015-10-13 00:16:05
阅读次数:
184
联想笔记本 inter i7,2.4GHz,16G,win10 C语言(应该是全C,vs2015编译) #include<stdio.h>
#include<stdlib.h>
#include<time.h>
bool?ishuiwen(int?n)?{
????int?sn?=?0;
????sn?=?n;
???...
分类:
其他好文 时间:
2015-09-25 04:12:23
阅读次数:
296
Clarke and puzzleTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 673Accepted Submission(s): 223Pro...
分类:
编程语言 时间:
2015-09-23 19:25:48
阅读次数:
207