Description All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef is the head of commercial logging industry that recently bought a farm containing N trees. You are given in…
题目链接:https://vjudge.net/problem/CodeChef-FORESTGA 题解: 现场赛.拿到这题很快就知道是二分,但是一直wa,怎么修改也wa,后来又换了种错误的思路,最后还是觉得二分是正确的,但还是wa.人生,就是在这些瞬间被怀疑的…… 结束后,才发现,test()的时候溢出了.应该把判断放在循环里面,如果达到要求的,就立刻返回.因为达到要求后,后面的运算都是多余的. 反思: 在某些判断中,如果达到要求后,就立刻执行.不要等所有操作完成后,再执行,因为可能出现意想不…
All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. You might have heard about our new goodie distribution program aka the "Laddu Accrual System". This problem is designed…
Description All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef is a big fan of soccer! He loves soccer so much, that he even invented soccer for his pet dogs! Here are th…
Codechef April Challenge 2019 游记 Subtree Removal 题目大意: 一棵\(n(n\le10^5)\)个结点的有根树,每个结点有一个权值\(w_i(|w_i\le10^9|)\).你可以进行若干次(包括\(0\)次)操作,每次你可以选择一个连通块,将其删去.若你的操作次数为\(k\),则总收益为剩下结点权值之和\(-X\cdot k\).求最大总收益. 思路: 树形DP,\(f_x\)表示以\(x\)为根的子树的最大总收益.转移时\(f_x=w_x+\s…
Codechef October Challenge 2018 游记 CHSERVE - Chef and Serves 题目大意: 乒乓球比赛中,双方每累计得两分就会交换一次发球权. 不过,大厨和小厨用了另外一种规则:双方每累计得 K 分才会交换发球权.比赛开始时,由大厨发球. 给定大厨和小厨的当前得分(分别记为 P1 和 P2),请求出接下来由谁发球. 思路: \((P1+P2)\%K\)判断奇偶性即可. 代码链接 BITOBYT - Byte to Bit 题目大意: 在字节国里有三类居民…
Codechef September Challenge 2018 游记 Magician versus Chef 题目大意: 有一排\(n(n\le10^5)\)个格子,一开始硬币在第\(x\)个格子里.\(m(m\le10^4)\)次操作,每次交换指定的两个格子.问最后硬币在第几个格子里. 思路: 按题意模拟即可. 源代码: #include<cstdio> #include<cctype> inline int getint() { register char ch; whi…
比赛链接:https://www.codechef.com/FEB18,题面和提交记录是公开的,这里就不再贴了 Chef And His Characters 模拟题 Chef And The Patents 模拟题 Permutation and Palindrome 模拟题 Car-pal Tunnel 结论比较简单 Broken Clock 求余弦的n倍角,可以用复数的快速幂解决 $cos(a)=x \\ sin(a)=\sqrt{1-x^2} \\ cos(na) = Re((x+\sq…
因为没注意到long long 就 TLE 了... 二分一下答案就Ok了.. ------------------------------------------------------------------------------ #include<cstdio> #include<cstring> #include<algorithm> #include<iostream>   #define rep( i , n ) for( int i = 0…
https://www.codechef.com/JAN17 Cats and Dogs 签到题 #include<cstdio> int min(int a,int b){return a<b?a:b;} int main(){ int T,a,b,c; for(scanf("%d",&T);T;--T){ scanf("%d%d%d",&a,&b,&c); puts(c%==&&c/<=a+…