C.Insertion Sort 题意:Q次询问,每次给出N,M,Mod,问你有多少种排列,满足前面M个数字排序之后整个序列的LIS>=N-1. 思路:我们把数字看成[1,M],[N-M+1,N]两个部分,假设是A和B.分几种情况即可. 我发现我好像想错了. https://blog.csdn.net/qq_23502651/article/details/84680151 另外:长度为N的排列的LIS为N-1的个数=(N-1)^2: 可以推出这个公式.F(i)=F(i-1)+i-1;  F(2…
A .Secret of Chocolate Poles 题意:有黑白两种木块,黑色有1,K两种长度: 白色只有1一种长度,问满足黑白黑...白黑形式,长度为L的组合种类. 思路:直接DP即可. #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; ; ll dp[][],ans; int main() { int L,K; sc…
B .Counting Inversion 题意:给定L,R,求这个区间的逆序对数之和.(L,R<1e15) 思路:一看这个范围就知道是数位DP. 只是维护的东西稍微多一点,需要记录后面的各种数字的个数cnt,以及逆序对和sum,以及出现了多少种后缀num. 那么枚举到当前位时,假设为i ,那么sum+=cnt[i+1]+cnt[i+2]+....cnt[9];  cnt[i]+=num; 可以参考CF1073E. #include<bits/stdc++.h> #define rep(…
学习了“叙利亚”这个单词:比较温和的一场:几何的板子eps太小了,坑了几发. A .Hello SCPC 2018! 题意:给定一个排列,问它是否满足,前面4个是有序的,而且前面4个比后面的都小. 思路:数据比较小,可以暴力,也可以用前面4个的最大值和后面的数字的最小值比较. #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; ; int a[maxn]; int ma…
这几天睡眠时间都不太够,室友晚上太会折腾了,感觉有点累,所以昨天的题解也没写,看晚上能不能补起来. B . Marbles 题意:给定N组数(xi,yi),玩家轮流操作,每次玩家可以选择其中一组对其操作,可以把它减去一个数,或同时减去一个数,当玩家操作后出现了(0,0)则胜利. 思路:注意这里是出现(0,0)胜,而不是全都是(0,0)胜,所以我们不能简单的球sg,最后异或得到答案. 但是我们转化一下,如果玩家面对的全是(1,2) 或(2,1),则他胜利,那么我们可以以这两个状态为起点得到sg函数…
A. Thickest Burger 大数 × 2 + 小数 #include <cstdio> #include <algorithm> using namespace std; int T; int A,B; int main() { scanf("%d",&T); for(int t=1; t<=T; t++) { scanf("%d%d",&A,&B); if(A<B) swap(A,B); pri…
传送门 F - Heron and His Triangle 直接打表找到规律\(f_i=4f_{i-1}+f_{i-2}\),然后大数预处理一下,对于询问直接输出就行. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #define se second #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() //#define…
Conquer a New Region Time Limit: 5 Seconds      Memory Limit: 32768 KB The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several road…
摘要 本文主要给出了2018 ACM-ICPC Asia Beijing Regional Contest的部分题解,意即熟悉区域赛题型,保持比赛感觉. Jin Yong’s Wukong Ranking List 题意 输入关系组数n和n组关系,每组关系是s1 > s2,问第一出现矛盾的组,或者没有矛盾就输出0. 解题思路 第一感觉是拓扑排序,未完,又写了一个深搜的传递闭包,1 A,和2018年河南省赛的题很像. 代码 #include <cstdio> #include <ma…
摘要 本文主要给出了2014-2015 ACM-ICPC, Asia Xian Regional Contest的部分题解,说明了每题的题意.解题思路和代码实现,意即熟悉区域赛比赛题型. Built with Qinghuai and Ari Factor 题意 判断是否是Q数列,只要数列中每个数均能够被3整除就是Q数列. 解题思路 需要特判一下0的情况. 代码 #include <cstdio> int main() { int T; int n; ; scanf("%d"…
摘要: 本文是The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛现场赛)的部分解题报告,给出了出题率较高的几道题的题解,希望熟悉区域赛的题型,进而对其他区域赛的准备有借鉴意义. Function and Function 题意 给出x和k,计算gk(x). 解题思路 通过观察发现,g函数经过一定次数的递推一定会在0和1之间变换,所以循环内加判断提前结束递推即可. 易错分析 注意计算f(0)返回的是1的问题,下面的写法避免了这种错误. 代码实现 #…
The 2018 ACM-ICPC Asia Qingdao Regional Contest 青岛总体来说只会3题 C #include<bits/stdc++.h> using namespace std; #define maxn 3000005 char a[maxn],b[maxn]; int c[maxn],ll[maxn],rr[maxn]; int main(){ int t; cin>>t; while(t--){ int n; scanf("%d&qu…
2017-2018 ACM-ICPC, Asia Tsukuba Regional Contest A Secret of Chocolate Poles 思路:暴力枚举黑巧克力的个数和厚黑巧克力的个数 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define s…
GCC Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 3867    Accepted Submission(s): 1272 Problem Description The GNU Compiler Collection (usually shortened to GCC) is a compiler system produc…
The 2014 ACM-ICPC Asia Mudanjiang Regional Contest A.Average Score B.Building Fire Stations C.Card Game D.Domination E.Excavator Contest F.Fiber-optic Network G.Garden and Sprinklers H.Hierarchical Notation I.Information Entropy J.Jacobi Pattern K.Kn…
WHUgirls Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 2068    Accepted Submission(s): 785 Problem Description There are many pretty girls in Wuhan University, and as we know, every girl lo…
The 2014 ACM-ICPC Asia Mudanjiang Regional Contest 题目链接 没去现场.做的网络同步赛.感觉还能够,搞了6题 A:这是签到题,对于A堆除掉.假设没剩余在减一.B堆直接除掉 + 1就能够了 B:二分贪心,二分长度.然后会发现本质上是在树上最长链上找两点,那么有二分出来的长度了,就从两端分别往里移动那么长,那两个位置就是放置位置.然后在推断一下就能够了 D:概率DP.首先知道放一个棋子.能够等价移动到右上角区域,那么就能够dp[x][y][k],表示…
Sum of divisors Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4318    Accepted Submission(s): 1382 Problem Description mmm is learning division, she's so proud of herself that she can figure…
2014-2015 ACM-ICPC, Asia Tokyo Regional Contest A B C D E F G H I J K O O O O   O O         A - Bit String Reordering 签到 #include <bits/stdc++.h> using namespace std; ; ]; int temp[N]; int put(int opt) { ] = {}; ; ; i <= m; i++) { int num = p[i];…
2019-2020 ICPC, Asia Jakarta Regional Contest (Online Mirror, ICPC Rules, Teams Preferred) easy: ACEGHK medium-easy: BJL medium: D ?????: I A. B. C. 对 \(R[],C[]\) 分别按奇偶性分段. 网! D. 考虑 check 一个串,枚举右走对应的前缀 pre,下走对应的后缀 suf. 把每行反串拼接中间连特殊字符,建 SA,能 match 上 p…
ACM-ICPC Asia Beijing Regional Contest 2018 Reproduction hihocoder1870~1879 A 签到,dfs 或者 floyd 都行. #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int,int> pii; typedef pair<LL,int>…
$$2017-2018\ ACM-ICPC,\ Asia\ Daejeon\ Regional\ Contest$$ \(A.Broadcast\ Stations\) \(B.Connect3\) BFS+哈希判重,哈希就用一个16位的三进制数表示即可 //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; function…
题目链接:https://codeforces.com/gym/102028/problem/C Lewis likes playing chess. Now he has n rooks on the chessboard with $n$ rows and $n$ columns. All rows of the chessboard are labelled with $1$ through $n$ from top to bottom. All columns of the chessb…
题目链接:http://codeforces.com/gym/101981/attachments The use of the triangle in the New Age practices seems to be very important as it represents the unholytrinity (Satan, the Antichrist and the False Prophet bringing mankind to the New World Order with…
题目链接:http://codeforces.com/gym/101981/attachments There are n heroes and m monsters living in an island. The monsters became very vicious these days,so the heroes decided to diminish the monsters in the island. However, the i-th hero can only kill on…
题目链接:http://codeforces.com/gym/101981/attachments 题意: 令 $mul(l,r) = \prod_{i=l}^{r}a_i$,且 $fac(l,r)$ 代表 $mul(l,r)$ 的不同素因子个数.求 $\sum_{i=1}^{n}\sum_{j=i}^{n}fac(i,j)$. InputThe first line contains one integer n (1 \le n \le 10^6) — the length of the se…
题目链接:http://codeforces.com/gym/101981/problem/K Your friend has made a computer video game called “Kangaroo Puzzle” and wants you to give it a try for him. As the name of this game indicates, there are some (at least 2) kangaroos stranded in a puzzle…
昨天00.35的CF,4点才上床,今天打的昏沉沉的,WA了无数发. 题目还是满漂亮的. 尚有几题待补. C .Complete Naebbirac's sequence 题意:给定N个数,他们在1到K之间,现在1到K的出现次数的不完全相同的,现在让你进行一次操作,使得他们相同. 操作是加一个数到集合: 或者删去一个数: 或同时一个数,删一个数. 思路:枚举三种情况即可. #include<bits/stdc++.h> #define ll long long #define rep(i,a,b…
A .Assignments 题意:给定距离D,以及N个飞机的速度Vi,单位时间耗油量Fi,总油量Ci.问有多少飞机可以到达目的地. 思路:即问多少飞机满足(Ci/Fi)*Vi>=D  ---->  Ci*Vi>=Fi*D; #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; int main() { int…
题意:Bob和Alice在一张有向无环图上移动,给定二者的起点,Bob先手.Bob的失败条件是不能移动或者与Alice相遇.两个人都采取最优策略,求Bob是否会赢 分析:银牌题.先确定所有的失败状态,然后根据这些反向状态BFS. 用\(dp[i][j][0or1]\)表示bob在i点,Alice在j点,当前移动的人是bob还是Alice的情况, bob是否必败. 首先能确定的是 \(dp[i][j][0] = dp[i][j][1] = 0\), 对于出度为0的点\(i\),\(dp[i][j]…