Rastas's has been given a number n. Being weak at mathematics, she has to consider all the numbers from 1 to 2n?-?1 so as to become perfect in calcula ...
分类:
其他好文 时间:
2018-04-30 18:03:10
阅读次数:
201
题意; 一棵N个节点的树,有点权。M次询问,每次询问点(u,v)路径上有多少个权值不同的点。 题解: 树上开莫队,分块方法可以参照BZOJ1086题的方式。按照询问点(u,v)所在块将询问进行排序。更新路径时用vis数组标记路径上的点是否访问过。 #include <bits/stdc++.h> u ...
分类:
其他好文 时间:
2018-04-29 22:13:06
阅读次数:
189
Shadowman loves to collect box but his roommates woogieman and itman don't like box and so shadowman wants to hide boxes as many as possible. A box ca ...
分类:
其他好文 时间:
2018-04-29 20:32:24
阅读次数:
167
Problem statement: A string is said to be “PATHETIC” if all the characters in it are repeated the same number of times. You are given a string of leng ...
分类:
其他好文 时间:
2018-04-29 15:26:55
阅读次数:
190
http://www.spoj.com/problems/DYNALCA/ 此题link、cut要求不能换根,当然也保证link时其中一个点必定已经是根。 方法: 曾经的错误思路: void cut(Node *x) { access(x->fa);x->fa=NULL; } 因为此时x->fa不一 ...
分类:
其他好文 时间:
2018-04-28 23:43:07
阅读次数:
309
You are given N(1<=N<=100000) integers. Each integer is square free(meaning it has no divisor which is a square number except 1) and all the prime fac ...
分类:
其他好文 时间:
2018-04-28 13:57:58
阅读次数:
149
题目链接:https://vjudge.net/problem/SPOJ-PGCD 题目大意: 给定 \(N\) 和 \(M\),求满足 \((1 \le x \le N), (1 \le y \le M)\),且 \(gcd(x,y)\) 为素数的 \((x,y)\) 的对数。 知识点: 莫比乌斯 ...
分类:
其他好文 时间:
2018-04-27 02:12:51
阅读次数:
187
Given an array having N elements, each element is either -1 or 1. You have M queries, each query has two numbers L and R, you have to answer the lengt ...
分类:
其他好文 时间:
2018-04-26 15:33:23
阅读次数:
190
You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned t ...
分类:
其他好文 时间:
2018-04-24 23:15:55
阅读次数:
225
Waca loves maths,.. a lot. He always think that 1 is an unique number. After playing in hours, Waca suddenly realize that every integer can be represe ...
分类:
其他好文 时间:
2018-04-24 21:51:07
阅读次数:
189