自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(39)
  • 收藏
  • 关注

原创 Codeforces 967A Mind the Gap

A. Mind the Gaptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThese days Arkady works as an air traffic controller at a large airport. He controls...

2018-04-30 20:16:41 188

原创 第十四届华中科技大学程序设计竞赛 B数学

链接:https://www.nowcoder.com/acm/contest/106/B来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day Xiao Ming is walking on a straight road and sees m...

2018-04-30 20:09:17 172

原创 第十四届华中科技大学程序设计竞赛 F:Sorting Trees

链接:https://www.nowcoder.com/acm/contest/106/F来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day the tree manager of HUST asked you to sort N trees...

2018-04-30 20:02:27 177

原创 第十四届华中科技大学程序设计竞赛 J BFS

链接:https://www.nowcoder.com/acm/contest/106/J来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. And there are many different types of trees in HUST, each o...

2018-04-30 20:00:25 182

原创 二分 Walking in the Forest

链接:https://www.nowcoder.com/acm/contest/106/K来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. Now you're going to walk through a large forest. There is ...

2018-04-30 19:59:05 134

原创 第十四届华中科技大学程序设计竞赛C 可删除元素的并查集

链接:https://www.nowcoder.com/acm/contest/106/C来源:牛客网题目描述 It’s universally acknowledged that there’re innumerable trees in the campus of HUST.  Thus a professional tree manager is needed....

2018-04-30 19:56:04 205

原创 Codeforces 965E 启发式合并

http://codeforces.com/contest/965/problem/EE. Short Codetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputArkady's code contains nn variables. Each v...

2018-04-27 18:42:00 332

原创 2018年湘潭大学程序设计竞赛 G又见斐波那契

链接:https://www.nowcoder.com/acm/contest/105/G来源:牛客网题目描述这是一个加强版的斐波那契数列。 给定递推式 求F(n)的值,由于这个值可能太大,请对109+7取模。输入描述:第一行是一个整数T(1 ≤ T ≤ 1000),表示样例的个数。以后每个样例一行,是一个整数n(1 ≤ n ≤ 1018)。输出描述:每个样例输出一行,一个整数,表示F(...

2018-04-27 00:04:04 377

原创 Codeforces 965D

题目链接:http://codeforces.com/contest/965/problem/DA lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l<w. Frogs can also jump on lengths short...

2018-04-26 23:27:19 333

原创 Codeforces 965C

题目链接:题意:给出N个糖果, K个小朋友, 每个小朋友最多获得D次糖果, 每回合一个小朋友获得X个糖果(X<=M), 当糖果少于X个时候直接丢弃, 问第一个小朋友获得糖果的最大值为多少? (N,K,M<=1E18, D <= min(n, 1000))题解:很明显我们只能枚举第一个小朋友获得i次糖果, 然后列出方程。因为进行了i回合 (i-1)回合所有的小朋友获得的糖果加上第i...

2018-04-26 23:24:52 272

原创 2018年湘潭大学程序设计竞赛 H线段树染色

链接:https://www.nowcoder.com/acm/contest/105/H来源:牛客网题目描述n个桶按顺序排列,我们用1~n给桶标号。有两种操作: 1 l r c 区间[l,r]中的每个桶中都放入一个颜色为c的球 (1≤l,r ≤n,l≤r,0≤c≤60) 2 l r   查询区间[l,r]的桶中有多少种不同颜色的球     (1≤l,r ≤n,l≤r)输入描述:有多组数据,对于每...

2018-04-26 23:15:34 174

原创 网络流 Dinic模板

#include <bits/stdc++.h>using namespace std;const int maxn = 1024, INF = 0x3f3f3f3f;struct Edge{ int from, to, cap, flow; Edge() { from = to = cap = flow = 0; } Edg...

2018-04-25 20:35:29 156

原创 Codeforces 939E(三分)

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-04-25 01:46:29 349

原创 CCCP_2016四省 HDU5925

#include <bits/stdc++.h>using namespace std;using ll = long long ;const int dirx[] = {0, 0, 1, -1};const int diry[] = {1, -1, 0, 0};const int maxn = 207;bool vis[maxn*3][maxn*3]; //离散化后是图...

2018-04-24 20:55:33 150

原创 SPOJ:Ada and Orange Tree (LCA+Bitset)

题目链接:https://vjudge.net/problem/SPOJ-ADAORANGAda the Ladybug lives near an orange tree. Instead of reading books, she investigates the oranges. The oranges on orange tree can be in up to 5*50 Shades o...

2018-04-24 19:21:15 277

原创 SPOJ:Harbinger vs Sciencepal(分配问题&不错的DP&bitset优化)

