ACM集训
文章平均质量分 86
registor11
一个心不死的技术控
展开
-
第十一届山东省省赛题解BCDFGHJM
题目B_Build Roads题意:给定一个N个点的无向完全图,iii和jjj之前的边权是gcd(ai,aj)gcd(a_i,a_j)gcd(ai,aj),保证数组值随机,求MST(最小生成树)。数据范围:n,L,R,seed(2≤n≤2×105,1≤L≤R≤2×105,1≤seed≤1018)n,L,R,seed (2 \le n \le 2 \times 10^5, 1 \le L \le R \le 2 \times 10^5, 1 \le seed \le 10^{18})n,L,R,se原创 2022-05-18 18:48:00 · 395 阅读 · 0 评论 -
CodeForces-贪心训练
题目Integers Shop [CodeForces - 1621B]The integers shop sells nn segments. The i-th of them contains all integers from lil_ili to rir_iri and costs cic_ici coins.Tomorrow Vasya will go to this shop and will buy some segments there. He will get all inte原创 2022-05-06 11:46:22 · 264 阅读 · 0 评论 -
2022天梯L1-L2题解
总结整个天梯赛的赛场体验一般,最开始看的L2-1,也确实因为题目描述过长,失去耐心,立马转至L1开始作答。从第1题到第10题均未卡题,毕竟知识点都差不多门清。但是在第11题,L2-3开始便卡死了,赛场上想了很多,在补题时发现,思路是正确的,但是有些细节也确实没有处理好。同时在WA了三次后,依旧在死磕它,没有去尝试第四题,qwq.主要第四题题目看完也是蒙圈状态,就选择继续做2-3.整体题目不难,就像陈越姥姥在知乎说的,知识没有变,只是出题风格年轻化了。(直接就是阅读理解)。这里给出L1的思路,L2的AC代原创 2022-05-03 18:10:38 · 1293 阅读 · 0 评论 -
AtCoder 248_CDE
C_Dice Sum题目How many integer sequences of length N,A=(A1,…,AN)N, A=(A_1, \ldots, A_N)N,A=(A1,…,AN), satisfy all of the conditions below?1≤Ai≤M(1≤i≤N)1\le A_i \le M(1 \le i \le N)1≤Ai≤M(1≤i≤N)∑i=1NAi≤K\displaystyle\sum _{i=1}^N A_i \leq Ki=1∑NAi≤K原创 2022-05-03 00:14:35 · 547 阅读 · 0 评论 -
组合数求解总结
组合数意图计算CabC^b_aCab的值,此处列举三种常用方法。简单组合计数a,ba,ba,b很小(小于等于3000左右),采用递推的方法,根据公式Cab=Ca−1b−1+Ca−1bC^b_a=C^{b-1}_{a-1}+ C^{b}_{a-1}Cab=Ca−1b−1+Ca−1b,用二维数组C[i][j]C[i][j]C[i][j]表示CijC^j_iCij。#include<iostream>#define N 2010using namespace std;typed原创 2022-03-23 15:33:52 · 622 阅读 · 0 评论 -
树状数组原理及实现
应用树状数组又称二进制索引树,通过二进制分解划分区间。多用于高效的计算数列的前缀和,在查询前缀和与点更新操作上,其时间复杂度均可在O(log n)下完成。原理树状数组引用了分级管理制度且设置了管理小组,管理小组中的每一个成员都管理一个或多个的连续元素。通过下标进行对数组中连续元素的管理。其逻辑结构表现如图所示:其中数组a代表着数组中的原始数据,数组c表示着前n个元素的和。即c为数组的前缀和。同样,对于每个数组c中的元素值为图中箭头相连的数据之和。前缀和查询例如计算数组中前8个元素的和,即c[原创 2022-03-19 17:28:26 · 994 阅读 · 0 评论 -
POJ 3321 Apple Tree【树状数组】
题目There is an apple tree outside of kaka’s house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.The tree has N forks which are connected by branches. Kaka numbers t原创 2022-03-19 17:21:38 · 1072 阅读 · 0 评论 -
POJ 3067 Japan【树状数组】
题目Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 1000). K superhighways will be build. Cities on原创 2022-03-19 17:01:59 · 174 阅读 · 0 评论 -
POJ 2352 Stars【树状数组】
题目Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given star. Astronomers want原创 2022-03-19 16:31:18 · 484 阅读 · 0 评论 -
逆元求解方法
定义当ab=c\frac{a}{b}=cba=c时,可以看成是a×b−1=ca\times b^{-1}=ca×b−1=c。令x=b−1x=b^{-1}x=b−1,即有a×x=ca \times x=ca×x=c,原创 2022-03-23 14:11:47 · 1198 阅读 · 0 评论 -
HDU 1007 Quoit Design[最小距离]
题目Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.In the field of Cyberground, the position of each toy is fixed, and the ring is carefully designed so it can原创 2022-01-26 00:28:08 · 192 阅读 · 0 评论 -
POJ 2048 Anagram Groups[字符串哈希与排序]
题目World-renowned Prof. A. N. Agram’s current research deals with large anagram groups. He has just found a new application for his theory on the distribution of characters in English language texts. Given such a text, you are to find the largest anagram原创 2022-01-24 23:28:05 · 258 阅读 · 0 评论 -
POJ 2443 Set Operation [bitset]
题目You are given N sets, the i-th set (represent by S(i)) have C(i) element (Here “set” isn’t entirely the same as the “set” defined in mathematics, and a set may contain two same element). Every element in a set is represented by a positive number from 1原创 2022-01-22 01:00:49 · 648 阅读 · 0 评论 -
POJ 1192 最优连通子集
题目众所周知,我们可以通过直角坐标系把平面上的任何一个点P用一个有序数对(x, y)来唯一表示,如果x, y都是整数,我们就把点P称为整点,否则点P称为非整点。我们把平面上所有整点构成的集合记为W。定义1 两个整点P1(x1, y1), P2(x2, y2),若|x1-x2| + |y1-y2| = 1,则称P1, P2相邻,记作P1~P2,否则称P1, P2不相邻。定义 2 设点集S是W的一个有限子集,即S = {P1, P2,…, Pn}(n >= 1),其中Pi(1 <= i &l原创 2021-11-22 23:26:23 · 150 阅读 · 0 评论 -
HDU 5698 瞬间移动
题目有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第n行第m列的格子有几种方案,答案对1000000007取模。Input多组测试数据。两个整数n,m(2≤n,m≤100000)n,m(2≤n,m≤100000)n,m(2≤n,m≤100000)Output一个整数表示答案Sample Input4 5Sample Output10题目分析采用递推的方法,可以发现横原创 2021-11-21 22:02:11 · 393 阅读 · 0 评论 -
POJ 1845 Sumdiv
题目Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).大意给定两个自然数A,B。找出ABA^BAB的所有因子之和,最后结果对9901取模。InputThe only line contains the two natural numbers A原创 2021-11-21 21:06:37 · 245 阅读 · 0 评论