Codeforces 877 D. Olya and Energy Drinks】的更多相关文章

http://codeforces.com/contest/877/problem/D   D. Olya and Energy Drinks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Olya loves energy drinks. She loves them so much that her room is fu…
题目链接:http://codeforces.com/contest/877/problem/D D. Olya and Energy Drinks time limit per test2 seconds memory limit per test256 megabytes Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formal…
cf 442 D. Olya and Energy Drinks(bfs) 题意: 给一张\(n \times m(n <= 1000,m <= 1000)\)的地图 给出一个起点和终点,每秒钟可以沿着四个方向直走\(1\)到$k(k <= 1000) $步,问从起点到终点最少需要多少秒 思路: 最暴力的\(bfs\)时间复杂度为\(O(n * m * k)\) 由bfs可以知道,每个点只需要被访问过一点就已经是最短了,也即访问过一次就可以将其从地图中删去了 这里有两种方法可以来实现 1…
D. Olya and Energy Drinks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally,…
[链接] 我是链接,点我呀:) [题意] 给一张二维点格图,其中有一些点可以走,一些不可以走,你每次可以走1..k步,问你起点到终点的最短路. [题解] 不能之前访问过那个点就不访问了.->即k那一层循环直接break; 因为可能出现这种 ax aa aa 然后起点是(3,2)终点是(1,1);然后k=3 bfs的时候,第一步,走到了(2,2)和(3,1); 但是接下来,如果(2,2)先走的话,就会先走到(2,1); 而(3,1)认为(2,2)走过了,就不往下走了. ->但实际上他可以一步走到…
http://codeforces.com/problemset/problem/877/C   C. Slava and tanks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Slava plays his favorite game "Peace Lightning". Now he is flying a…
题目链接:http://codeforces.com/contest/877/problem/E 题解:显然一看就感觉要么树链剖分要么线段树+dfs序,题目要求的操作显然用线段树+dfs序就可以实现.然后就敲一下线段树+dfs序就行挺简单的只要dfs一遍记录当前节点的下表然后再加一个leng数组来存子树最多到达几然后更新或者求值的时候只要查询(pos[x],leng[x])即可. #include <iostream> #include <cstring> #include <…
A. Alex and broken contest 题意 判断一个字符串内出现五个给定的子串多少次. Code #include <bits/stdc++.h> char s[110]; using namespace std; typedef long long LL; char* rec[5] = {"Danil", "Olya", "Slava", "Ann", "Nikita"}; i…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
本文转自:http://net.tutsplus.com/tutorials/other/speeding-up-websites-with-yslow/ We all know there are countless reasons why web page load-times skyrocket, however, pinpointing the problem may be costly in both time and money. So why waste the effort wh…