题面: 传送门 A. Out of Sorts Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Keeping an eye on long term career possibilities beyond the farm, Bessie the cow has started learning algorithms from var…
题面: D. Lemonade Line Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   It's a hot summer day out on the farm, and Farmer John is serving lemonade to his N cows! All N cows (conveniently numbered…
题面: E. Family Tree Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Farmer John owns a family-run farm that has been passed down over several generations, with a herd of cows whose familial root…
题面: C. Team Tic Tac Toe Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Farmer John owns 26 cows, which by happenstance all have names starting with different letters of the alphabet, so Farmer…
题面: Problem F. Teleportation Input file: standard input Output file: standard output Time limit: 15 second Memory limit: 1024 megabytes   One of the farming chores Farmer John dislikes the most is hauling around lots of cow manure. In order to streamli…
题面: H. Mixing Milk Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Farming is competitive business – particularly milk production. Farmer John figures that if he doesn't innovate in his milk pro…
题面: A. The Bucket List Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Farmer John is considering a change in how he allocates buckets for milking his cows. He thinks this will ultimately allow…
题面: G. Back and Forth Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Farmer John has two milking barns, each of which has a large milk tank as well as a storage closet containing 10 buckets of…
题面: G. Snow Boots Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   It's winter on the farm, and that means snow! There are N tiles on the path from the farmhouse to the barn, conveniently number…
题面: C. Rest Stops Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Farmer John and his personal trainer Bessie are hiking up Mount Vancowver. For their purposes (and yours), the mountain can be…
题面: 传送门 B. Hoofball Input file: standard input Output file: standard output Time limit: 5 second Memory limit: 512 megabytes   In preparation for the upcoming hoofball tournament, Farmer John is drilling his N cows (conveniently numbered 1 . . . N, whe…
题面: E. Convention Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Cows from all over the world are arriving at the local airport to attend the convention and eat grass. Specifically, there are N…
题面: C. Mooyo Mooyo Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   With plenty of free time on their hands (or rather, hooves), the cows on Farmer John's farm often pass the time by playing vid…
题面: 传送门 B. Teamwork Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   For his favorite holiday, Farmer John wants to send presents to his friends. Since he isn't very good at wrapping presents, h…
题面: A. Taming the Herd Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes   Early in the morning, Farmer John woke up to the sound of splintering wood. It was the cows, and they were breaking out of…
2019 Multi-University Training Contest 2: 1010 Just Skip The Problem 自闭记 题意 多测.每次给你一个数\(n\),你可以同时问无数次,每次问的是一个数\(y_i\),你会得到的回答是\(x\&y_i\)是否为\(y_i\),问你问的最少的次数的种数\(\%1e6+3\),可以调换顺序 10min 得出数学方法 求\(n!\%1e6+3\). 50min 自闭 5min 写出裸暴力,优化10min,交一发TLE 30min 网上…
2019 Multi-University Training Contest 2 A. Another Chess Problem B. Beauty Of Unimodal Sequence 题意 给一个序列,求下标字典序最小和字典序最大的,先增后减的序列. 解体过程 比赛时首先不知道字典序最小LIS怎么求. 试图枚举分界点.[解体的开始] 公无渡河,公竟渡河? 活鱼在摸鱼,rdc在划水,sdcgvhgj在水深火热. 做法 考虑字典序最小的LIS怎么求? 这是个经典问题,预处理前缀LIS后缀L…
2019 Multi-University Training Contest 2 http://acm.hdu.edu.cn/contests/contest_show.php?cid=849 1005. Everything Is Generated In Equal Probability 考虑一个随机的排列的逆序对个数,显然对于两个数\(a,b\),他们位置是均匀排布的,也就是说有\(\frac{1}{2}\)的概率成为逆序对,并且是独立的. 所以一个长度为\(n\)的随机排列期望逆序对个…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6582 Path Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3747    Accepted Submission(s): 1075 Problem Description Years later, Jerry fell in love…
Welcome Party Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 875    Accepted Submission(s): 194 Problem Description The annual welcome party of the Department of Computer Science and Technolo…
http://codeforces.com/contest/325/problem/B B. Stadium and Games time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Daniel is organizing a football tournament. He has come up with the followin…
2019 Multi-University Training Contest 8 C. Acesrc and Good Numbers 题意 \(f(d,n)\) 表示 1 到 n 中,d 出现的次数.求小于等于 x 的最大的 \(n\) 满足 \(f(d,n)=n\). 做法 令 \(g(d,n)=f(d,n)-f(n)\),我们要求小于等于 \(x\) 极大的零点. 注意到 \(n>10^{12}\) 一定不存在零点. [比赛时注意到了这点] Big-Small 战法. 取 B 等于 \(1…
2019 Multi-University Training Contest 7 A. A + B = C 题意 给出 \(a,b,c\) 解方程 \(a10^x+b10^y=c10^z\). trick hash! B.Bracket Sequences on Tree unsolved 做法 树hash,统计答案 然后疯狂wa,直到特判了最后两组数据... 假的AC F. Final Exam upsolved 题意 参加考试,确保通过 \(k\) 道题目. 复盘 先是认定了,所有题都复习相…
2019 Multi-University Training Contest 1 A. Blank upsolved by F0_0H 题意 给序列染色,使得 \([l_i,r_i]\) 区间内恰出现 k 种颜色. 做法 DP,\(dp[i][x][y][z]\) 表示考虑前 \(i\) 个位置,剩下 3 种颜色最后出现的位置为 \(x,y,z\) 的方案数 \((i\geq x \geq y \geq z)\) 复盘 比赛开始就提出了这个做法,但很遗憾,过题效率太低,再加上觉得 \(O(n^4…
2019 Multi-University Training Contest 5 A. fraction upsolved 题意 输入 \(x,p\),输出最小的 \(b\) 使得 \(bx\%p<b\) 做法 \(bx-py<b\),即 \(b(x-1)<py\),即 \(\frac{b}{y}<\frac{p}{x-1}\) 另一方面,\(bx>py\),即 \(\frac{p}{x}<\frac{b}{y}\) GCD 即可. B. three arrays un…
2019 Multi-University Training Contest 6 http://acm.hdu.edu.cn/contests/contest_show.php?cid=853 1002. Nonsense Time 这题比较神奇...有一个结论是:一个长度为\(n\)的随机排列的最长上升子序列期望长度为\(O(\sqrt n)\). 那么我们考虑倒着删数,每次暴力处理出当前任意一个最长上升子序列,然后删除\(x\)的时候判一下\(x\)在不在当前的序列中,在就重新求一遍,否则不…
2019 Multi-University Training Contest 5 http://acm.hdu.edu.cn/contests/contest_show.php?cid=852 1004. Equation 把所有绝对值的零点排个序,然后解方程就好了. #include<bits/stdc++.h> using namespace std; // #define int long long void read(int &x) { x=0;int f=1;char ch=…
2019 Multi-University Training Contest 4 http://acm.hdu.edu.cn/contests/contest_show.php?cid=851 1001. AND Minimum Spanning Tree 如果\(n\not =2^x-1\)那么答案为\(0\),可以这么构造: 对于\(i\ne 2^x-1\)把\(i\)连向第一个比\(i\)小的\(j\),并且\(i\&j=0\). 否则\(i\)连向\(i+1\),把这两个点绑在一起就好了…
2019 Multi-University Training Contest 3 http://acm.hdu.edu.cn/contests/contest_show.php?cid=850 1004. Distribution of books 考虑二分答案,设当前二分出来的是\(x\). 设\(f_i\)表示前\(i\)个能分成最多的段数,使得每一段和都\(\leqslant x\). 转移显然,枚举一个\(j\),若\(s_i-s_j\leqslant x\)则转移,\(s_i\)表示前…
2019 Multi-University Training Contest 1 http://acm.hdu.edu.cn/contests/contest_show.php?cid=848 1001. Blank 这题我打比赛的时候想到正解了没敢写... 设\(f_{a,b,c,d}\)表示\(\{0,1,2,3\}​\)最后一次出现的位置排序之后的结果,那么每次枚举四种情况转移就好了. 复杂度\(O(Tn^4)\),由于转移的循环除了个\(4!\)的常数所以跑的很快. #include<b…