Preface ACM系列赛第一站,没有进前200还是很伤的. 主要是T2当时没写出来就GG了,后来看了下其实不是很难. 题目按照比赛时我们A的顺序讲,其实我都是被陈潇然大佬和ZWC带飞的. T1 Maximum Multiple 题目大意:给出一个数字\(n\),求三个数\(x,y,z\)满足\(x,y,z|n\)且\(x+y+z=n\).找出这样一组并使得\(xyz\)最大.有解就输出\(xyz\)的最大值,否则输出\(-1\). 大力猜结论,然后用ZWC当时写的一个暴力拍了下\(n\le2…
Preface 多校第二场,依靠罚时优势打到了校内的Rank 2 暴力分块碾标算系列 T4 Game 题目大意:在一个数集\([1,n]\)中两个人轮流选择其中的一个数,并从数集中删去这个数所有约数.先将所有数删去的人获胜. 比赛的时候手玩了\(n<=5\)的情况发现TM的怎么总是先手赢啊,然后就认为这是个先手必胜的游戏然而真的是这样 赛后听法老讲了真正的做法,分假定情况讨论: 假设这个状态先手必胜,那就让先手胜. 假设这个状态后手必胜,那么先手把\(1\)取走之后相当与把这个必败态扔给了后手(…
目录 Contest Info Solutions A. run D. monrey G. transform H. travel I. car J. farm Contest Info Practice Link Solved A B C D E F G H I J K 6/10 Ø . . Ø . . Ø Ø Ø Ø . O 在比赛中通过 Ø 赛后通过 ! 尝试了但是失败了 . 没有尝试 Solutions A. run 题意: 白云每次可以移动\(1\)米或者\(k\)米,询问移动的米数在…
Practice Link J. Different Integers 题意: 给出\(n\)个数,每次询问\((l_i, r_i)\),表示\(a_1, \cdots, a_i, a_j, \cdots, a_n\)中有多少个不同的数. 思路: 先分别离线求出\(a_1, \cdots a_i\)以及\(a_j, \cdots, a_n\)中有多少个不同的数. 再考虑有多少个数既在\([1, i]\)中也在\([j, n]\)中,再离线做一次. 考虑一个数第一次出现的时候,那么这个数下一次出现…
Practice Link A. gpa 题意: 有\(n\)门课程,每门课程的学分为\(s_i\),绩点为\(c_i\),要求最多删除\(k\)门课程,使得gpa最高. gpa计算方式如下: \[ \begin{eqnarray*} gpa = \frac{\sum s_ic_i}{\sum s_i} \end{eqnarray*} \] 思路: 首先删去的课程越多,gpa肯定不会变得更差. 所以我们肯定是删去\(k\)门课程. 考虑二分答案,check的时候要满足: \[ \begin{eq…
Practice Link J. Rikka with Nickname 题意: 给出\(n\)个字符串,要求依次合并两个串\(s, t\),满足将\(t\)合并到\(s\)中变成\(r\),使得\(s\)是\(r\)的前缀,并且\(t\)是\(r\)的一个子序列. 思路: 动态维护序列自动机,贪心插入即可. 代码: #include <bits/stdc++.h> using namespace std; #define N 1000010 char s[N], res[N]; int nx…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6319 Problem A. Ascending Rating Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 5943    Accepted Submission(s): 2004 Problem Description Before…
题目链接:2018 Multi-University Training Contest 2 6318 Swaps and Inversions 题意:sum=x*逆序个数+交换次数*y,使sum最小 思路:反复观察发现,如果有逆序对,那么就一定有相邻的逆序对,而且交换他们一定是合理的 进一步发现,逆序对的数量即是最大交换的次数,最后,ans=min(x,y)*逆序个数 使用分治排序求逆序对个数: #include<cstdio> #include<iostream> #includ…
比赛链接:2018 Multi-University Training Contest 1 6301 Distinct Values 题意:输出一个长度为n的序列,要求满足m个区间的数都不相同,并且字典序最小 思路:首先在草稿纸上模拟填充过程,从左往右填充,发现规律,有最小的数则取出最小的数.越过某些区间时,某些数字又可以重复使用利用set来维护这个待取出的集合 代码: #include<cstdio> #include<iostream> #include<set>…
Distinct Values Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2298    Accepted Submission(s): 740 Problem Description Chiaki has an array of n positive integers. You are told some facts about…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6341 Problem J. Let Sudoku Rotate Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1363    Accepted Submission(s): 717 Problem Description Sudoku i…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6342 Problem K. Expression in Memories Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2150    Accepted Submission(s): 772Special Judge Problem De…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6336 Problem E. Matrix from Arrays Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1711    Accepted Submission(s): 794 Problem Description Kazari…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6343 Problem L. Graph Theory Homework Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1536    Accepted Submission(s): 830 Problem Description Ther…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6333 Problem B. Harvest of Apples Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 4043    Accepted Submission(s): 1560 Problem Description There a…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6301 Distinct Values Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5312    Accepted Submission(s): 1823 Problem Description Chiaki has an array of…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6324 Problem F. Grab The Tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1234    Accepted Submission(s): 779 Problem Description Little Q and…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6300 Triangle Partition Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 2964    Accepted Submission(s): 1474Special Judge Problem Description Chia…
2018 Multi-University Training Contest 6 6362.oval-and-rectangle 题意就是椭圆里画内接矩形,问你矩形周长的期望. 比赛的时候推了公式,但是草稿纸丢了,直接看代码吧,和官方题解的公式有点不一样,但是有官方题解就差不多了. 注意:acos(-1.0)=asin(1.0)=π,其他的就没了,具体的怎么推的也懒得再推一遍了. 比赛的时候,我推的公式,队友算期望,忘了/b,一直不对,后来写上ans/=b;过了... 官方题解: 代码: //1…
2018 Multi-University Training Contest 5 6351.Beautiful Now 题意就是交换任意两个数字,问你交换k次之后的最小值和最大值. 官方题解: 哇塞,C++竟然自带全排列的函数,头文件为#include<algorithm> 全排列 next_permutation() 函数.随便传送两篇博客: 1.[算法]——全排列(Permutation)以及next_permutation 2.next_permutation 代码: //1002-63…
2018 Multi-University Training Contest 4 6333.Problem B. Harvest of Apples 题意很好懂,就是组合数求和. 官方题解: 我来叨叨一些东西. 这题肯定不能一个一个遍历求和,这样就上天了... 解释一下官方题解的意思. 为什么 sum(n,m)=2*sum(n-1,m)-c(n-1,m). 因为c(n,m)=c(n-1,m)+c(n-1,m-1),至于为什么成立,不懂的百度一下组合数和杨辉三角吧... sum(n,m)=c(n,…
2018 Multi-University Training Contest 3 6319.Problem A. Ascending Rating 题意就是给你长度为k的数列,如果数列长度k<n,就利用一个构造数列的方法构造数列使数列长度为n. 然后求定长区间为m的数列中最大值是几,最大值是第几次更新maxnum得到的,得到所有结果之后,用一个求和的公式将结果输出来,具体题意自己翻译. 滑窗问题,单调队列可以解决.关于滑窗问题和单调队列,具体的自行百度. 对于这个题,倒着遍历数列才能既找到最大值…
2018 Multi-University Training Contest 2 6312.Game 博弈,直接官方题解,懒了. 考虑将游戏变成初始时只有2~n,如果先手必胜的话,那么先手第一步按这样取就获胜了:如果后手必胜的话,那 么先手第一步取走1就获胜了.所以全输出Yes就行了. 代码: //1004-6312-博弈-真签到题 #include<iostream> #include<cstdio> #include<cstring> #include<alg…
暑假杭电多校第一场,这一场是贪心场,很多贪心的题目,但是自己太菜,姿势挫死了,把自己都写吐了... 2018 Multi-University Training Contest 1 HDU6298.Maximum Multiple 题目意思就是给你一个n,找出来三个数x,y,z, 使得n=x+y+z,而且x,y,z都是n的因数,并且x*y*z为最大值,让你输出来x*y*z的最大值.如果没有满足条件的情况就输出-1. 由1=1/2+1/3+1/6=1/3+1/3+1/3=1/2+1/4+1/4,所…
原题地址 Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1186    Accepted Submission(s): 433 Problem Description Let us define a sequence as below ⎧⎩⎨⎪⎪⎪⎪⎪⎪F1F2Fn===ABC⋅Fn−2+D⋅Fn−1+⌊Pn⌋ Y…
2018 Multi-University Training Contest 2) HDU 6311 Cover HDU 6312 Game HDU 6313 Hack It HDU 6314 Matrix HDU 6315 Naive Operations HDU 6318 Swaps and Inversions…
Buildings Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 185    Accepted Submission(s): 25 Problem Description Your current task is to make a ground plan for a residential building located i…
Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2390    Accepted Submission(s): 578 Problem Description Teacher Mai has a kingdom with the infinite area. He has n students guard…
2014 Multi-University Training Contest 9#11 Killing MonstersTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 562    Accepted Submission(s): 308 Problem Description Kingdom Rush is a popular TD…
2014 Multi-University Training Contest 9#6 Fast Matrix CalculationTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 424    Accepted Submission(s): 219 Problem Description One day, Alice and Bob…