自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(103)
  • 资源 (2)
  • 收藏
  • 关注

原创 ICPC南京站 Problem M. Monster Hunter(树上DP)

题目链接: Monster Hunter.树上DP,本来以为复杂度n3,实际上复杂度是n2的,因为树上每两个节点 x , y ,他们仅会在 lca(x , y)的时候会被#include<bits/stdc++.h>using namespace std;const int maxn = 2e3+9;#define inf 0x3f3f3f3f3f3f3f3fvector<long long>edge[maxn];long long val[maxn],Size[m

2020-12-21 21:03:27 565

原创 2020ccpc长春(Strange Memory)

Strange MemoryOnce there was a rooted tree. The tree containednnodes, which were numbered1,…,n. The node numbered1was the root of the tree. Besides, every nodeiwas assigned a numbera​i​​. Your were surprised to find that there were several pai...

2020-11-09 20:55:55 813

原创 Exponial Kattis - exponial(欧拉降幂)

降幂公式:模板题:Exponial .计算:exponial(n)%m 1<= n,m <= 109+7exponial(n) = n^ (n-1^ ( n-2^ ( n-3^ (n-4^ (…^ 1))))详情看代码注释#include<bits/stdc++.h>using namespace std;#define inf (long long)0x3f3f3f3flong long tmp;long long euler(long long n)/

2020-06-01 21:41:47 270

原创 Lomsat gelral CodeForces - 600E(树上启发式合并)

Lomsat gelral CodeForces - 600EYou are given a rooted tree with root in vertex 1. Each vertex is coloured in some colour.Let’s call colour c dominating in the subtree of vertex v if there are no other colours that appear in the subtree of vertex v more t

2020-05-28 11:24:54 271

原创 travel Gym - 247728H(树形DP)

travel Gym - 247728HWhite Cloud has a tree with n nodes.The root is a node with number 1. Each node has a value.White Rabbit wants to travel in the tree 3 times. In Each travel it will go through a path in the tree.White Rabbit can’t pass a node more th

2020-05-26 14:36:50 212

原创 【美团杯2020】平行四边形(原根)

【美团杯2020】平行四边形蒜斜非常喜欢下围棋。自从AlphaOg面世以来,他就立志一定要研究出AlphaOg的破绽。 终于,他发现当AlphaOg遇到一种特殊局面后,它的神经网络会自动输出“投降”!随着进一步的研究,蒜斜发现这种局面有着更一般的特性,不仅仅局限于固定大小棋盘。 具体来说,当棋盘大小是 n(n+1 是一个质数)且棋盘上恰好有 n 个棋子的时候,如果这些棋子的位置满足下列条件,那么 AlphaOg 就会直接投降。假设第 i 个棋子的位置是点 Pi,处在第 xi 行第 yi 列,那么这些坐标

2020-05-19 09:50:01 349

原创 Symmetric Matrix Gym - 247727B

Symmetric Matrix Gym - 247727BCount the number of n×n matrices A satisfying the following condition modulo m.Ai,j∈{0,1,2} for all 1≤i,j≤n.Ai,j=Aj,i for all 1≤i,j≤n.Ai,1+Ai,2+⋯+Ai,n=2 for all 1≤i≤n.A1,1=A2,2=⋯=An,n=0.InputThe input consists

2020-05-18 21:23:21 247

原创 Monotonic Matrix Gym - 247727A

Monotonic Matrix Gym - 247727ACount the number of n×m matrices A satisfying the following condition modulo (109+7).Ai,j∈{0,1,2} for all 1≤i≤n,1≤j≤m.Ai,j≤Ai+1,j for all 1≤i<n,1≤j≤m.Ai,j≤Ai,j+1 for all 1≤i≤n,1≤j<m.InputThe input consists

2020-05-15 22:25:17 314

原创 张老师的旅行(区间dp)

张老师的旅行链接:https://ac.nowcoder.com/acm/contest/5477/C来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述张老师到了一个王国去旅游,王国有n个景点,张老师到达这个城市所在的车站恰好位于第x个景点,这个王国非常特别,恰好所有著名的景点都在分布在直线上,每个景点在坐标pi上(单位:公里),张老师身体非常好,每走一公里花费一分钟。每个景点都有一

2020-05-12 11:29:53 346

原创 Scout YYF I (POJ - 3744)(概率dp+矩阵快速幂)

Scout YYF I POJ - 3744YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy’s base. After overcoming a series difficulties, YYF is now at the start of enemy’s famous “mine road”. This is a very long road, on which

2020-05-08 22:38:43 307

原创 Nature Reserve(最小生成森林)

Nature ReserveKattis - naturereserveIn a Nature Reserve and Wildlife Park, there are NNN environmental monitoring stations to monitor temperature, atmospheric pressure, humidity, fire, water quality...

2020-04-26 17:01:54 2558

原创 codeforces 55D Beautiful numbers(数位DP)

Beautiful numbersVolodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We w...

2020-04-22 14:18:31 209

原创 牛客Talk(概率dp)

题目描述众所周知,牛可乐 的口胡能力十分强大.牛可乐 要讲 n 件事情,我们把这些事情从 1∼n 标号。牛可乐每讲一件事需要耗费一个单位的时间,但是 牛可乐讲事情和普通人不同:牛可乐在 讲完 第 i 件事时,只有 pi 的概率继续讲下一件事(第 i+1 件),也就是说,牛可乐讲完第 i 件事后有 (1-pi) 的概率从第 i-1 件事开始讲!当 牛可乐讲完第 n 件事,并且决定讲下一件事时,牛...

2020-04-20 22:54:21 392

原创 Eugene and an array(思维)

Eugene and an arraytime limit per test:1.5 secondsmemory limit per test:256 megabytesinput:standard inputoutpu:tstandard outputEugene likes working with arrays. And today he needs your help in so...

2020-04-15 23:09:00 319

原创 Hexagonal Rooks 计蒜客(模拟)

Hexagonal Rooks 计蒜客 - 43472It is game night and Alice and Bob are playing chess. After beating Bob at chess several times, Alice suggests they should play a chess variant instead called hexagonal che...

2020-03-25 22:33:19 276

原创 Deceptive Dice (规律)

Deceptive Dice 计蒜客 - 43468Recently your town has been infested by swindlers who convince unknowing tourists to play a simple dice game with them for money. The game works as follows: given is an n-si...

2020-03-25 22:14:16 888

原创 Canyon Crossing(二分+bfs)

Canyon Crossing 计蒜客 - 4346764000KThe Bridge And Passageway Creators are responsible for making new paths through the local mountains. They have approved your plan to build a new route through your f...

2020-03-25 21:58:23 294

原创 后缀自动机

#include<bits/stdc++.h>using namespace std;const int maxn = 2e6+9;//一般有2n个等价类int tot=1,las=1;char s[maxn];long long ans=0;struct NODE{ int ch[26]; int len,fa; NODE() { ...

2020-02-07 17:22:47 176

原创 区间dp

1022 石子归并 V2N堆石子摆成一个环。现要将石子有次序地合并成一堆。规定每次只能选相邻的2堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的代价。计算将N堆石子合并成一堆的最小代价。例如: 1 2 3 4,有不少合并方法1 2 3 4 => 3 3 4(3) => 6 4(9) => 10(19)1 2 3 4 => 1 5 4(5) =&g...

2020-02-04 15:52:59 182

原创 Number Game (博弈) Gym - 101653Q

Alice and Bob are playing a game on a line of N squares. The line is initially populated with one of each of the numbers from 1 to N. Alice and Bob take turns removing a single number from the line, s...

2020-02-04 11:35:56 471

原创 Flying Squirrel Gym - 102091A (ST表)

https://vjudge.net/contest/351286#problem/A题意:1~n位置有不同高度的柱子,一直飞鼠只能从一个柱子飞到高度严格比它小的柱子;给定n个柱子的高度 ,m次询问:1.从一个柱子最多能飞到多少个柱子上,2.从一个柱子到另一个柱子最多能飞多少次RMQ查询区间最大值对于第一种询问dfs求最多路径,把相同高的柱子视为分隔点,相同高的柱子在分隔点之间往下...

2020-01-13 20:38:52 246

原创 Charles in Charge Gym - 101490E (队列优化dij+二分)

https://vjudge.net/contest/350975#problem/E题意:给一张无向图,求一条从1到n路上的最大边,使得其最小,同时还要满足 这条路长度<=最短路*(1+X%)先跑一边最短路,求出最短路然后二分答案,求在最大边为mid的情况下的最短路(在松弛的时候判断一下边大于mid就不松弛),用spfa T了,得用队列优化dij#incl...

2020-01-11 09:20:56 254

原创 点分治(模板)

TreePOJ - 1741Give a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (...

2019-12-20 10:28:47 115

原创 树的重心

最大子树最小的节点#include<bits/stdc++.h>using namespace std;const int maxn = 1e5;int vis[maxn],Size[maxn];void dfs(int x){ vis[x] = 1; Size[x] = 1; int max_part = 0; for(int i ...

2019-12-19 15:21:24 87

原创 树链剖分

https://www.luogu.com.cn/problem/P3384#include<bits/stdc++.h>using namespace std;const int maxn = 5e5+10;#define lson num<<1#define rson num<<1|1#define mid ((l+r)>>1...

2019-11-26 18:19:21 90

原创 Equidistant Gym - 102411E

In 2019 ICPC subregions structure was changed a little. Now for each subregion, we need to choose the best place for the subregion finals. To make things fair we want to choose a city in such a way th...

2019-11-05 19:59:33 1054

原创 倍增LCA

//求最近公共祖先#include<bits/stdc++.h>using namespace std;const long long maxn = 5e5+10;struct node{ long long to,next;} edge[maxn*2];long long cnt,deep[maxn],fa[maxn][50],head[maxn],lg[m...

2019-11-05 09:12:55 162

原创 P3810 陌上花开(三维偏序,cdq分治模板)

https://www.luogu.org/problem/P3810//第一维排序,第二维cdq分治,第三维树状数组#include<bits/stdc++.h>using namespace std;#define lowbit(x) (x&-(x))const int maxn = 200006;int a[200009],ans[200009];...

2019-10-31 18:23:25 161

原创 Research Productivity Index

Research Productivity IndexKattis - researchproductivityindexAngela is a new PhD student and she is nervous about the upcoming paper submission deadline of this year’s research conference. She h...

2019-10-28 15:26:57 464

原创 Tree with Maximum Cost(树形DP)

You are given a tree consisting exactly ofnnvertices. Tree is a connected undirected graph withn−1n−1edges. Each vertexvvof this tree has a valueavavassigned to it.Letdist(x,y)dist(x,y)...

2019-10-28 15:23:01 248

原创 P2522 [HAOI2011]Problem b(Mobius经典题目)

题目描述对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数。输入格式第一行一个整数n,接下来n行每行五个整数,分别表示a、b、c、d、k输出格式共n行,每行一个整数表示满足要求的数对(x,y)的个数输入输出样例输入22 5 1 5 11 5 1 5 2输出...

2019-10-25 20:34:44 134

原创 Master of Phi HDU - 6265(数论)

Problem B. Master of PhiYou are given an integer n. Please output the answer of ∑ d|n φ(d) × n d modulo 998244353. n is represented in the form of factorization.φ(n) is Euler’s totient function, a...

2019-10-24 11:22:42 264

原创 莫比乌斯反演

莫比乌斯函数:设,其中p为素数,则定义如下:线性筛求莫比乌斯函数:#include<bits/stdc++.h>using namespace std;int mu[120000],vis[120000],prime[120000],cnt;void mbws(int n){ mu[1] = 1; cnt = 0; for...

2019-10-23 14:28:12 231

原创 Angle Beats Gym - 102361A

Angle BeatsGym - 102361AGivennnpointsP1,P2,⋯,PnP1,P2,⋯,Pnon 2D plane andqqqueries. Inii-th query, a pointAiAiis given, and you should determine the number of tuples(u,v)(u,v)that1≤u&...

2019-10-15 08:55:05 295

原创 Hungry Canadian Gym - 101484G

Hungry CanadianGym - 101484GTeodoro just moved to Canada. He is having a hard time there as the cost of living is higher than he expected. He is short on money so he decided to eat a string, ...

2019-09-27 19:36:39 189

原创 Jokewithpermutation Gym - 100553J (bfs)

JokewithpermutationGym - 100553JJoey had saved a permutation of integers from 1 to n in a text file. All the numbers were written asdecimal numbers without leading spaces.Then Joe made a pr...

2019-09-26 10:54:01 217

原创 Largest Allowed Area(二维前缀和+二分)

Largest Allowed AreaGym - 102091LA company is looking for land to build its headquarters. It has a lot of money and can buy asmany land patches as it needs. Its goal, however, is finding the la...

2019-09-17 10:17:20 269

原创 Fear Factoring(分块)

Problem C — limit 1 secondFear FactoringThe Slivians are afraid of factoring; it’s just, well, difficult.Really, they don’t even care about the factors themselves, just how much they sum to.We can...

2019-09-06 19:58:20 366

原创 Interesting Integers (扩展欧几里得)

https://cn.vjudge.net/contest/322620#problem/It组输入,给定一个数n,求出最小的a,b (a<b),使得以a,b为开头的斐波那契数列包含n两个斐波那契数列的和也是斐波那契数列先写出两个以 1,0 和0,1开头的数列a[ ] = 1,0,1,2,3,5,8,13,21,34,55b[ ] = 0,1,1,2,3,...

2019-08-29 16:03:36 365

原创 Log Concave Sequences(矩阵快速幂求递推)

Log Concave SequencesGym - 102302HA sequence of numbersAis said to be logarithm concave if, and only if, for every2 ≤ i ≤ n - 1,ai - 1 * ai + 1 ≤ ai2.For example the sequenceA = (1, 2, 3)...

2019-08-28 15:21:59 635

python写的飞机大战游戏

该资源为飞机大战游戏,解压后有开始游戏.py文件,需要用python解释器运行,游戏的操作在使用说明里

2020-02-03

聊天系统_全双工.rar

文件包含聊天服务器和客户端,可以实现同一局域网下的多人聊天,使用的是udp套接字通信,需要用python解释器运行。

2020-02-03

空空如也

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

TA关注的人

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