题目链接:https://vjudge.net/problem/SPOJ-R6PLRainbow 6 is a very popular game in colleges. There are 2 teams, each having some members and the 2 teams play some matches against each other. The team which ...

2018-04-24 12:23:48 177

原创 Wannafly挑战赛14 B(字典树的lazy标记)

链接:https://www.nowcoder.com/acm/contest/81/B来源:牛客网题目描述在一个 Minecraft 村庄中,村长有这一本小写字母构成的名册(字符串的表), 每个名字旁边都记录着这位村民的声望值,而且有的村民还和别人同名。 随着时间的推移,因为没有村民死亡,这个名册变得十分大。 现在需要您来帮忙维护这个名册,支持下列 4 种操作: 1. 插入新人名 si,...

2018-04-24 11:00:04 131

原创 Wannafly挑战赛14 并查集+线性基合并

链接:https://www.nowcoder.com/acm/contest/81/E来源:牛客网题目描述 给一个1-base数组{a},有N次操作,每次操作会使一个位置无效。一个区间的权值定义为这个区间里选出一些数的异或和的最大值。求在每次操作前,所有不包含无效位置的区间的权值的最大值。 输入描述:第一行读入一个正整数(1 <= n <= 105)第二行读入n个正整数,第i个表...

2018-04-24 10:50:14 168

原创 Wannafly挑战赛14 C(tarjan缩点后拓扑)

链接:https://www.nowcoder.com/acm/contest/81/C来源:牛客网题目描述给出一个 0 ≤ N ≤ 105 点数、0 ≤ M ≤ 105 边数的有向图, 输出一个尽可能小的点集,使得从这些点出发能够到达任意一点,如果有多个这样的集合,输出这些集合升序排序后字典序最小的。输入描述:第一行为两个整数 1 ≤ n, m ≤ 105,接下来 M 行,每行两个整数 1 ≤...

2018-04-24 10:45:47 123

原创 Wannafly挑战赛14 A:直角三棱锥

题意: 链接:https://www.nowcoder.com/acm/contest/81/A来源:牛客网在三维空间中,平面 x = 0, y = 0, z = 0,以及平面 x + y + z = K 围成了一个三棱锥。 整天与整数打交道的小明希望知道这个三棱锥内、上整点的数目。 他觉得数量可能很多,所以答案需要对给定的 M 取模。输入描述:输入有 1 ≤ T ≤ 105 组数据。每组数据中...

2018-04-24 10:23:34 149

原创 第12届中南校赛 E(树状数组离散化,菱形查询)

题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=2083【E:EZ's binoculars】题意:             给你一些点(N<1e5),然后其实是每次询问给你一个中心在( x , y )的四边相等的菱形,对角线长为d,求问多少点在菱形里。官方题解:             首先可以想到二维树状数组维护。但是显然内...

2018-04-24 10:16:28 132

原创 中南大学第十二届大学生程序设计竞赛 D树上异或性质

题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=2082DescriptionThe environment of Beijing is insufferable as you know.You have to wear a mask when you go outside because of the smog. Xiaoming ...

2018-04-24 10:14:33 205

原创 2018中南校赛 C数论,离散化单调DP

Wells有一片神奇的花园,花园里有无数神石和一个神山。每一天,Wells 可以喂神山一个神石,使得神山的高度变为原高度乘上神石的能力值,或者使得所有的神石能力值+1第 0 天时,所有神石的能力值为 0,神山的高度为 1Wells想知道神山最快的长成某一个高度值最少需要多少天定义函数 F(x)是使得 神山 变成 x 的最少天数定义函数 G(x,p):若 F(x)<=p 则 G(x,p)=1 ...

2018-04-24 10:10:17 244

原创 第十六届金马五校 B:

链接:https://www.nowcoder.com/acm/contest/91/B来源:牛客网题目描述 在埃森哲,员工培训是最看重的内容,最近一年,我们投入了 9.41 亿美元用于员工培训和职业发展。截至 2018 财年末,我们会在全球范围内设立 100 所互联课堂,将互动科技与创新内容有机结合起来。按岗培训,按需定制,随时随地,本土化,区域化,虚拟化的培训会让你快速取得成长。小埃希望能通...

2018-04-16 21:38:00 232

原创 第十六届金马五校 二进制找规律F:1 + 2 = 3 ?

链接:https://www.nowcoder.com/acm/contest/91/F来源:牛客网小Y在研究数字的时候,发现了一个神奇的等式方程,他屈指算了一下有很多正整数x满足这个等式,比如1和2,现在问题来了,他想知道从小到大第N个满足这个等式的正整数,请你用程序帮他计算一下。 (表示按位异或运算) 输入描述:第一行是一个正整数,表示查询次数。接着有T行,每行有一个正整数,表示小Y...

