ACM
题集
Wolfgang-浮生
期许进步,与君共勉
展开
-
终章
作者文笔很烂,勿喷—随笔—今天(5.21这日子也挺特别 )做了个挺重要的决定,从集训队退出,说实话,自己感觉挺意外的,没有想到终结的这么快,原本以为自己怎么的也得坚持到省赛结束吧,哎,但是吧,学了大半年,算法啥的是真没怎么学明白,有些事果真没那么容易的坚持,更何况像acm这样考脑力,比坚持的高难度算法比赛呢!字数太少还得凑凑这篇博客,也算是为我的ACM栏画个句号吧!-初识-最初听到ACM,是在暑假,当时在百度一搜,国际,权威,心想:打不了打不了,我太笨了。后来去到学校,我们宿舍里来了个大二的学原创 2020-05-21 20:56:39 · 331 阅读 · 1 评论 -
SDNU 训练赛(5.13)
思路:看了网上大佬的一种解法,很简洁,就是说:我们要算最后一辆车车头通过停止线的时间,假设,前面的一辆车车对最后一辆车没有影响(前面车通过时间少于它),则时间为s0/v0,但是呢,我们不知道,所以我们就算一下每一辆车通过所用时间,取最大那个就是要求的解,注意对于往前的车辆,我们需要算上车长,(我们要求最后一辆车,前面的车长对于最后一辆来说也是距离)#include<bits/stdc++.h>using namespace std;typedef long long ll;const..原创 2020-05-17 20:00:57 · 187 阅读 · 0 评论 -
STL里的二分查找
本着遇到啥学啥的思路,这次碰见了二分查找,具体知识,引一位大佬的博客C++ STL中的Binary search(二分查找)P2249 【深基13.例1】查找题目描述输入 n(n≤106)n(n\le10^6)n(n≤106) 个不超过 10910^9109 的单调不减的(就是后面的数字不小于前面的数字)非负整数 a1,a2,…,ana_1,a_2,\dots,a_{n}a1,a2,…,an,然后进行 m(m≤105)m(m\le10^5)m(m≤105) 次询问。对于每次询问,给出一个整数 q原创 2020-05-11 20:31:19 · 345 阅读 · 0 评论 -
Problem I Inverted Deck
思维题:暴力做,先放一下题解说一下自己的想法,当时想复杂了,而且也不知道swap函数,反正就是子串的两边做标记,然后交换,和原来排好顺序的串作比较,看看试试相同,是输出下标,不是输出impossible。#include<bits/stdc++.h>using namespace std;const int maxx = 1e6+7;int a[maxx];int b[maxx];int main(){ int n; int count1=0,count2=0;//初始..原创 2020-05-09 20:54:51 · 245 阅读 · 0 评论 -
CodeForces - 593B B - Anton and Lines
B - Anton and LinesThe teacher gave Anton a large geometry homework, but he didn’t do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines def...原创 2020-04-28 21:47:34 · 176 阅读 · 0 评论 -
CodeForces - 888D Almost Identity Permutations
本题用到错排的知识点!组合数学思路:听SCX大佬讲的啊,题意至少有n-k个数是正好Pi=i;也就是说,我们只要枚举从2—k的数,看看他们有多少种错排的方案,在乘上k有多少种取法,最后加一(排序正常的那一种),就可解决。#include<bits/stdc++.h>using namespace std;typedef long long ll;ll ans[]={0,0,...原创 2020-04-20 20:30:45 · 181 阅读 · 0 评论 -
CodeForces - 676C C - Vasya and String
High school student Vasya got a string of length n as a birthday present. This string consists of letters ‘a’ and ‘b’ only. Vasya denotes beauty of the string as the maximum length of a substring (con...原创 2020-04-19 20:10:18 · 250 阅读 · 0 评论 -
Codeforces Round #633 (Div. 2) B Sorted Adjacent Differences
原题地址B. Sorted Adjacent Differencestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have array of n numbers a1,a2,…,an.Rearrange these num...原创 2020-04-13 20:22:25 · 166 阅读 · 0 评论 -
联盟周赛2019 ICPC Asia Taipei-Hsinchu Regional补题
分析:很经典的贪心问题,每次都取最小的!优先队列相关知识1,队列先进先出2,默认返回最大元素3#include<bits/stdc++.h>#include<queue> #include<vector>using namespace std;struct cmp1{ bool operator ()(int &a,int...原创 2020-04-07 21:28:37 · 326 阅读 · 0 评论 -
动态规划(3)
BAPC2019 E Efficient Exchange题目链接刚看到这题,以为是个贪心题,看到数据,我傻了,肯定超时啊,后来出来题解,才发现,这原来是道动态规划的题,唉,找递推公式是在不擅长。经过分析,我们可以知道,对于每一位从右往左开始,分析,先分析当为比如,对于83的,我们可以先对83分析,如果不进位,就是80+3,进了一位就相当于90-7;找最小,然后我们分析80和90,找出当前情...原创 2020-03-24 16:59:01 · 106 阅读 · 0 评论 -
CodeForces - 651B Beautiful Paintings
There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes happy every time he passes from a painting to a more beautiful one.We are allowe...原创 2020-03-22 22:29:44 · 310 阅读 · 0 评论 -
CodeForces - 651A Joysticks
A - JoysticksFriends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You c...原创 2020-03-22 20:26:00 · 197 阅读 · 1 评论 -
CodeForces 991D Bishwock
Bishwock is a chess figure that consists of three squares resembling an “L-bar”. This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:XX XX .X X.X. .X ...原创 2020-03-20 21:07:11 · 192 阅读 · 0 评论 -
动态规划(2)
题目链接:牛牛的DRB迷宫I思路:经典的dp走格子问题,通过分析,我们可以知道,每一步都是由上一步所决定的,即我们只需通过对上一步保存,对当前在处理就可求得最优,最后dp[n][m]便是所要求的所有的移动路线。通俗的来讲,对于最终到达的格子,我们需要看他的前一步会有多少条到达路线,以此类推,就可得原题解链接:2020牛客寒假算法基础集训营第三场#include<bits/std...原创 2020-03-18 20:42:31 · 125 阅读 · 0 评论 -
动态规划(1)
翻别人博客找到一道比较经典的dp问题题目链接:饮食问题题目描述Bessie 正在减肥,所以她规定每天不能吃超过 C (10 <= C <= 35,000)卡路里的食物。农民 John 在戏弄她,在她面前放了B (1 <= B <= 21) 捅食物。每桶内都有某个单位卡路里(范围:1…35,000)的食物(不一定相同)。Bessie 没有自控能力,一旦她开始吃一个桶中的...原创 2020-03-17 21:34:20 · 275 阅读 · 0 评论 -
栈及其应用(1)
以前总说自己会栈,可是一到紧要关头,啥也想不起来,说到底还是不熟的原因,没有自己的体会在其中,是不能熟练应用的!栈:栈是一种特殊的线性表,其插入操作和删除操作限定在表的一端进行,这一段被称为栈顶(top),相对的另一端则称为栈底(bottom),插入操作被称为压栈(push),删除操作则为推栈(pop)。栈的特点为先进后出。...原创 2020-03-13 16:42:26 · 130 阅读 · 0 评论 -
凉脾的比赛(补题)
#凉脾的比赛2017中东ICPC区域赛##ADRM Encryption is a new kind of encryption. Given an encrypted string (which we’ll call a DRM message), the decryption process involves three steps: Divide, Rotate and Merge. T...原创 2020-01-30 22:19:28 · 138 阅读 · 0 评论 -
凉心的比赛(一)补题
##F法法要穿过大门Two neighboring kingdoms decided to build a wall between them with some gates to enable the citizens to go from one kingdom to another. Each time a citizen passes through a gate, he has to ...原创 2020-01-13 21:58:05 · 203 阅读 · 0 评论 -
新生赛002-补题
新生赛002##J 新年快乐Frog Wa has many frogs, so he can hear GuaGuaGua every day. But one day a flappy bird ate his frogs, so Frog Wa decided to build a fence to protect his precious frogs. Frog Wa told you...原创 2020-01-04 19:15:43 · 232 阅读 · 0 评论 -
CodeForces 556B Case of Fake Numbers
Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp’s gears, puzzles that are as famous as the Rubik’s cube once was.I...原创 2020-03-10 21:30:48 · 142 阅读 · 0 评论 -
CodeForces 1000A Codehorses T-shirts
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either “M” or from 0 to 3...原创 2020-03-10 20:13:09 · 148 阅读 · 0 评论 -
CodeForces 998B Cutting
There are a lot of things which could be cut — trees, paper, “the rope”. In this problem you are going to cut a sequence of integers.There is a sequence of integers, which contains the equal number o...原创 2020-03-10 19:51:08 · 270 阅读 · 0 评论 -
二分法
##补题前,先要说一个算法,虽然上学期老师讲过,而且高中也学过,但总归还是自己写写好,这样以后用起来才顺心二分法转载(原网页)高中学过,二分法(Bisection method) 即一分为二的方法. 设[a,b]为R的闭区间. 逐次二分法就是造出如下的区间序列([an,bn]):a0=a,b0=b,且对任一自然数n,[an+1,bn+1]或者等于[an,cn],或者等于[cn,bn],其中cn...原创 2020-02-25 16:37:16 · 226 阅读 · 0 评论 -
VJ20200220补题
##A - Petya and Java CodeForces - 66ALittle Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations...原创 2020-02-21 16:06:06 · 179 阅读 · 0 评论 -
2020牛客寒假算法基础集训营第二场(补题)
#2020牛客寒假算法基础集训营第二场(写在前面的话:本次AC了2题,5555,菜的不行了,数论方面太需要提高了)##A 做游戏链接:A来源:牛客网题目描述牛牛和 牛可乐在玩石头剪刀布。众所周知,石头剪刀布的规则是这样的:在一局游戏中,双方各自出石头、剪刀、布其一。胜负关系如下:牛牛和 牛可乐进行了多轮游戏, 牛牛总共出了 A 次石头,B 次剪刀,C 次布;牛可乐总共出了 ...原创 2020-02-09 00:38:52 · 209 阅读 · 0 评论 -
2020牛客寒假算法基础集训营第一场(补题)
#牛客寒假集训营第一场(补题)(写在前面的话:本次比赛总共解出三道题,貌似是没太大难度那三道,欠缺的主要是字符串方面的,一看到就发蒙)##D hanayo和米饭链接:D来源:牛客网题目描述hanayo很喜欢吃米饭。有一天,她拿出了 个碗,第一个碗装了 粒米饭,第二个碗装了 粒米饭,以此类推,第 个碗装了 粒米饭。然而,爱搞恶作剧的rin把所有的碗的顺序打乱,并拿走了一个...原创 2020-02-06 12:35:00 · 338 阅读 · 0 评论 -
SDNU_ACM_ICPC_2020_Winter_Practice_4th(补题2020.2.2)
#山师寒假训练赛第四场(补题)##H-TriangleMr. Frog has n sticks, whose lengths are 1,2, 3⋯n respectively. Wallice is a bad man, so he does not want Mr. Frog to form a triangle with three of the sticks here. He dec...原创 2020-02-03 23:58:24 · 236 阅读 · 0 评论