题目集
Gverzh
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #757 (Div. 2) - D1. Divan and Kostomuksha (easy version)
Codeforces Round #757 (Div. 2) - D1. Divan and Kostomuksha (easy version)原创 2021-11-28 16:30:22 · 418 阅读 · 0 评论 -
Codeforces Round #757 (Div. 2) - C. Divan and bitwise operations
Codeforces Round #757 (Div. 2) - C. Divan and bitwise operations原创 2021-11-28 01:10:57 · 638 阅读 · 0 评论 -
Gym - 101484E -- Double Fence(凸包)
Gym - 101484E – Double Fence(凸包)原题链接:https://codeforces.com/gym/101484/problem/E原创 2021-10-28 10:24:56 · 90 阅读 · 0 评论 -
Can you answer these queries?(线段树)
Can you answer these queries?原题链接:https://acm.hdu.edu.cn/showproblem.php?pid=4027题意:将区间内的数开根号,求区间和Code:加了一个特判:全为1的区间不需要修改#include <iostream>#include <algorithm>#include <cstring>#include <math.h>#include <stdio.h>原创 2021-09-29 16:29:56 · 54 阅读 · 0 评论 -
Luck and Love(线段树)
Luck and Love题目链接:https://acm.hdu.edu.cn/showproblem.php?pid=1823Code树套树#include <iostream>#include <algorithm>#include <cstring>#include <math.h>#include <stdio.h>#include <string.h>#include <vector>us原创 2021-09-28 15:40:48 · 99 阅读 · 0 评论 -
Tunnel Warfare(线段树)
Tunnel Warfare题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1540贴一个题解:https://blog.csdn.net/chudongfang2015/article/details/52133243Code:单点修改 + 区间查询(数组可以a,结构体MLE。。)#include <iostream>#include <algorithm>#include <cstring>#includ原创 2021-09-27 19:59:52 · 84 阅读 · 0 评论 -
A Simple Problem with Integers (线段树)
A Simple Problem with Integers链接:http://poj.org/problem?id=3468维护区间和部分数据input 120 1021 33 39 30 -26 -37 32 18 -32 36 -28 -34 31 8 18 25 36 6 -34 2C 5 13 -19Q 19 20 C 11 12 17Q 11 20 C 14 18 -15C 7 9 -10Q 18 20 Q 19 20 Q 6 15 C 7 10 -8out原创 2021-09-24 10:56:58 · 114 阅读 · 0 评论 -
codeforces#527 - C. Glass Carving (线段树)
codeforces527 - C. Glass Carving链接:https://codeforces.com/problemset/problem/527/C题解链接:https://blog.csdn.net/scau_cdx/article/details/89893591https://www.cnblogs.com/shuaihui520/p/9835973.html求最长连续0区间Code:#include <algorithm>#include <ios原创 2021-09-22 17:38:20 · 138 阅读 · 0 评论 -
Codeforces Round #742 (Div. 2) -- D. Expression Evaluation Error
D. Expression Evaluation Error链接:https://codeforces.com/contest/1567/problem/D题意:求一组n个数,10进制下其数组的和是s,并且数组的和在11进制下最大Code:尽量保证每一高位上的数最大#include <algorithm>#include <iostream>#include <math.h>#include <vector>#include <st原创 2021-09-14 09:12:00 · 61 阅读 · 0 评论 -
Codeforces Round #742 (Div. 2) -- C. Carrying Conundrum
C. Carrying Conundrum链接:https://codeforces.com/contest/1567/problem/C题意:给定一个n,n为 加法运算时,进位进下一位所得出的数求有 数对(a,b)进行 题目构造的加法运算得到n的 数对个数当 a != b 时,数对(a,b) 与 (b,a) 不同输入:t 组数据 每组数据给定一个 n题解:暴力每一位上的数x 可以看作是 x+10-1(加法运算之前的数) 10是进下一位 1是去掉上一进位,如果最后得数在(0,18)之间原创 2021-09-13 21:04:38 · 75 阅读 · 0 评论 -
-- - B(AtCoder - arc112_b)
– - B(AtCoder - arc112_b)链接:VJ链接https://vjudge.ppsucxtt.cn/problem/AtCoder-arc112_b原链接:https://atcoder.jp/contests/arc112/tasks/arc112_b题意:数B 在花费<=C元时 最多能走到的数的个数花费1元 B 走到 -B花费2元 B 走到 B-1规律画出图来会比较好想C足够大时,只需要考虑左边界与右边界,中间的数都能走到只需要讨论 C正好满足 B 走到原创 2021-09-09 11:43:36 · 161 阅读 · 0 评论 -
Base n(AtCoder - abc192_d)
Base n (AtCoder - abc192_d)链接:VJ链接: https://vjudge.ppsucxtt.cn/problem/AtCoder-abc192_d原链接:https://atcoder.jp/contests/abc192/tasks/abc192_d?题意字符串长度为60的x 1e18的M求x在n进制下 转为10进制后小于等于 M 的进制个数数据卡点数据卡点:1. n的取值范围2. 高精度:long long - unsigned long long -原创 2021-09-08 17:06:04 · 191 阅读 · 0 评论 -
Train(AtCoder - abc192_e)
Train(AtCoder - abc192_e)vj 链接:https://vjudge.ppsucxtt.cn/problem/AtCoder-abc192_e原链接:https://atcoder.jp/contests/abc192/tasks/abc192_e?code :#include <algorithm>#include <iostream>#include <math.h>#include <vector>#include原创 2021-09-08 15:24:43 · 141 阅读 · 0 评论 -
Palindrome Function(hdu - 6156)
Palindrome Function(hdu - 6156)题目链接:Palindrome Function(hdu - 6156)题意:f (n,k) = k(在k进制下为回文串)否则为1 (2 <= k <= 36)找出区间为(L, R)的数i , 在区间为(l, r) 的进制j, 函数f(i, j)的和 (L, R <=1e9)已知:回文串:由前半部分可知后半部分,构造回文串只需遍历1e5 (10进制条件下)(其余进制需要扩大范围,在代码注释里有提)计算:遍历进制,求原创 2021-09-06 21:32:24 · 144 阅读 · 0 评论 -
树状数组 - YJJ‘s Salesman
POJ6447 - YJJ’s Salesman题目链接:https://acm.hdu.edu.cn/showproblem.php?pid=6447题意:求从(0,0)走到(x,y)能获得金钱的最大值路径可以是右,下,右下,即可以从(x,y)到(x+1,y),(x,y+1),(x+1,y+1)当且仅当从(x,y)到(x+1,y+1)时可以获得金钱思路:树状数组以(0,0)为左上角,即求以(x,y)为右下角的左上区域的和的最大值,因此可以用树状数组存从(0,0)到(c ,y)区域原创 2021-08-26 09:06:13 · 94 阅读 · 0 评论 -
例题 - 最近公共祖先 - 离线算法
洛谷P3379 【模板】最近公共祖先(LCA)模板题#include <iostream>#include <algorithm>#include <cstring>#include <math.h>#include <stdio.h>using namespace std;// LCA 最近公共祖先 倍增const int N = 5e5+10;int n ,m ,s;int e[2*N], pr[2*N], h[2*N原创 2021-08-21 20:36:31 · 110 阅读 · 0 评论 -
POJ1470 - Closest Common Ancestors - (LCA tarjan)
POJ1470 - Closest Common Ancestors链接 Closest Common Ancestors贴一个Tarjan算法的讲解:CSDN - creatorx的博客离线Tarjan :利用并查集的合并。查询两个结点的公共祖先先遍历树的 子节点 再将 根节点合并到父节点 ,其实就是理解 合并是一个树一个树进行的合并遍历字节点的过程就是 当前以这个根节点为分叉点 找子节点,当要查询的两个子节点都遍历到时 共同祖先就是这个根节点#include <iostream&原创 2021-08-21 20:32:54 · 93 阅读 · 0 评论 -
SPOJ 694 - Distinct Substrings -- 后缀数组(不相同的子串个数)
SPOJ 694 - Distinct Substrings原题链接:https://www.spoj.com/problems/DISUBSTR/VJ链接:https://vjudge.ppsucxtt.cn/problem/SPOJ-DISUBSTR题意求不相同的子串个数思路利用hei[]数组字符串的所有子串就是 每一个后缀的所有前缀每一个后缀的子串个数就是 子串的长度排行 i 的后缀与前面相同的子串个数就是 hei[i]所以 排行i的后缀不相同的子串个数就是 n - sa[i]原创 2021-08-14 20:10:51 · 80 阅读 · 0 评论 -
POJ 3261 - Milk Patterns -- 后缀数组(可重叠的 k次最长重复子串)
POJ3261 - Milk PatternsMilk Patterns 链接题意求可重叠的出现k次的最长重复子串思路后缀数组 + 二分1. 后缀数组求hei[]数组2. 二分 重复子串 的长度 ,hei[]数组根据 二分的长度 分组,判断每组的个数是否大于等于k代码本题是对数组操作因此,需要注意swap函数#include <iostream>#include <algorithm>#include <cstring>#include &原创 2021-08-14 16:09:50 · 73 阅读 · 0 评论 -
二分模板 - Acwing789 数的范围
Acwing789 数的范围https://www.acwing.com/problem/content/791/ #include <bits/stdc++.h>using namespace std;const int N = 1e5+10;int x[N];int main(){ int n,q; cin>>n>>q; for(int i = 0; i < n; i++) cin>>x[i]; w原创 2021-08-14 09:22:16 · 50 阅读 · 0 评论 -
后缀数组模板 - 洛谷P3809
洛谷 P3809链接:https://www.luogu.com.cn/problem/P3809#include <iostream>#include <algorithm>#include <cstring>#include <stdio.h>#include <math.h>#define mk make_pairusing namespace std;const int N = 1e6+10;int sa[N], tp原创 2021-08-14 08:43:41 · 71 阅读 · 0 评论 -
Codeforces Round #736 (Div. 2) - 代码
Codeforces Round #736 Div. 2A - Gregor and CryptographyB - Gregor and the Pawn GameC - Web of LiesA - Gregor and Cryptography#include <bits/stdc++.h>using namespace std; const int N = 5e5+10; int main(){ int t; cin>>t; while(原创 2021-08-06 11:08:59 · 119 阅读 · 0 评论 -
Median - 21杭电多校(6)
Media - 2021“MINIEYE杯”中国大学生算法设计超级联赛(6)链接 :https://acm.hdu.edu.cn/showproblem.php?pid=7029Problem DescriptionMr. docriz has n different integers 1,2,⋯,n. He wants to divide these numbers into m disjoint sets so that the median of the j-th set is bj. Plea原创 2021-08-06 10:47:58 · 343 阅读 · 3 评论 -
SDUT 2021 Winter Individual Contest - E // B、C、D、M
B - Pursuing the Happiness题目链接:https://vjudge.net/contest/418211#problem/BMike wants to find a substring «happiness» in the string s, but Constantine cannot allow this and decidedto hinder him. He is planning to swap two characters on two different posit原创 2021-01-20 21:40:59 · 229 阅读 · 1 评论 -
Gym - 101063K - Dire, Dire Docks - 2021-03-09
https://vjudge.z180.cn/contest/425096#problem/Khttps://codeforces.com/gym/101063/problem/KHalf a century after the Mars arrival by GEMA, we are finally here. The mission is finally starting to build artificial rivers on mars.That is possibly the most im原创 2021-03-12 21:20:44 · 134 阅读 · 0 评论 -
SDUT 2021 Spring Team Contest--- 4 ~ Basic Data Structure ~ HDU - 5929
https://vjudge.z180.cn/problem/HDU-5929Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack:PUSH x: put x on the top of the stack, x must be 0 or 1.POP: throw the element which is on the top o原创 2021-03-15 20:48:29 · 123 阅读 · 0 评论 -
01背包问题---vj HDU-3466---Proud Merchants
Proud MerchantsProblem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still very proud even if their nation hasn’t been so原创 2020-11-20 21:50:24 · 121 阅读 · 0 评论 -
完全背包---Piggy Bank
Piggy-Bank // HDU - 1114oj原题链接HDU原题链接大神的题解!!!Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple. When原创 2020-12-04 21:11:33 · 122 阅读 · 0 评论 -
图论--病毒扩散--oj4783
病毒扩散原题链接!跪谢大佬修改代码!!!大佬万岁!!!Description2019-ncov的突然出现扰乱了人们的日常生活,它具有极强的传染性,可以快速的在人群中扩散,现在研究人员正在模拟其在人群中的扩散情况.在一个n*m矩阵所示的人群中,*为普通人,#为佩戴口罩的人,@为病毒携带者,已知每秒每位病毒携带者会将病毒传染给相邻八个方向的未戴口罩的普通人。请问 x 秒后会有多少名传染者(初始为第0秒)?Input第一行输入空格分隔的三个数n,m,x代表n行,m列的空间,x秒(n,m<=10原创 2020-12-01 01:13:44 · 272 阅读 · 0 评论 -
SDUT 2020 Autumn Team Contest---45(2) //组队赛补题
J - Maximize Diversity of an ArrayYou are given an array A. The diversity of the array A is defined as number of pairs i,j,i<j such that Ai≠Aj.You want to maximize the diversity of the array. For that, you are allowed to make at most K operations on i原创 2020-12-21 22:40:15 · 137 阅读 · 0 评论 -
SDUT 2020 Autumn Team Contest---31(for 18&&19)--- C - Car
【C++】向上、向下取整函数C/C++ 取整函数ceil(),floor(),向上取整,向下取整CarRuins is driving a car to participating in a programming contest. As on a very tight schedule, he will drive the car without any slow down, so the speed of the car is non-decrease real number.Of course原创 2020-11-07 01:23:46 · 63124 阅读 · 0 评论 -
SDUT 2021 Winter Individual Contest - M --- 2021 / 2 / 21
SDUT 2021 Winter Individual Contest - MA - Block Gamehttps://vjudge.net/problem/Kattis-blockgame2题意:有两堆物品 一次只能拿较少一堆物品的n倍甲 乙 两人轮流拿,甲先拿,正好拿完一堆的人赢,输出甲的结果思路A B 两堆物品 ( 取 A > B)A=B || A%B==0 ,甲必赢B*2 > A > B : ( A , B ) - > ( A - B ,原创 2021-02-22 20:50:33 · 226 阅读 · 0 评论 -
字典树---迷之好奇
迷之好奇DescriptionFF得到了一个有n个数字的集合。不要问我为什么,有钱,任性。FF很好奇的想知道,对于数字x,集合中有多少个数字可以在x前面添加任意数字得到。如,x = 123,则在x前面添加数字可以得到4123,5123等。Input多组输入。对于每组数据首先输入n(1<= n <= 100000)。接下来n行。每行一个数字y(1 <= y <= 100000)代表集合中的元素。接下来一行输入m(1 <= m <= 100000),代表有原创 2020-11-04 21:27:30 · 160 阅读 · 0 评论