2018-04-16 21:16:03 222

原创 十六届金马五校 I: 二数

链接:https://www.nowcoder.com/acm/contest/91/I来源:牛客网我们把十进制下每一位都是偶数的数字叫做“二数”。 小埃表示自己很聪明,最近他不仅能够从小数到大:2,3,4,5....,也学会了从大数到小:100,99,98...,他想知道从一个数开始数最少的数就得到一个二数。但是聪明的小森已经偷偷在心里算好了小埃会数到哪个二数,请你求出他要数到哪个数吧。 ...

2018-04-16 21:11:37 156

原创 十六届金马五校赛 L:DP求最长K倍序列

链接:https://www.nowcoder.com/acm/contest/91/L来源:牛客网给一个数组 a,长度为 n,若某个子序列中的和为 K 的倍数,那么这个序列被称为“K 序列”。现在要你 对数组 a 求出最长的子序列的长度,满足这个序列是 K 序列。 输入描述:第一行为两个整数 n, K, 以空格分隔,第二行为 n 个整数,表示 a[1] ∼ a[n],1 ≤ n ≤ 105 , ...

2018-04-16 21:06:29 218

原创 背包方案数DP

有两种货币。n1种货币每种任意取,n2种货币每种只能取1个。求组合成m的方案数。#include <bits/stdc++.h>using namespace std;const int N = 1E5 + 7;const int MOD = 1E9 + 7;typedef long long ll;int dp1[N];int dp2[N];int n1, n2, m...

2018-04-16 20:47:14 224

原创 UESTC

某日,柱爷来到了喵哈哈城,准备干一票银行! 有道是知己知彼,百战不殆,早在前几日,柱爷就委托了卿学姐调查了喵哈哈城的银行资金分布情况! 而昨夜柱爷夜观天象,知晓今日是动手的绝佳时刻! 喵哈哈城是一个大的矩形方阵,而这方阵是由[Math Processing Error]个矩形方格组成,方阵中的每个格子都有一家银行,这个银行的资金是[Math Processing Error]. 而...

2018-04-10 21:36:03 303

原创 Codeforces712D 前缀和优化DP

题目链接:http://codeforces.com/problemset/problem/712/DD. Memory and Scorestime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMemory and his friend Lexa ...

2018-04-07 12:52:56 334

原创 Codeforces 710E Generate a String DP

题目链接:http://codeforces.com/problemset/problem/710/E E. Generate a Stringtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputzscoder wants to ge...

2018-04-07 12:48:52 162

原创 Codeforces 710C Magic Odd Square

题目链接:http://codeforces.com/problemset/problem/710/CC. Magic Odd Squaretime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFind an n × n matrix ...

2018-04-07 12:44:57 236

原创 51NOD1267(4个数和为0)

给出N个整数,你来判断一下是否能够选出4个数,他们的和为0,可以则输出"Yes",否则输出"No"。 Input 第1行,1个数N,N为数组的长度(4 <= N <= 1000)第2 - N + 1行:A[i](-10^9 <= A[i] <= 10^9) Output 如果可以选出4个数,使得他们的和为0,...

2018-04-03 23:00:01 168

原创 Codeforces 955C Sad powers(数论)

题目链接:http://codeforces.com/problemset/problem/955/C C. Sad powerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given Q queries of ...

2018-04-01 21:41:20 255

原创 Codeofrces 957E 数学二维偏序

题目链接:http://codeforces.com/contest/957/problem/EE. Contact ATCtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputArkady the air traffic controller is ...

2018-04-01 19:22:26 398

原创 Codeforces954F Runner's Problem矩阵优化DP

题目链接:http://codeforces.com/problemset/problem/954/FF. Runner's Problemtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are running thro...

2018-04-01 19:06:04 345

原创 牛客练习赛14D 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)满足dist(v,xi...

2018-04-01 18:51:11 156

原创 牛客练习赛14 B 区间倍增ST表

链接:https://www.nowcoder.com/acm/contest/82/B来源:牛客网给你一个长为n的序列a和一个常数k 有m次询问,每次查询一个区间[l,r]内所有数最少分成多少个连续段,使得每段的和都 <= k 如果这一次查询无解,输出"Chtholly" 输入描述:第一行三个数n,m,k第二行n个数表示这个序列a之后m行,每行给出两个数l r表示一次...

2018-04-01 18:40:28 324

原创 牛客练习赛4反素数

链接:https://www.nowcoder.com/acm/contest/82/A来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld题目描述 t次询问,每次给你一个数n,求在[1,n]内约数个数最多的数的约数个数 输入描述:第一行一个正整数t之后t行,每行一个正整数n输出描述:输出t...

2018-04-01 18:27:01 179

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除