呜呜周日的时候手感一直很好 代码一般都是一遍过编译一遍过样例

  做CF的时候前三题也都是一遍过Pretest没想着去检查...

  期间姐姐提醒说有Announcement也自信不去看

  呜呜然后就FST了

  呜呜然后rating-55(果然呜呜

  TAT


A. Cutting Banner
 

A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that contains someone else's word. The word on the banner consists only of upper-case English letters.

There is very little time to correct the mistake. All that we can manage to do is to cut out some substring from the banner, i.e. several consecutive letters. After that all the resulting parts of the banner will be glued into a single piece (if the beginning or the end of the original banner was cut out, only one part remains); it is not allowed change the relative order of parts of the banner (i.e. after a substring is cut, several first and last letters are left, it is allowed only to glue the last letters to the right of the first letters). Thus, for example, for example, you can cut a substring out from string 'TEMPLATE' and get string 'TEMPLE' (if you cut out string AT), 'PLATE' (if you cut out TEM), 'T' (if you cut out EMPLATE), etc.

Help the organizers of the round determine whether it is possible to cut out of the banner some substring in such a way that the remaining parts formed word CODEFORCES.

  很良心的A题...但是发现很多神犇都是写的枚举...表示不理解为何要枚举

  我的做法是直接从第一位开始和CODEFORCES匹配,从最后一位开始再从尾起和CODEFORCES匹配

  然后看匹配的位数之和如果>=CODEFORCES的位数就可以了


  

B. Quasi Binary
 

A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.

You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.

  

  这道题刚开始无脑贪心..从大的开始减,但是后来写到一半猛然发现是错的...

  例如31,如果无脑贪心的话,两个11和9个1...然而显然1个11和2个10才是答案

  然后突然发现只有0和1的数不是很少的吗...在n的范围内只有64个

  然后无脑背包就好了


C. Tourist's Notes
 

A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meaning that the between any two consecutive days height changes by at most 1, i.e. for all i's from 1 to n - 1 the inequality |hi - hi + 1| ≤ 1 holds.

At the end of the route the tourist rafted down a mountain river and some notes in the journal were washed away. Moreover, the numbers in the notes could have been distorted. Now the tourist wonders what could be the maximum height during his hike. Help him restore the maximum possible value of the maximum height throughout the hike or determine that the notes were so much distorted that they do not represent any possible height values that meet limits |hi - hi + 1| ≤ 1.

  这个是初一的时候普及模拟赛做过的一道一模一样的题啊..结果当时A了现在FST了..

  对于两个相邻的标记点i,j,我们设它们中间到达的最高点为k

  列出不等式a[k].y-a[i].y+a[k].y-a[j].y<=a[j].x-a[i].x

  a[k].y<=(a[j].x-a[i].x+a[i].y+a[j].y)/2

  显然当abs(a[j].y-a[i].y)>=a[j].x-a[i].x的时候无解

  然后其他情况把不等式右边取整就好了

  然后注意细节,放上Rank1爷的message镇


D. Weird Chess
 

Igor has been into chess for a long time and now he is sick of the game by the ordinary rules. He is going to think of new rules of the game and become world famous.

Igor's chessboard is a square of size n × n cells. Igor decided that simple rules guarantee success, that's why his game will have only one type of pieces. Besides, all pieces in his game are of the same color. The possible moves of a piece are described by a set of shift vectors. The next passage contains a formal description of available moves.

Let the rows of the board be numbered from top to bottom and the columns be numbered from left to right from 1 to n. Let's assign to each square a pair of integers (x, y) — the number of the corresponding column and row. Each of the possible moves of the piece is defined by a pair of integers (dx, dy); using this move, the piece moves from the field (x, y) to the field (x + dx, y + dy). You can perform the move if the cell (x + dx, y + dy) is within the boundaries of the board and doesn't contain another piece. Pieces that stand on the cells other than (x, y) and (x + dx, y + dy) are not important when considering the possibility of making the given move (for example, like when a knight moves in usual chess).

Igor offers you to find out what moves his chess piece can make. He placed several pieces on the board and for each unoccupied square he told you whether it is attacked by any present piece (i.e. whether some of the pieces on the field can move to that cell). Restore a possible set of shift vectors of the piece, or else determine that Igor has made a mistake and such situation is impossible for any set of shift vectors.

  题目描述略晦涩...连看样例大法都不能挽救...

  然后后面看着看着突然懂了...输出的原来是对于一个圈点的攻击方式...(后来怎么看怎么明显

  然后就暴力枚举每一种攻击方式就好了

  要保证每一个点这个攻击方式攻击到的位置都被攻击到了

  这里有一个细节,就是被攻击到了并不代表一定是x

  还有可能是圈...其实这个题目描述里也有刻意提到...(唉

  然后因为这个WA了一发,其他的就是简单的大暴力


E. Demiurges Play Again
 

Demiurges Shambambukli and Mazukta love to watch the games of ordinary people. Today, they noticed two men who play the following game.

There is a rooted tree on n nodes, m of which are leaves (a leaf is a nodes that does not have any children), edges of the tree are directed from parent to children. In the leaves of the tree integers from 1 to m are placed in such a way that each number appears exactly in one leaf.

Initially, the root of the tree contains a piece. Two players move this piece in turns, during a move a player moves the piece from its current nodes to one of its children; if the player can not make a move, the game ends immediately. The result of the game is the number placed in the leaf where a piece has completed its movement. The player who makes the first move tries to maximize the result of the game and the second player, on the contrary, tries to minimize the result. We can assume that both players move optimally well.

Demiurges are omnipotent, so before the game they can arbitrarily rearrange the numbers placed in the leaves. Shambambukli wants to rearrange numbers so that the result of the game when both players play optimally well is as large as possible, and Mazukta wants the result to be as small as possible. What will be the outcome of the game, if the numbers are rearranged by Shambambukli, and what will it be if the numbers are rearranged by Mazukta? Of course, the Demiurges choose the best possible option of arranging numbers.

  这道题题意很明显..然后发现怎么不仅有两个玩家还有两个幕后操纵者...

  情况好复杂呀..弃疗...

  然后发现其实不管怎样,每个人面临的情况只有两种:顺境或逆境

  顺境也就是说幕后操纵的人和自己都想让最后结果最大化(最小化),逆境则相反

  先假设幕后操纵者支持最大化值好了

  我们考虑每个节点i最终取到的是其子树中第a[i]大的数(注意这里的第a[i]大不是第a[i]小的意思)

  如果当前节点面临顺境,那么它只要从子树中a[i]取一个最小值就好了

  因为幕后操纵者会顺着他的考虑将最大的值全放到这个子树中,这样就能让值最大化

  而如果面临逆境的话,它希望取出的数最小

  因为是幕后操纵者设计好局面在先,所以我们可以想象现在这个玩家眼前是一些已经带入具体数值的数

  他肯定会选其中最大的一个

  然而幕后操纵者希望这些所有的数里面最大的最小,那显然就是所有a[i]的加和了

  然后惊奇地发言幕后操纵者支持最小化的时候,只要将第a[i]大自动带入第a[i]小,整个流程是完全一样的

  (maya刚刚淋漓说了一句惊奇地发现然后Jry也说了一句惊奇地发现...


    

F. A Heap of Heaps
 

Andrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task as a punishment.

The teacher gave Andrew an array of n numbers a1, ..., an. After that he asked Andrew for each k from 1 to n - 1 to build a k-ary heap on the array and count the number of elements for which the property of the minimum-rooted heap is violated, i.e. the value of an element is less than the value of its parent.

Andrew looked up on the Wikipedia that a k-ary heap is a rooted tree with vertices in elements of the array. If the elements of the array are indexed from 1 to n, then the children of element v are elements with indices k(v - 1) + 2, ..., kv + 1 (if some of these elements lie outside the borders of the array, the corresponding children are absent). In any k-ary heap every element except for the first one has exactly one parent; for the element 1 the parent is absent (this element is the root of the heap). Denote p(v) as the number of the parent of the element with the number v. Let's say that for a non-root element v the property of the heap is violated if av < ap(v).

Help Andrew cope with the task!

  比赛最后的弃疗期间yy了一个将k分段然后树状数组统计的做法,其中分段用二分实现

  最后TLE了...最后发现和标算只是相差了树状数组和二分的时间复杂度

  究竟是该开心还是遗憾好呢...

  像完全k叉树这样特殊的数据结构...早该想到父亲与儿子的标号肯定是可以O(1)计算的..写啥二分呢

  然后树状数组也没必要,树状数组只是为在线询问提供简单的方法

  但是这个只需要计算一次所以最后统计前缀和就好了

  然后那些计算自己画画就出来了..


  

  你问我G和H怎么不写题解

  像这种只有杜教才会做的题有必要去看?

  这场CF打得真是感动..虽然没有像Jry那样伤心 但也是比较难过

  果然是连着打BC和CF,RP只能光顾一边对吗...

  CF的题还是很好玩...代码也很短...这次手速太慢了

  也是第一场用Ideone敲代码的CF,感觉除了最后要复制到本地之外也没啥不方便的

  下次翻盘吧 虽然感觉再无这种全体赛的涨Rating好机会了

  

  28/.Apr.

Codeforces Round #300 解题报告的更多相关文章

  1. Codeforces Round #513解题报告(A~E)By cellur925

    我是比赛地址 A:Phone Numbers $Description$:给你一串数字,问你能组成多少开头为8的11位电话号码. $Sol$:统计8的数量,与$n$%11作比较. #include&l ...

  2. Codeforces Round #302 解题报告

    感觉今天早上虽然没有睡醒但是效率还是挺高的... Pas和C++换着写... 544A. Set of Strings   You are given a string q. A sequence o ...

  3. Codeforces Round #301 解题报告

    感觉这次的题目顺序很不合理啊... A. Combination Lock   Scrooge McDuck keeps his most treasured savings in a home sa ...

  4. 贪心 Codeforces Round #300 A Cutting Banner

    题目传送门 /* 贪心水题:首先,最少的个数为n最大的一位数字mx,因为需要用1累加得到mx, 接下来mx次循环,若是0,输出0:若是1,输出1,s[j]--: 注意:之前的0的要忽略 */ #inc ...

  5. 水题 Codeforces Round #300 A Cutting Banner

    题目传送门 /* 水题:一开始看错题意,以为是任意切割,DFS来做:结果只是在中间切出一段来 判断是否余下的是 "CODEFORCES" :) */ #include <cs ...

  6. CFEducational Codeforces Round 66题解报告

    CFEducational Codeforces Round 66题解报告 感觉丧失了唯一一次能在CF上超过wqy的机会QAQ A 不管 B 不能直接累计乘法打\(tag\),要直接跳 C 考虑二分第 ...

  7. Codeforces Global Round 1 解题报告

    A 我的方法是: #include<bits/stdc++.h> using namespace std; #define int long long typedef long long ...

  8. Codeforces Educational Round 81 解题报告

    前置扯淡 赛前:这场\(Div2\)呀,那我写\(3\)题就行,\(D\)题尽力就好 赛中:啊啊,\(ABC\)我全过了\(pretest\),我太强了!!这把上蓝稳了 赛后:\(woc\),为啥被\ ...

  9. Codeforces Round #300(A.【字符串,多方法】,B.【思维题】,C.【贪心,数学】)

    A. Cutting Banner time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...

随机推荐

  1. spring location设置本地路径

    <context:property-placeholder location="file:D:/jdbc.properties"/> 直接在路径前加上 file:

  2. Bugku 速度要快

    import requests import base64 url="http://123.206.87.240:8002/web6/" res=requests.get(url) ...

  3. spring boot 打包问题

    一.jar包 1.maven build package 2.linux 下执行 java -jar & 命令后台运行,也可加入服务运行 二.war包 1.将pom中的<packagin ...

  4. errno -4058 and npm WARN enoent ENOENT 解决方案

    1.报错如下: npm WARN checkPermissions Missing write access to C:\Users\hejinrong\AppData\Roaming\npm\nod ...

  5. UVA 11881 Internal Rate of Return(数学+二分)

    In finance, Internal Rate of Return (IRR) is the discount rate of an investment when NPV equals zero ...

  6. DP入门(1)——数字三角形问题

    一.问题描述 如上图所示,有一个由非负整数组成的三角形,第一行只有一个数,除了最下行之外每个数的左下方和右下方各有一个数.现请你在此数字三角形中寻找一条从首行到最下行的路径,使得路径上所经过的数字之和 ...

  7. Tomcat 中如何给 web 项目配置虚拟目录的方法

    为什么要给 web 项目配置虚拟目录? 初学 JavaWeb 时,会发现只要我们把 web 项目放到 Tomcat 的 webapps 目录下,再通过 http://localhost:8080/项目 ...

  8. redis集群如何清理前缀相同的key

    最近经常收到redis集群告警,每天收到50多封邮件,实在不胜其烦,内存不够用,原因是有一些无用的key(约3000万)占用内存(具体不说了).这部分内存不能被释放. 原来的定期清理脚本的逻辑: 打开 ...

  9. java实现数据库连接的工具类

    第一种 (带事务) package com.china.util; import java.sql.Connection; import java.sql.DriverManager; import ...

  10. 附录A培训实习生-面向对象基础类和实例(1)

    对象是一个自包含的实体,用一组可识别的特性和行为来标识. 面向对象编程,Object-Oriented Programming,其实就是针对对象进行编程的意思. 类就是具有相同属性和功能的对象的抽象的 ...