Gym - 102307D Do Not Try This Problem】的更多相关文章

 Do Not Try This Problem Gym - 102307D 题意:给个长度为len的字符串(len<=1e5),然后q次操作(q<=1e5),每次给出i,a,k,c,(i+k*a<=len)也就是把字符串位置为i,i+a,i+2*a...,i+k*a的改成c字符,输出q次操作后的字符串. 首先暴力做法肯定是遍历字符串的每个位置,然后从后往前遍历,找到最后一个修改到这个位置的操作,但这样的时间复杂度是n*q,是1e10级别的,很明显不行.然后看提交里一位大佬的代码,才明白…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5919 题意: 给出正整数 $N(1 \le N \le 10^5)$,询问对于正整数 $k$,有多少个小于 $2^N$ 的 $2^k-1$ 是 $7$ 的整数倍. 题解: $…
第一次做交互题. 题意是有n个数(n<1000),你通过问1 a b,后台返回你YES代表a<b,NO代表a>b.要你在10000次询问内给出一个符合的排列.n=1000来说,10000其实就是大约nlogn. 所以需要一个时间复杂度稳定为nlogn的排序,每次询问的结果对应cmp函数的返回值.然后顺便了解一下stable sort: 稳定排序,它的这个稳定,主要是两个相同的元素,它不会改变原来的相对位置. 它是怎么判断两个元素是否相同的呢? cmp(x,y) ==0 &&…
Gym 100096D Guessing game 题面 Problem Description Byteman is playing a following game with Bitman. Bitman writes down some 1 000 000 000-element sequence of zeros and ones. Byteman's task is to guess the sequence that Bitman created. He can achieve th…
Gym - 101667H:https://vjudge.net/problem/Gym-101667H 参考:https://blog.csdn.net/weixin_37517391/article/details/80154299 题意: 已知两个人出剪刀石头布的顺序,第二个人可以选择从第一个人的任意手开始正式比赛,问第二个人赢得个数最多是多少. 思路: 首先肯定要把第二个人所代表的字符串T转化为对应能赢的字符串rT.这时候暴力的话就是把rT拿去和第一个人的字符串匹配. 这里就可以用FFT…
ID Origin Title 10 / 55 Problem A Gym 100625A Administrative Difficulties   4 / 6 Problem B Gym 100625B Bribe 7 / 75 Problem C Gym 100625C Cracking the Code 8 / 23 Problem D Gym 100625D Destination Unknown   5 / 12 Problem E Gym 100625E Encoded Coord…
ID Origin Title   4 / 12 Problem A Gym 100589A Queries on the Tree 14 / 41 Problem B Gym 100589B Count Palindromes 18 / 19 Problem C Gym 100589C Find P'th Number   0 / 4 Problem D Gym 100589D Desolation of Smaug   0 / 4 Problem E Gym 100589E Count Di…
CF1039D You Are Given a Tree 容易发现,当 \(k\) 不断增大时,答案不断减小,且 \(k\) 的答案不超过 \(\lfloor\frac {n}{k}\rfloor\) ,因此不同的答案个数是 \(\sqrt n\) 级别的,可以用一种类似整体二分的方式求解. 对于一个 \(k\) ,从叶子节点贪心向上匹配即可得到答案. 点击查看代码 #include<bits/stdc++.h> using namespace std; int n; int ver[2000…
Problem J. Triatrip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description The travel agency “Four Russians” is offering the new service for their clients. Unlike other agencies that only suggest one-way…
Problem C. Painting CottagesTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description The new cottage settlement is organized near the capital of Flatland. The construction company that is building the settl…