September Challenge 2017】的更多相关文章

这道题我们发现0就代表相同1代表少1或者大1 那么我们根据题目连边 如果存在1(边权只为或0)个数为奇数的环就是无解 #include<cstdio> #include<cstring> #include<algorithm> ; int read(){ ,f=,c=getchar(); ; c=getchar();} +(c-'); c=getchar();} return ans*f; } int T,n,q,vis[M],c[M]; int first[M],cn…
———————————————————————————— 这道题维护一下原序列的差分以及操作的差分就可以了 记得倒着差分操作 因为题目保证操作2的l r 小与当前位置 #include<cstdio> #include<cstring> #include<algorithm> #define lowbit(x) x&-x; using namespace std; ,mod=1e9+; int read(){ ,f=,c=getchar(); ; c=getch…
Little Chef and Sums 分析:水题,去维护一下前缀和以及后缀和就好,注意long long #include "iostream" #include "cstdio" #include "cstring" #include "string" using namespace std; ; ; long long a[maxn],dp[maxn]; int n; int main() { int T; scanf…
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…
Mujin Programming Challenge 2017 A - Robot Racing 如果每个数都是一个一个间隔开的,那么答案是\(n!\) 考虑把一个数挪到1,第二个数挪到3,以此类推,如果不行,证明前面中有个数肯定会被选择,所以任意选一个数到终点,继续这样的操作 最后剩下的乘一个阶乘即可 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #de…
What fire does not destroy, it hardens. 烈火摧毁不了的东西,只会变得更坚固. The true gold can stand the test of fire, the real capabilities can cope with every new challenge. What can't kill us just makes us stronger. What we have learned by heart can't be easily tak…
Live boldly. Push yourself. Don't settle. 勇敢生活,突破自我,永不设限! Don't indulge in the past, whether it was glorious or gloomy. Look ahead, live in the present, let bygones be bygones. Keep on trying, maybe we will find some wonderful things. We never know w…
Dream most deep place, only then the smile is not tired. 梦的最深处,只有微笑不累. Everyday I expect I can go to sleep earlier and have a good dream. Because I always attempt to get some enlightments from dreams. And now I know that is nothing but wishful thinki…
Preface 这确实应该是我打过的比较水的CC了(其实就打过两场) 但由于我太弱了打的都是Div2,所以会认为上一场更简单,其实上一场Div的数据结构是真的毒 好了废话不多说快速地讲一下 A Easy Fibonacci 手玩一下那个删数的过程就是求一个最大的\(2^k\le n\),然后剩下的斐波那契数列某一位膜\(10\)可找循环节可矩乘 #include<cstdio> #include<cstring> #define RI register int #define CI…
好气啊,本来以为比赛时间还有很多,结果回家养病两天回到学校怎么比赛就结束了(雾),大约是小高考弄错了时间? 挑3道有意思的写写题解吧. Cloning 题目大意:给一个序列,每次询问两个等长区间,问区间内的数是否排序后至多只有一个对应位不同. 题解:主席树维护一下hash,求出最大的k,使得两个区间中的前k大在排序后相同,然后判一下后缀即可. #include<cstdio> #include<algorithm> #define MN 110000 #define ull uns…
CALC: 计算器题目描述大厨有一个计算器,计算器上有两个屏幕和两个按钮.初始时每个屏幕上显示的都是 0.每按一次第一个按钮,就会让第一个屏幕上显示的数字加 1,同时消耗 1 单位的能量.每按一次第二个按钮,会让第二个屏幕上显示的数字加上第一个屏幕上显示的数字,同时消耗 B 单位的能量.初始时,计算器有 N 单位的能量.大厨想知道在能量限制下,第二个屏幕上最大可以出现的数字是多少?输入格式输入的第一行包含一个整数 T,代表测试数据的组数.接下来是 T 组数据.每组数据仅有一行,包含两个整数 N…
CHEFSIGN: 大厨与符号序列题目描述大厨昨天捡到了一个奇怪的字符串 s,这是一个仅包含‘<’.‘=’和‘>’三种比较符号的字符串.记字符串长度为 N,大厨想要在字符串的开头.结尾,和每两个字符之间插入一个正整数,共N + 1 个数.大厨希望插入数字之后,这些比较符号所表达的含义是正确的.举个例子,如果在‘<’前后分别插入 a 和 b,那么应当有 a < b.对于‘=’和‘>’也是类似的.大厨可以在 [1, P] 中任意选择数字插入,同一个数也可以被插入到多个位置.请你帮…
IPCTRAIN: 训练营教练题目描述本次印度编程训练营(Indian Programming Camp,IPC)共请到了 N 名教练.训练营的日程安排有 M 天,每天最多上一节课.第 i 名教练在第 Di 天到达,直到训练营结束才离开.第 i 名教练希望上 Ti 节课.要是少上了课,那么教练会感到扎心,每少上一节,扎心值就会加 Si.作为主办方,你希望最小化所有教练的扎心值之和.输入格式输入的第一行包含一个整数 T,代表测试数据的组数.接下来是 T 组数据.每组数据的第一行包含两个整数 N 和…
PSHTTR: Pishty 和城堡题目描述Pishty 是生活在胡斯特市的一个小男孩.胡斯特是胡克兰境内的一个古城,以其中世纪风格的古堡和非常聪明的熊闻名全国.胡斯特的镇城之宝是就是这么一座古堡,历史上胡斯特依靠这座古堡抵挡住了疯人国的大军.对于 Pishty 来说,真正吸引他的是古堡悠长的走廊和高耸的钟楼,以及深藏于其中的秘密……古堡可以用一棵 N 个节点的树的描述,树中有 N − 1 条无向边,每条边有一个魔法数字 C.当一个旅游团参观古堡时,他们会选择树上 U 到 V 的路径游览.他们认…
The simplest answer is often the correct one. 最简单的答案通常是最正确的答案. Simplest is always best. Sometimes you may find your answer is astonishingly simple after you have spent enourmous time in seeking for the solutions of your problems. If it works, don't d…
Human life is ephemera, which makes it precious. 生命短暂,所以珍贵. Don't waste time on praying to the God. There are too many prayers, he may not hear your prayer and he may not see your bearings. Even if he has heard and seen, he is so busy that he may not…
Every saint has a past and every sinner has a future. 圣人皆有过去,罪人皆有未来. If you were a sinner in the past, you still have the possibility to become a saint if you achieve some great things later. However, if you were a saint in the past, or if you had so…
We both look up at the same stars, yet we see such different things. 我们仰望同一片星空,却看见了不同的事物. Looking up at the stars, some may think it is due to the darkness that we can see the stars, whereas some think it is due to the stars that make the night more…
I have to protect the one thing I can't live without. 我必须为我一生挚爱遮风挡雨. A man is a success if he gets up in the morning and goes to bed at night and in between does what he wants to do. 成功的生活就是早上起床,晚上睡觉,白天做自己想做的事情. From Bob Dylan. Simple guidelines, but…
No man is rich enough to buy back his own past. 没有人富有到可以赎回自己的过去. Those rich are not willing to buy back their past, even they are able to. Wealth can be the substitute for many things. The ornament of a house is the friends who frequent it. 一座房子最好的装饰…
To live is the rarest thing in the world. Most people exist. That is all. 生活是世间最罕见的事情:生存,却是世间最常见的事情:仅此而已. That's all? That's all. Now I don't expect I can live a wonderful life, or to be a great people with outstanding contributions to the human bein…
Lonely people will always remember his life occurred in each person. 寂寞的人总是会用心记住他生命中出现过的每个人. If you don't love for yourself, you will always live for others. Don't let others be the major character of your life, try to become the shinest star, full o…
If we believe that tomorrow will be better, we can bear a hardship today. 如果我们相信明天会更好,今天就能承受艰辛. If you have dreams, you will not be defeated easily. Big expectations, but small footprints, be sure that every step can take us to our goals. Just like c…
All our dreams can come true if we have the courage to pursue them. 如果我们有勇气去追求梦想,我们的梦想一定可以成为现实. If you don't dare to pursue what you are longing for, they only exist in your dreams and never come true. If you have the courage to pursure them and take…
The only person you should try to be better than is the person you were yesterday. 你唯一应该试着去超越的人,是昨天的自己. There is nothing noble in being feeling superior to our fellows, true nobility lies in being superior to our former self. Always try to be better…
Distance could make you forget about them, but the memories would always be there. 距离会让你遗忘,但是回忆却始终在那里. Whether you remember it or you forget it, those painful experience would always be there. No matter how sedulous we are to blank out those bad feel…
We are all in the gutter, but some of us are looking at the stars. 身处艰难,但仍有人仰望星空. When standing on the land, make sure you stand with your feet firmly. When looking up at the stars, don't froget to look down at your feet. Dreams, may be too far away…
First I need your hand, then forever can begin. 我需要牵着你的手,才能告诉你什么是永远. If you want to shake hands with someone, it would be better if you reach out your hand first. Try to strive for some trival achievements every day. With time flies, those trival acc…
Don't let the past steal your present. 别让过去悄悄偷走了我们的当下. We take what we can get and make the best of it. 我们取我们所能取,好好地享用. From The House on Mango Street.…
Whenever people agree with me, I always feel I must be wrong. 每次人们赞同我时,我都觉得自己一定错了. We can draw lessons from the past, but we cannot live in it. 我们可以从过去学到些什么,但不能活在过去.…