L. Sticky Situation While on summer camp, you are playing a game of hide-and-seek in the forest. You need to designate a “safe zone”, where, if the players manage to sneak there without being detected,they beat the seeker. It is therefore of utmost i…
Solved A Gym 100488A Yet Another Goat in the Garden   B Gym 100488B Impossible to Guess Solved C Gym 100488C Lost Temple Solved D Gym 100488D Toy Soldiers Solved E Gym 100488E Just Change a Word Solved F Gym 100488F Two Envelopes Solved G Gym 100488G…
[题解]CF1056F Write the Contest(三分+贪心+DP) 最优化问题的三个解决方法都套在一个题里了,真牛逼 最优解应该是怎样的,一定存在一种最优解是先完成了耗时长的任务再干别的(不干白不干啊),所以我们按照耗时先排序. 假设你最优解是去事件\(e_1,e_2,e_3,e_4\),你可以在规定时间里干完,那么你如果按照耗时从大往小干也一定可以干完. 好像只能找到"按照耗时从大往小干"一种钦定方法使得所有方案可以归纳到这种情况 考虑最终耗时是怎样的:\(t\)表示练习…
I. Older Brother Your older brother is an amateur mathematician with lots of experience. However, his memory is very bad. He recently got interested in linear algebra over finite fields, but he does not remember exactly which finite fields exist. For…
题意简述:在平面上有一个坐标 \((x_c,y_c)\) 和半径 \(r\) 都是整数的圆 \((1\leq r_c\leq \sqrt{x_c^2+y_c^2}-1)\),你可以询问不超过 \(60\) 次一个从原点出发的射线 \((0,0)\to (x,y)\) 与圆的距离(若相交,则返回 \(0\)).确定圆的坐标和半径. \(|x_c|,|y_c|,r\le 10^5\),你需要保证 \(|x|,|y|\leq 10^6\). 一道有趣的计算几何,思维含量并不是很高(*3300 有点离谱…
题目链接:http://codeforces.com/gym/101149/problem/L 题目大意:有n个点(其实是n+1个点,因为编号是0~n),m条有向边.起点是0,到a和b两个节点,所经过的最少的节点的数目是多少?(a和b也算,0不算) 思路: 真的是想了半天了,不知道怎么做,虽然知道是最短路,还是偏离了方向.最后万不得已的翻了题解. 题解看的是这个人的:链接 思路大体就是: 因为如果要到两个点,路径上的点肯定是有相交点的(因为0是必然要走的).然后如果两者路径相交,肯定选择共同相交…
大致题意: 给定一个n个点m条边的图,在可以把路径上至多k条边的权值变为0的情况下,求S到T的最短路. 数据规模: N≤100000,M≤200000,K≤10 建一个立体的图,有k层,每一层是一份原图,消耗一次把一条边权值变为0的机会 = 在立体图中升一层 然后跑堆优化dij就好了,会卡spfa. AC代码: #include<cstdio> #include<queue> #include<cstring> #define rep(i,a,b) for(int i=…
题目:https://nanti.jisuanke.com/t/41422 思路:预处理 #include<bits/stdc++.h> using namespace std; ][]={}; int main() { ;i<=;i++) { ;j<=;j++) { int t=j; ; res=j%i; dp[i][j]=res+dp[i][j/i]+dp[i][j-]; } } int T; scanf("%d",&T); int n,b; ;i&…
题目链接:Twice Equation 比赛链接:ICPC Asia Nanning 2017 Description For given \(L\), find the smallest \(n\) no smaller than \(L\) for which there exists an positive integer \(m\) for which \(2m(m + 1) = n(n + 1)\). Input This problem contains multiple test…
这是上礼拜三的训练赛,以前做过一次,这次仅剩B题没补.题目链接:https://vjudge.net/contest/153192#overview. A题,水题. C题,树形DP,其实是一个贪心问题,比如要取max的话,从根往下的肯定是要依次放max门,因此取一条能够获得最大值的一路放下max门即可.min同理. D题,BFS即可. E题,从小点到大点建边,然后维护区间和即可. F题,分数化简即可. G题,模拟即可. H题,答案是min(a,b)*(max(a,b)+1).这个结论暂时没有很好…