码迷,mamicode.com
首页 >  
搜索关键字:spoj    ( 889个结果
SPOJ COWPIC(逆序对变形题)
SPOJ COWPIC 题目链接 题意:一个序列,相邻能够交换。问最少交换几次使得变成循环的1-n的当中一种 思路:对于原来正常的变换成1-n而言,答案就是逆序对了,而多了这么一个变形,事实上仅仅须要考虑一下。先求出变换成1-n的逆序对,然后假设原序列变成2, 3, 4 ... n, 1的话。等于是 ...
分类:其他好文   时间:2017-06-07 20:49:43    阅读次数:136
【bzoj1803】Spoj1487 Query on a tree III DFS序+主席树
题目描述 You are given a node-labeled rooted tree with n nodes. Define the query (x, k): Find the node whose label is k-th largest in the subtree of the n ...
分类:其他好文   时间:2017-06-03 21:46:27    阅读次数:186
SPOJ Prime or Not - 快速乘 - 快速幂
Given the number, you are to answer the question: "Is it prime?"Solutions to this problem can be submitted in C, C++, Pascal, Perl, Python, Ruby, Lisp ...
分类:其他好文   时间:2017-06-03 17:19:39    阅读次数:275
杜教筛进阶+洲阁筛讲解+SPOJ divcnt3
Part 1:杜教筛进阶在了解了杜教筛基本应用,如$\sum_{i=1}^n\varphi(i)$的求法后,我们看一些杜教筛较难的应用。求$\sum_{i=1}^n\varphi(i)*i$考虑把它与$id$函数狄利克雷卷积后的前缀和。$$\sum_{i=1}^n\sum_{d|i}\varphi( ...
分类:其他好文   时间:2017-05-30 21:52:24    阅读次数:508
[spoj 375]QTREE - Query on a tree[树链剖分]
You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. We will ask you to perfrom some instructi ...
分类:其他好文   时间:2017-05-26 00:52:13    阅读次数:269
[SPOJ VLATTICE]Visible Lattice Points 数论 莫比乌斯反演
7001. Visible Lattice Points Problem code: VLATTICE Consider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many la ...
分类:其他好文   时间:2017-05-23 14:26:33    阅读次数:179
SPOJ QTREE6 lct
题目链接 岛娘出的题。还是比較easy的 #include <iostream> #include <fstream> #include <string> #include <time.h> #include <vector> #include <map> #include <queue> #inc ...
分类:其他好文   时间:2017-05-21 19:50:47    阅读次数:201
SPOJ SUMPRO(数学)
题意: 给出一个数N,问所有满足n/x=y(此处为整除)的所有x*y的总和是多少。对答案mod(1e9+7)。 1 <= T <= 500。 1 <= N <= 1e9。 分析: 可以枚举x得到y,但是这样是O(n)的会TLE 当x<=sqrt(n)的时候,我们可以暴力枚举 当x>sqrt(n)的时 ...
分类:其他好文   时间:2017-05-17 00:50:23    阅读次数:164
SPOJ TTM
这道题一眼看去就是一个可持久化线段树,但是是区间修改,由于wyx说此题复杂度是O(nlogn)的,我就没写树套树,然后就自己yy了一个离线做法。 我们考虑直接模拟这个过程,对于一个B操作,我们直接将之前的操作的影响清除,这样每个操作最多会被计算2次,但是有一个问题就是H操作不太好弄,我们可以先离线下 ...
分类:其他好文   时间:2017-05-16 20:10:54    阅读次数:247
889条   上一页 1 ... 33 34 35 36 37 ... 89 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!