链接: https://codeforces.com/gym/102394/problem/F 题意: Harbin, whose name was originally a Manchu word meaning "a place for drying fishing nets", grew from a small rural settlement on the Songhua River to become one of the largest cities in Northea…
题解: https://files.cnblogs.com/files/clrs97/HarbinEditorialV2.zip Code: A. Artful Paintings /* let x=f[n] f[i-1]-f[i]<=0 i -> i-1 0 f[i]-f[i-1]<=1 i-1 -> i 1 f[l-1]-f[r]<=-k r -> l-1 -k f[r]-f[l-1]<=-k+x l-1 -> r -k+x f[n]-f[0]<=…
链接: https://codeforces.com/gym/102394/problem/K 题意: DreamGrid is the keeper of n rabbits. Initially, the i-th (1≤i≤n) rabbit has a weight of wi. Every morning, DreamGrid gives the rabbits a carrot of weight 1 and the rabbits fight for the only carrot…
链接: https://codeforces.com/gym/102394/problem/J 题意: The great mathematician DreamGrid proposes a conjecture, which states that: Every positive integer can be expressed as the sum of a prime number and a composite number. DreamGrid can't justify his c…
链接: https://codeforces.com/gym/102394/problem/I 题意: DreamGrid has an interesting permutation of 1,2,-,n denoted by a1,a2,-,an. He generates three sequences f, g and h, all of length n, according to the permutation a in the way described below: For ea…
比赛链接:传送门 上半场5题,下半场疯狂挂机,然后又是差一题金,万年银首也太难受了. (每次银首都会想起前队友的灵魂拷问:你们队练习的时候进金区的次数多不多啊?) Problem J. Justifying the Conjecture 00:09 (+) Solved by Dancepted 签到.好像见过很多次了,经典水题.然后英语太差了,理解题意用了不少时间. 代码: #include <bits/stdc++.h> #define endl '\n' using namespace…
题目链接:https://codeforces.com/gym/102361/problem/F 题意 有 \(n\) 个点和 \(m\) 条边,每条边属于 \(0\) 或 \(1\) 个环,问去掉一些边使得图变为森林的方案个数. 题解 找出所有环的长度 \(c_i\),每个环可以去掉 \(1,2,\dots,c_i\) 条边,方案各为 \(C_{c_i}^1,C_{c_i}^2, \dots C_{c_i}^{c_i}\),即 \(2^{c_i} - 1\) . 所有环的去边方案共有 \(\p…
A: Super_palindrome 题面:给出一个字符串,求改变最少的字符个数使得这个串所有长度为奇数的子串都是回文串 思路:显然,这个字符串肯定要改成所有奇数位相同并且所有偶数位相同 那统计一下奇数位上哪个字符出现的个数最多,偶数位上哪个字符出现的个数最多 答案就是 n 减去它们 #include <bits/stdc++.h> using namespace std; #define N 110 #define INF 0x3f3f3f3f int t; char s[N]; ]; ]…
传送门 D - Decimal 题意: 询问\(\frac{1}{n}\)是否为有限小数. 思路: 拆质因子,看是不是只包含2和5即可,否则除不尽. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #define se second #define sz(x) (int)(x).size() using namespace std; typedef long long ll; typedef pair<…
Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 429    Accepted Submission(s): 244 Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a…
Game Rooms Time Limit: 4000/4000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit Status Your company has just constructed a new skyscraper, but you just noticed a terrible problem: there is only space to put one game room on each…
2016 China Collegiate Programming Contest Final Table of Contents 2016 China Collegiate Programming Contest FinalProblem A:Problem J:Problem H: Problem A: 题意:喝咖啡,每三杯就又可以有免费一杯,求最少花费: 分析:贪心: #include <bits/stdc++.h> using namespace std; const int inf…
2018 China Collegiate Programming Contest Final (CCPC-Final 2018)-K - Mr. Panda and Kakin-中国剩余定理+同余定理 [Problem Description] \[ 求解x^{2^{30}+3}=c\pmod n \] 其中\(n=p\cdot q\),\(p\)为小于\(x\)的最大素数,\(q\)为大于\(x\)的最小素数,\(x\)为\([10^5,10^9]\)内随机选择的数.\(0< c<n\).…
Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roads. The funny part is: each road is open and closed periodically. Each road is associate with two integers (a, b), that means the road will be open fo…
The Battle of Chibi Time Limit: 6000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 591    Accepted Submission(s): 192 Problem Description Cao Cao made up a big army and was going to invade the whole South Chin…
Huatuo's Medicine Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 398    Accepted Submission(s): 272 Problem Description Huatuo was a famous doctor. He use identical bottles to carry the medicin…
Game Rooms Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 305    Accepted Submission(s): 84 Problem Description Your company has just constructed a new skyscraper, but you just noticed a terrib…
Sudoku Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 596    Accepted Submission(s): 216 Problem Description Yi Sima was one of the best counselors of Cao Cao. He likes to play a funny game him…
Ancient Go Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 577    Accepted Submission(s): 213 Problem Description Yu Zhou likes to play Go with Su Lu. From the historical research, we found that…
Ba Gua Zhen Time Limit: 6000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 304    Accepted Submission(s): 93 Problem Description During the Three-Kingdom period, there was a general named Xun Lu who belonged t…
Pick The Sticks Time Limit: 15000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 593    Accepted Submission(s): 193 Problem Description The story happened long long ago. One day, Cao Cao made a special order c…
Problem A. Mischievous Problem Setter 签到. #include <bits/stdc++.h> using namespace std; #define ll long long #define N 100010 #define pii pair <int, int> #define x first #define y second int t, n, m; pii a[N]; int main() { scanf("%d"…
题解右转队伍wiki https://acm.ecnu.edu.cn/wiki/index.php?title=2017_China_Collegiate_Programming_Contest_Final_(CCPC_2017)…
比赛链接:传送门 前期大顺风,2:30金区中游.后期开题乏力,掉到银尾.4:59绝杀I,但罚时太高卡在银首. Problem A - Dogs and Cages 00:09:45 (+) Solved by Dancepted 算了半天发现就是n-1,被队友喷死,差点气哭. Problem E - Evil Forest 00:16:54 (+) Solved by xk xk大喊签到,就过了. 代码: #include <iostream> #include <cmath> #…
比赛链接:传送门 跌跌撞撞6题摸银. 封榜后两题,把手上的题做完了还算舒服.就是罚时有点高. 开出了一道奇奇怪怪的题(K),然后ccpcf银应该比区域赛银要难吧,反正很开心qwq. Problem A. Mischievous Problem Setter 00:14 (-2) Solved by Dancepted 良心签到题.WA2吃乳猪. 代码: #include <iostream> #include <cmath> #include <map> #includ…
A:签到题,正常模拟即可. #include<bits/stdc++.h> using namespace std; ; struct node{ int id, time; }; node a[maxn]; bool cmp(const node &a, const node &b){ if(a.id^b.id) return a.id < b.id; else return a.time < b.time; } int main() { std::ios::sy…
当时比赛时超时了,那时没学过树状数组,也不知道啥叫离散化(貌似好像现在也不懂).百度百科--离散化,把无限空间中无限的个体映射到有限的空间中去,以此提高算法的时空效率. 这道题是dp题,离散化和树状数组用来优化,状态转移方程:dp[i][j]=sum(dp[i-1][k])----k需要满足a[j]>a[k]&&k<j; i表示所要选的个数,j表示以第a[j]个数结尾所有的符合要求的递增串的个数,最后答案就是sum(dp[n][j])--1<=j<=p;n 为要选的…
http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=392 E:Sequence in the Pocket 思路:从后往前判断在不在应该在的位置,如果不在则需要放到最前面,通过cnt控制当前的数 比较 排好序的数组的数. code: #include<bits/stdc++.h> using namespace std; #define LL long long #define INF 2000000000 #…
F. Fixing Banners time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Harbin, whose name was originally a Manchu word meaning "a place for drying fishing nets", grew from a small rural set…
比赛链接:传送门 本场我们队过的题感觉算法都挺简单的,不知道为啥做的时候感觉没有很顺利. 封榜后7题,罚时1015.第一次模拟赛金,虽然是北欧的区域赛,但还是有点开心的. Problem B Best Relay Team 00:49 (+2) Solved by xk 排序后简单模拟一下题意即可. xk说他要背个锅. 代码: #include <iostream> #include <cmath> #include <map> #include <algorit…