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级别的,很明显不行.然后看提交里一位大佬的代码,才明白…
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…
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…