- 博客(76)
- 收藏
- 关注
原创 2019秋招面经(计算机相关专业)
先说说自身情况, 双非本科应届生,科班,19年八月尾放弃考研准备秋招,持续了九月十月两个月。有一些不厉害的程序设计相关的奖项,无项目开发经验,学科成绩应该在年级前50%吧。投了一些国内目前还算比较好的互联网公司, 岗位都是c++后台开发相关。最后拿到了华为通用软件开发和百度自动驾驶的offer。准备面试的同学一定要多投一点公司(大佬除外,中意哪个公司投哪个就好了2333),暂时手里...
2020-02-22 15:55:25
2417
2
原创 快手2020校园招聘秋招笔试--工程A试卷 题4
题意:中文题面自行理解思路:处理出每块由红色边连成的连通块的点个数,ans=总方案数-所有只有红边相连的块的总方案数+只有黑边与之相连的点个数代码:#include<bits/stdc++.h>using namespace std;#define LL long longconst int maxn=1e5+10;const LL mod=1e9+7;int ...
2019-08-25 18:45:31
608
原创 hdu-4836-The Query on the Tree(线段树+LCA)
题目链接思路:对于每次询问,主要是看x和root的关系,求出root和xlcaroot=x ,ans为总的和lca=x 那么ans=总的和-(root到x这条链上父节点为x的那个点的子树和)否则,ans就是x的子树和求子树和和修改直接线段树维护。节点的编号和lca我是用的树链剖分求的AC代码:#include<bits/stdc++.h>using n...
2018-10-07 15:36:57
269
原创 HDU-4605-Magic Ball Game (离散化+树状数组+离线)
题目链接题意:有一颗树,每个点有一个权值,从根节点放一个求往下落,球的值小于当前节点的值,往左右儿子落的概率各为1/2,相等则会停在这个节点,球的值大于当前节点的值往做儿子落的概率是1/8,往右儿子落的概率是7/8,q此询问,每个询问给一个点x和值w,问这个求落到x的概率。思路:对于询问的每个点,只需要管跟节点到这个节点的这条链上的信息,用dfs可以很方便访问到每条链,把这条链分为向左和向...
2018-10-06 10:21:33
305
原创 HDU–6447–YJJ’s Salesman (dp+线段树)
题目链接题意:从(0,0)点走到(1e9,1e9)这个点,每次可以由(x,y)走到(x,y+1),(x+1,y),(x+1,y+1)这三个点之一,一个点由(x,y)由价值v,如果是由(x-1,y-1)走到(x,y),那么可以获得这个价值。问走到最后能获得的最大价值是多少。思路:倒着考虑,把点的坐标按x从小到大,y从小到大排序,容易想到ans[x][u]=max(ans[x][y+1],an...
2018-08-26 09:43:40
302
原创 HDU--6406--Taotao Picks Apples (预处理+线段树)
题目链接思路:**p[i] a[i]~a[n]最大的结果**cnt[i] a[1]~a[i]最大的结果**mx[i] a[1]~a[i]最大值预处理出p[i],cnt[i],mx[i]。对于每次查询,在修改a[x]为y,如果1~x的最大值大于等于y,s+=cnt[x-1],否则s+=cnt[x-1]+1;然后对于后半区间,如果y>=mx[x-1],s+=(x+1~n...
2018-08-15 19:21:14
232
原创 HDU--6393--Traffic Network in Numazu (树链剖分)
题目链接思路:n个点n条边必定有一个环,那么在加边的时候判断一下如果当前加的边会构成环,就吧这条边断开,其中一个端点换成n+1,那么就形成了一个n+1个点n条边的树,然后裸的树链剖分,答案取三种情况的最小值就好,具体看代码~AC代码:#include<bits/stdc++.h>using namespace std;const int maxn=1e5+10;in...
2018-08-14 09:20:54
304
原创 POJ-2774--Long Long Message(后缀数组)
题目链接思路:将两个串连成一个,跑一比那后缀数组求出height,二分答案ans,如果height[i]>=ans,sa[i]和sa[i-1]分别在两个串中就行AC代码:#include<cstdio>#include<cstring>#include<algorithm>using namespace std;///**后缀数组...
2018-08-14 09:14:02
223
原创 自己的模板
~~~~不断更新~~~~目录KMP:EXKMP:最大、最小表示法:MANACHER:AC自动机:后缀数组:树链剖分:dsu on tree:hashsplay二维线段树KMP:char s[maxn];///** 0~len-1int Next[maxn];///** 1~len///最大重复字串:if(i%tmp=...
2018-08-07 11:59:28
311
原创 牛客多校三-G题-Coloring Tree (bfs+计数)
题目链接题意:有一颗有n个节点的树,现在你有k种颜色,要给树的每个节点上颜色,然后给出一个D,表示上完 颜色后树的colorness为D,colorness的定义为树上颜色相同的点的最短的距离。求colorness等于D的上色方案数。思路:我们定义f(D) 为colorness大于等于D的方案数,那么ans=f(D)-f(D+1);对于如何求f(D),通过第一个bfs从根向下遍历树...
2018-07-28 08:48:54
382
原创 牛客多校二--J题 farm
题目链接题意:给出一个n*m的矩阵,矩阵上每个点有一种植物,有T次操作,对于每次操作给出两个殿P1,P2,v,要求给以P1为左上角以P2为右下角的子矩阵中每个植物施种类为v的化肥,如果化肥种类和植物种类不一样,这该点的植物会立马死亡,求T次操作结束之后死亡的植物数量。这题比赛时没想到解题方法,赛后看题解大概有三种解法: 一:二维树状数组 二:线段树+扫瞄线 ...
2018-07-25 21:19:32
318
原创 HDU--6315--Naive Operations(线段树)(2018 杭电多校二 07)
题目链接题意:有a数组和b数组,a开始全为0,b是1~n的一个排列。有两种操作,add l r,a[l]~a[r]每一个都加1,query l r,求a[l]/b[l]+...+a[r]/b[l],每一项向下取整。思路:线段树维护当前区间能对答案作出贡献需要加的最小次数,每次更新先区间更新,然后判断区间维护的最小值是否为0,为0则把每个答案能加一的点单点更新。AC代码:/****...
2018-07-25 21:10:16
302
1
原创 UESTC-1931 为什么你这么熟练啊(莫队)
题目:点击打开链接思路: get(l1,r1,x)=get(1,r1,x)-get(1,l1-1,x); get(l2,r2,x)=get(1,r2,x)-get(1,l2-1,x); get(l1,r1,x)get(l2,r2,x)=get(l,r1,x)*get(1,r2,x)+get(1,l1-1,x)*get(1,l2-1,x)-get(1,r1,x)*g...
2018-07-15 21:19:47
255
原创 UESTC-1925 老头马桶枪!(并查集)
题目:点击打开链接思路:对于x和y,他们3种关系,x和y是同一物种,x吃y,x被y吃那么,我们设x+n为被y吃的,设x+2n为吃x的。若x和y为同类,需要合并(x,y),(x+n,y+n),(x+2n,y+2n);若x吃y,需要合并(y,x+n),(y+n,x+2n),(y+2n,x);关系很明确请自行体会。AC代码:#include<bits/stdc++.h...
2018-07-15 21:01:18
371
原创 HDU-4417-Super Mario(线段树+离线)
Super MarioTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8331 Accepted Submission(s): 3523Problem DescriptionMario is world-f
2018-04-11 23:21:28
284
原创 Codeforces-962C-Make a Square(暴力二进制枚举)
C. Make a Squaretime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputYou are given a positive integer n, written without leading zeroes (for exampl...
2018-04-11 22:26:09
576
原创 Codeforces-962D-Merge Equals (模拟+stl)
D. Merge Equalstime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputYou are given an array of positive integers. While there are at least two equal...
2018-04-11 22:11:01
285
原创 ZOJ-2112-Dynamic Rankings(主席树动态第k大)
Dynamic RankingsTime Limit: 10 Seconds Memory Limit: 32768 KB The Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply
2018-04-10 09:46:55
216
原创 Spoj-DISUBSTR - Distinct Substrings (后缀数组)
DISUBSTR - Distinct Substrings#suffix-array-8Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. TEach test case consists of one s
2018-04-08 23:05:28
385
原创 POJ-3261-Milk Patterns (后缀数组)
Milk PatternsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 17291 Accepted: 7649Case Time Limit: 2000MSDescriptionFarmer John has noticed that th
2018-04-08 22:47:25
206
原创 POJ-1743-Musical Theme (后缀数组)
Musical ThemeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 32721 Accepted: 10894DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in ...
2018-04-08 22:38:12
200
原创 Codeforces-961E-Tufurama (主席树)
E. Tufuramatime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputOne day Polycarp decided to rewatch his absolute favourite episode of well-known TV...
2018-04-06 18:18:49
278
原创 Codeforces-194C-Cutting Figure (思维+bfs)
C. Cutting Figuretime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputYou've gotten an n × m sheet of squared paper.
2018-01-04 13:09:11
369
原创 Codeforce--165D--Beard Graph(树链剖分)
D. Beard Graphtime limit per test:4 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputLet's define a non-oriented connected graph of n v
2017-12-21 17:25:38
279
原创 Codeforces-150B-Quantity of Strings(思维)
B. Quantity of Stringstime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputJust in case somebody missed it: this wint
2017-12-07 23:03:30
728
1
原创 Codeforce-152C-Pocket Book(排列组合+思维)
C. Pocket Booktime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputOne day little Vasya found mom's pocket book. The
2017-12-07 21:40:01
435
原创 Codeforces-148C-standard output(构造)
C. Terse princesstime limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard output«Next please», — the princess called and cast an
2017-12-05 21:53:59
232
原创 Codeforces-144C-Anagram Search(思维)
C. Anagram Searchtime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputA string t is called an anagram of the string
2017-12-05 21:27:26
608
原创 Chtholly's request (思维)
B. Chtholly's requesttime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard output— Thanks a lot for today.— I experience
2017-12-03 14:38:13
1037
原创 hihoCoder-1632-Secret Poems(大模拟)
时间限制:1000ms单点时限:1000ms内存限制:256MB描述The Yongzheng Emperor (13 December 1678 – 8 October 1735), was the fifth emperor of the Qing dynasty of China. He was a very hard-working ruler. He
2017-11-23 11:46:09
357
原创 Codeforces-446(Div.2)-B-Wrath--(线段树区间更新)
B. Wrathtime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputHands that shed innocent blood!There are n guilty pe
2017-11-18 10:18:59
207
原创 Codeforces-Bertown Subway(思维)
C. Bertown Subwaytime limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputThe construction of subway in Bertown is almost
2017-10-27 23:41:12
594
原创 Codeforces-242C-King's Path(bfs)
C. King's Pathtime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputThe black king is standing on a chess field consis
2017-10-16 22:59:54
422
原创 Codeforce-242E-XOR on Segment(线段树区间更新)
E. XOR on Segmenttime limit per test:4 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputYou've got an array a, consisting of n intege
2017-10-16 22:47:01
275
原创 Codeforces-Strange Game On Matrix(暴力直接写)
C. Strange Game On Matrixtime limit per test:1 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputIvan is playing a strange game.
2017-10-13 21:07:01
458
原创 Codeforces- Balanced Substring (思维)
B. Balanced Substringtime limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputYou are given a string s consisting only of
2017-10-13 20:48:44
1066
原创 Codeforces-191A-Dynasty Puzzles(简单dp)
A. Dynasty Puzzlestime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputThe ancient Berlanders believed that the longe
2017-10-10 18:44:47
1000
原创 Codeforce-191C-Fools and Roads (树链剖分 更新边权)
C. Fools and Roadstime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputThey say that Berland has exactly two problems
2017-10-10 18:39:05
450
原创 java的输入和输出
这学期学java,刚刚写了个小程序才发现输入输出都不会,看书+百度总算知道了,小小的总结一下;java输入字符串: Scanner in=new Scanner(System.in); String str=new String(); str=in.next();输入单个字符: Scanner in=new Scanner(System.
2017-09-29 16:44:20
400
原创 hihocoder-1586---Minimum(2017-icpc-网络赛-北京赛区)(线段树)
时间限制:1000ms单点时限:1000ms内存限制:256MB描述You are given a list of integers a0, a1, …, a2^k-1.You need to support two types of queries:1. Output Minx,y∈[l,r] {ax∙ay}.2. Let ax=y.输入T
2017-09-23 19:44:56
222
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人