- 博客(263)
- 收藏
- 关注
原创 ACM-ICPC 2018 南京赛区网络预赛 J.SUM(线筛)
链接 题意:给出一个f函数,定义为 把i拆分成两个因子的方案数(且每一个因子都不能被平方数整除),求∑ni=1f(i)∑i=1nf(i)\sum _{i=1} ^{n} f(i)分析:首先我们考虑f(i)如何求 对于任意一个i,我们可以拆分成素因子的乘积形式 此时就可以根据素因子的幂分为3种情况讨论1.素因子的幂>=3时,由于只能拆分成两个因子无论怎么组合,f(i)一定为0 ...
2018-09-06 21:41:35 208
原创 BZOJ2594 水管局长数据加强版(LCT维护最小生成树)
2594: [Wc2006]水管局长数据加强版 Time Limit: 25 Sec Memory Limit: 128 MB Submit: 4889 Solved: 1496 [Submit][Status][Discuss] Description SC省MY市有着庞大的地下水管网络,嘟嘟是MY市的水管局长(就是管水管的啦),嘟嘟作为水管局长的工作就是:每天供水公司可能要将一定...
2018-08-24 16:56:35 257
原创 HDU 6430 Problem E. TeaTree(线段树)
Problem E. TeaTree Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 781 Accepted Submission(s): 291Problem Description Recently, TeaTr...
2018-08-23 17:03:53 274
原创 HDU 6437 Problem L.Videos(费用流)
Problem L.Videos Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 460 Accepted Submission(s): 224Problem Description C-bacteria takes ...
2018-08-23 16:18:02 303
原创 HDU 6345 Problem J. CSGO(思路)
Problem J. CSGO Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 571 Accepted Submission(s): 301Problem Description You are playing CS...
2018-08-23 15:57:33 276
原创 hdu6397 Character Encoding(容斥原理)
Character Encoding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 638 Accepted Submission(s): 243Problem Description In computer sci...
2018-08-16 09:56:36 235
原创 bzoj 3531 旅行 (树剖+动态建树)
3531: [Sdoi2014]旅行Time Limit: 40 Sec Memory Limit: 512 MBSubmit: 2990 Solved: 1318[Submit][Status][Discuss]Description S国有N个城市,编号从1到N。城市间用N-1条双向道路连接,满足从一个城市出发可以到达其它所有城市。每个城市信仰不同的宗教,如飞天面条神教、隐形独角兽教、绝地...
2018-05-08 18:09:27 158
原创 hdu 5029 Relief grain(树剖好题)
Relief grainTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 100000/100000 K (Java/Others)Total Submission(s): 3085 Accepted Submission(s): 903Problem DescriptionThe soil is cracking up bec...
2018-05-08 17:58:58 296
原创 uva 12655 Trucks(树剖+MST)
题目链接:点击打开链接题意:给出n个点,m条双向边,每个边都有个权值(这个路可以通行的最大重量),然后有q个查询,每次查询u到v上最大可以运输多少重量(每次只从u出发一辆车)分析:为使u到v运输重量最大,那么就要使u到v路径上最小的边尽量大,于是这里可以搞个最大生成树,这样就使得每一条边尽量大了,然后根据最大生成树建LCT,查询即可#include<bits/stdc++.h>usi...
2018-05-08 17:39:59 263
原创 hdu 4718 The LCIS on the Tree(树剖+区间合并)
The LCIS on the TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1470 Accepted Submission(s): 422Problem DescriptionFor a sequence S1, S2,...
2018-05-08 17:24:55 262
原创 HDU 5052 Yaoge’s maximum profit(树剖+区间合并)
Yaoge’s maximum profit Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1321 Accepted Submission(s): 418 Problem DescriptionYao...
2018-05-08 17:01:06 169
原创 nyoj435 棋盘覆盖(二) (轮廓线dp)
棋盘覆盖(二)时间限制:1000 ms | 内存限制:65535 KB难度:4描述The banquet hall of Computer Scientists' Palace has a rectangular form of the size M x N (1<=M<=9, 1<=N<=9). It is necessary to lay hardwood floo...
2018-05-03 19:59:53 239
原创 ACM-ICPC 2017 Asia Xi'an——LOL(全排列+dp)
题意:有两队打lol,每队可以ban(禁用)5个人物,一共有100个人物,现给出我方拥有人物的情况,给出一个5*100的矩阵,s[i][j]表示第i个人是否有第j个人物,1表示有,0没有(没有的人物肯定是不能选的),问一共有多少种对局情况(敌方假定所有人物都有)分析:对局情况一共由四种因素构成:1.我方选择的人物2.敌方选的的人物3.我方ban的人物4.敌方ban的人物那么ans=我方选择人物的方...
2018-04-28 21:38:23 530
原创 POJ3237 Tree(树剖)
TreeTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 11539 Accepted: 2977DescriptionYou are given a tree with N nodes. The tree’s nodes are numbered 1 through N and its edges are numbered 1 ...
2018-04-27 15:34:39 166
原创 51nod 1678 lyk与gcd(容斥原理)
1678 lyk与gcd基准时间限制:2 秒 空间限制:131072 KB 分值: 80 难度:5级算法题这天,lyk又和gcd杠上了。它拥有一个n个数的数列,它想实现两种操作。1:将 ai 改为b。2:给定一个数i,求所有 gcd(i,j)=1 时的 aj 的总和。Input第一行两个数n,Q(1<=n,Q<=100000)。接下来一行n个数表示ai(1<=ai<...
2018-04-26 19:38:29 357
原创 CodeForces - 877E Danil and a Part-time Job(线段树+dfs序)
E. Danil and a Part-time Jobtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDanil decided to earn some money, so he had found a part-time job. The...
2018-04-20 09:02:25 296
原创 UVA - 12166 Equilibrium Mobile(dfs+贪心)
题意:给出一个天平,问最少修改几个位置的重量可以让天平平衡分析:要求修改位置的最小数量,那么,肯定是以一个位置的重量为基准,调整整个天平,这样最多调整sum-1次sum为点的个数,dep为深度,w为该点的重量对于每一个点,可以求出他的深度,此时以该点为基准点,整个天平的重量为W=(w<<dep),于是如果两以个点为基准点有相同的W,那么这两点肯定是不用修改的,只需要统计所有(w<...
2018-04-18 16:21:04 209
原创 UVA - 10129 Play on Words(欧拉路)
题目链接题意:给出n个单词,问是否可以把所有单词都拍成一个序列,使得每个单词的第一个字母和上一个单词的最后一个字母相同(想象成语接龙)分析:不难发现,除了起始单词和结束单词,每个单词均连接了两个单词(一进一出),而起始单词只有出,结束单词只有进,把每个单词抽象为一个点,会发现这是有像图的欧拉路问题,当存在欧拉路时,存在解,有向图存在欧拉路的条件是,忽略边的方向原图连通,除起点和终点外,所有点的出入...
2018-04-13 18:48:38 147
原创 UVA - 12171 Sculpture(bfs+离散化)
题目链接题意(from紫书):某雕塑由 n (n<=50) 个边平行于坐标轴的长方体组成。每个长方体用 6 个整数 x0, y0, z0, x, y, z 表示(1<= x0, y0, z0, x, y, z <= 500)。 x0 为长方体顶点中,x 坐标的最小值,x 表示长方体在 x 方向的长度。其他 4 个值类似定义。统计这个雕像的体积和表面积。注意,雕像内部可能会有密闭的...
2018-04-13 18:38:09 203
原创 uva12295 Optimal Symmetric Paths(bfs+记忆化搜索)
题目链接题意:有个n*m的图,每个点都有权值,求从(1,1)走到(n,n)有最小权值的路径的方案数,要求路径必须沿次对角线对称思路:由于题目要求路径必须沿次对角线对称,那么就可以把以次对角线对称的点的权值加过来,这样只用求(1,1)到对角线的最小权路径方案数即可,就不用考虑对称的问题然后考虑如何限制路径,我们可以先求出(1,1)到每一点经过路径的最小权dp[i][j],然后以找出对角线上的最小权值...
2018-04-07 08:28:59 184
原创 51nod 1554 欧姆诺姆和项链(KMP+思路)
1554 欧姆诺姆和项链题目来源: CodeForces基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题有一天,欧姆诺姆发现了一串长度为n的宝石串,上面有五颜六色的宝石。他决定摘取前面若干个宝石来做成一个漂亮的项链。他对漂亮的项链是这样定义的,现在有一条项链S,当S=A+B+A+B+A+...+A+B+A的时候是漂亮的,这儿A,B是一些宝石串,“+”表示连接操作。...
2018-04-06 09:57:54 308
原创 hihocoder #1710 : 等差子数列(二分+RMQ)
#1710 : 等差子数列时间限制:10000ms单点时限:1000ms内存限制:256MB描述给定N个整数A1, A2, ... AN,小Hi会询问你M个问题。对于每个问题小Hi给出两个整数L和R(L ≤ R),请你找出[AL, AL+1, AL+2, ... AR]中最长的等差连续子数列,并输出其长度。 例如[2, 3, 5, 7, 9]中最长的等差连续子数列是[3, 5, 7, 9]长度为...
2018-04-03 16:02:13 195
原创 codeforces 754D. Fedor and coupons(思路)
D. Fedor and couponstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAll our characters have hobbies. The same is true for Fedor. He enjoys shoppin...
2018-04-02 18:07:47 200
原创 CodeForces - 954D Fight Against Traffic(最短路)
D. Fight Against Traffictime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle town Nsk consists of n junctions connected by m bidirectional roads....
2018-04-02 16:01:27 284
原创 牛客练习赛14 E.无向图中的最短距离 (bfs+bitset)
链接:https://www.nowcoder.com/acm/contest/82/E 来源:牛客网题目描述 有一个n个点的无向图,有m次查询,每次查询给出一些(xi,yi) 令dist(x,y)表示x和y点在图中最短距离,dist(x,x)=0,如果x,y不连通则dist(x,y) = inf 每次查询图中有多少个点v与至少一个这次询问给出的(xi,yi)满足dis...
2018-04-02 15:56:01 187
原创 CodeForces - 715 B. Complete The Graph(dijkstra+暴力)
B. Complete The Graphtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputZS the Coder has drawn an undirected
2018-03-30 17:49:41 547
原创 hdu4360 As long as Binbin loves Sangsang(spfa)
Problem Description Binbin misses Sangsang so much. He wants to meet with Sangsang as soon as possible. Now Binbin downloads a map from ELGOOG.There are N (1<=N<=1,314) cities in the map ...
2018-03-28 18:33:10 242
原创 hdu5334 XYZ and Drops(BFS)
XYZ and DropsTime Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2111 Accepted Submission(s): 730Problem DescriptionXYZ is playing an interesting...
2018-03-23 17:11:15 281 1
原创 codeforce 914-D. Bash and a Tough Math Puzzle(线段树)
D. Bash and a Tough Math Puzzletime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBash likes playing with arrays. He has an array a1, a2, ... an of...
2018-02-23 14:01:16 172
原创 codeforce 939 E. Maximize!(贪心)
E. Maximize!time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a multiset S consisting of positive integers (initially empty). There ar...
2018-02-22 11:30:45 269
原创 codeforce 939D. Love Rescue(dfs+贪心)
D. Love Rescuetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputValya and Tolya are an ideal pair, but they quarrel sometimes. Recently, Valya took ...
2018-02-19 11:26:04 430
原创 codeforce 933A Twisty Movement(dp+LIS)
A. A Twisty Movementtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people m...
2018-02-18 11:11:00 496
原创 HDU1695 GCD(容斥原理)
我校晋级第42届ACM国际大学生程序设计竞赛全球总决赛GCDTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13628 Accepted Submission(s): 5203Pro
2018-02-03 10:32:02 161
原创 POJ2356 Find a multiple(鸽巢原理)
Find a multipleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8592 Accepted: 3725 Special JudgeDescriptionThe input contains N natural (i.e. posi
2018-02-03 10:11:31 189
原创 Educational Codeforces Round 37 E. Connected Components?(bfs+思路)
E. Connected Components?time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an undirected graph
2018-02-03 09:56:52 562
原创 Codeforces Round #460 (Div. 2) D. Substring(树形dp)
D. Substringtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a graph with n nodes and m direc
2018-02-01 09:54:32 273
原创 POJ3694 Network (缩点+并查集+LCA)
NetworkTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 10825 Accepted: 4043DescriptionA network administrator manages a large network. The network con
2018-01-26 15:47:29 254
原创 LCA模板(tarjan+ST+倍增)
离线 tarjan:每次找最接近叶子节点的根,如果询问的两点在这个根上(两点能被这个根同时访问),则这个根为两点的lca#include#include#include#include#include#include#include#define mem(a,b) memset(a,b,sizeof(a))using namespace std;const int
2018-01-24 10:02:40 396
原创 HDU4635 Strongly connected(tarjan缩点+思路)
Strongly connectedTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3476 Accepted Submission(s): 1402Problem DescriptionGive a
2018-01-23 10:11:57 201
原创 HDU4612 Warm up(割边+树的直径)
Warm upTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 7504 Accepted Submission(s): 1747Problem Description N planets are c
2018-01-23 09:42:48 202
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人