ACM_cf
文章平均质量分 54
zz你的名字
不奢望过多,只希望未来的自己没有过多的遗憾。
展开
-
cf398A Snacktower
A. Snacktower time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output According to an old legeng, a long time ago Ankh-Morpork residents did somet原创 2017-02-26 15:52:59 · 652 阅读 · 0 评论 -
Codeforces Round #419 (Div. 2) A
A. Karen and Morning time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Karen is getting ready for a new school day!It is currently hh:mm,原创 2018-01-16 21:09:51 · 180 阅读 · 0 评论 -
Codeforces Round #417 (Div. 2) A
A. Sagheer and Crossroads time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Sagheer is walking in the street when he comes to an intersectio原创 2018-01-16 21:11:12 · 200 阅读 · 0 评论 -
Codeforces Round #416 (Div. 2) A
A. Vladik and Courtesy time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output At regular competition Vladik and Valera won a and b candies respe原创 2018-01-16 21:12:45 · 178 阅读 · 0 评论 -
Codeforces Round #415 (Div. 2)
A. Straight «A» time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Noora is a student of one famous high school. It’s her final year in schoo原创 2018-01-16 21:14:58 · 282 阅读 · 0 评论 -
Codeforces Round #460 (Div. 2) C Seat Arrangements
题目链接 1.特判k=1的情况 2.不能直接暴力,如果k太大,会变成n^3,前缀搞一下。#includeusing namespace std;const int maxn=2005;#define LL long longconst int inf=0x3f3f3f3f;char mapp[maxn][maxn];int r[maxn][maxn],c[maxn][max原创 2018-02-01 15:15:01 · 282 阅读 · 0 评论 -
Codeforces Round #460 (Div. 2) D Substring《拓扑排序+DP
题目链接 题意:n个点,m条边形成一个有向图,n个字母(可能相同)分别代表n个点。 如果有环,输出-1,否则找出一条最长边,最长边的定义是一条路上相同的字母最多的。 拓扑排序+DP 实在是想不到用DP,一直在想如何遍历所有两点间距离,看时间复杂度应该想到遍历每个点就差不多了。 菜鸡只能惊呼原来还有这种操作。 多一遍for就会TLE,厉害了#includeusing namesp原创 2018-02-01 15:24:58 · 222 阅读 · 0 评论 -
Hello 2018 A
A. Modular Exponentiation time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The following problem is well-known: given integers n and m, cal原创 2018-01-09 10:48:18 · 331 阅读 · 0 评论 -
Hello 2018 B
题目:http://codeforces.com/contest/913/problem/B 一开始读错题了,以为必需是==3,其实是>=3。 然后发现忘了标记根节点。 然后发现a数组标记取消是清零,而不是–。 然后换了一种写法,最终还是WA。其实前三种标记就错了,不应该排序。 第四种数组跑出界了,竟然不判RE,气死啦!#include#include#include#in原创 2018-01-09 10:58:13 · 220 阅读 · 0 评论 -
Codeforces Round #470 C. Producing Snow
题目链接 题意就不说了。 第i个答案肯定和前v[i]个值都有关系,所以直接暴力的一发,然后肯定是T了。 然后我想不出来,参考了大佬的想法。 既然第i个答案肯定和前v[i]个值都有关系,那就构造一下特殊的东西,不用从头再来一遍。 然后就构造了两个数组,一个的组成是V’[i]=v[i]+T[1~i-1],另一个组成是T[1~k]。 如果想知道第k个答案,每次找到最小的V’[i]跟T[1~k...原创 2018-03-13 20:16:13 · 236 阅读 · 0 评论 -
Codeforces Round #467 (Div. 2) C. Save Energy!
题目链接 找到一个时间点,这个时间点锅已经停了。那么此时可以形成一个周期,然后算出有多少这样的周期,最后处理一下结尾的点即可。(这么傻的题想了好久,太弱了)#include<stdio.h>#define ll long longint main(){ ll k,d,t; while(~scanf("%lld%lld%lld",&k,&d,&...原创 2018-03-21 16:46:10 · 218 阅读 · 0 评论 -
Codeforces Round #477 (rated, Div. 1, based on VK Cup 2018 Round 3) A. Stairs and Elevators
题目 题意:给出n层楼,每层m个房间,楼梯和电梯的分布这样的(1,x),(2,x)…,(n,x),1<=x<=m,楼梯c1,电梯c2,电梯的速度为v。给出起始点和终点,问最快的速度。 解法:其实很简单,算出走楼梯和电梯的四种情况,然后取最小值即可,记得同一楼层的情况。 状态不好,写了一堆bug#include<bits/stdc++.h>using namesp...原创 2018-04-30 16:48:59 · 275 阅读 · 0 评论 -
D. Destruction of a Tree
D. Destruction of a Tree 题意:给你n个点,n-1条边连通整个图,每次删除度数为偶数的点,问是否能找出答案。 解法:偶数个点肯定不行。奇数个点,对于每个父亲儿子来说, 如果儿子的子树的大小为奇数, 那么肯定先删父亲, 反之先删儿子, 建立关系图, 跑一遍拓扑序就好啦。#include <bits/stdc++.h>using namespace s...原创 2018-04-25 16:06:11 · 277 阅读 · 0 评论 -
Codeforces Round #420 (Div. 2) A
A. Okabe and Future Gadget Laboratory time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Okabe needs to renovate the Future Gadget Laborator原创 2018-01-16 21:08:29 · 173 阅读 · 0 评论 -
Codeforces Round #421 (Div. 2) A
A. Mister B and Book Reading time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mister B once received a gift: it was a book about aliens, w原创 2018-01-16 21:06:58 · 162 阅读 · 0 评论 -
cf402 B. Weird Rounding
B. Weird Rounding time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Polycarp is crazy about round numbers. He especially likes the numbers di原创 2017-02-26 20:28:54 · 567 阅读 · 0 评论 -
cf369 B Chris and Magic Square
B. Chris and Magic Square time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output ZS the Coder and Chris the Baboon arrived at the entrance of Uda原创 2017-03-22 09:40:27 · 662 阅读 · 0 评论 -
cf368 Bakery
B. Bakery time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Masha wants to open her own bakery and bake muffins in one of the n cities numbe原创 2017-03-13 10:56:40 · 411 阅读 · 0 评论 -
Nearest Neighbor Search(数学题)
链接:https://acm.bnu.edu.cn/v3/statments/52296.pdf 一个点到一个立方体的距离就是到各个边的最短距离#include<stdio.h>int main(){ int x,y,z; int x1,y1,z1; int x2,y2,z2; scanf("%d%d%d",&x,&y,&z); scanf("%d%d%原创 2017-03-16 07:29:00 · 990 阅读 · 0 评论 -
cf 410
A. Mike and palindrome time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mike has a string s consisting of only lowercase English letters. H原创 2017-04-29 17:06:13 · 476 阅读 · 0 评论 -
cf397 B. Code obfuscation
B. Code obfuscation time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Kostya likes Codeforces contests very much. However, he is very disapp原创 2017-03-13 19:35:11 · 735 阅读 · 0 评论 -
Educational Codeforces Round 35 (Rated for Div. 2) A
A. Nearest Minimums time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given an array of n integer numbers a0, a1, …, an - 1. Find t原创 2018-01-11 21:13:28 · 388 阅读 · 0 评论 -
Codeforces Round #455 (Div. 2)
A. Generate Login time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The preferred way to generate user login in Polygon is to concatenate a原创 2018-01-11 21:19:38 · 216 阅读 · 0 评论 -
Codeforces Round #413, rated, Div. 1 + Div. 2 A
A. Carrot Cakes time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output In some game by Playrix it takes t minutes for an oven to bake k carrot ca原创 2018-01-15 20:30:23 · 174 阅读 · 0 评论 -
Educational Codeforces Round 21 A
A. Lucky Year time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Apart from having lots of holidays throughout the year, residents of Berland原创 2018-01-15 21:24:52 · 191 阅读 · 0 评论 -
Codeforces Round #456 (Div. 2)
A. Tricky Alchemy time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output During the winter holidays, the demand for Christmas balls is exceptiona原创 2018-01-07 20:37:52 · 266 阅读 · 0 评论 -
Codeforces Round #456 (Div. 2)
B. New Year’s Eve time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Since Grisha behaved well last year, at New Year’s Eve he was visited by原创 2018-01-07 21:11:11 · 265 阅读 · 0 评论 -
E Byteland, Berland and Disputed Cities
E Byteland, Berland and Disputed Cities 题意:给你1,2,3,三种点,使其排列在x轴上,去掉点1后使其2,3点完全联通,去掉点2后使其1,3点完全联通,问最短需要多长。 思路:1和2两个点不用连,连了也得去掉。 那么如果只有一个3点,我们把3点看成1点,按顺序连一遍即可,同样2点也是如此。 如果有两个3点,那么第一个3点的最左面相同点挨着连即可,...原创 2018-04-25 19:54:51 · 229 阅读 · 0 评论