Codeforces 417 C】的更多相关文章

Football Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was div…
按monitor排序,然后状压DP... . D. Cunning Gena time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A boy named Gena really wants to get to the "Russian Code Cup" finals, or at least get a t-shirt.…
http://codeforces.com/contest/812/problem/D 题意: 现在有n个孩子,m个玩具,每次输入x y,表示x孩子想要y玩具,如果y玩具没人玩,那么x就可以去玩,如果y有人玩的话,x就必须等待y玩完后才能玩.如果出现循环,那么这个循环里的孩子都会哭. 现在有q次询问,如果加入x y,会有多少孩子哭. 思路: 建立一棵树,根结点就是第一个玩玩具y的人,它的子树就是等待玩具的人(子树按照等待顺序建树).这样就会形成很多棵树. 这样的话,对于每个询问,我们去找到最后一…
http://codeforces.com/contest/812/problem/B 题意: 有n层楼,每层楼有m个房间,1表示灯开着,0表示灯关了.最两侧的是楼梯. 现在每从一个房间移动到另一个房间需要1时间,走楼梯也需要1时间,求关完所有灯所需的最少时间. 思路: d[i][0]表示第i层楼关完灯后从左边楼梯上楼的最少时间,d[i][1]代表右楼梯. 预处理一下,开两个数组保存每层楼开灯房间的最左边的值和最右边的值,这样也就确定了要走的范围. 对于上面灯全部关了的楼层,可以不用去考虑它.…
题目链接:http://codeforces.com/problemset/problem/812/B B. Sagheer, the Hausmeister time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Some people leave the lights at their workplaces on when they…
来自FallDream的博客,未经允许,请勿转载,谢谢. 有毒的一场div2 找了个1300的小号,结果B题题目看错没交  D题题目剧毒 E题差了10秒钟没交上去. 233 ------- A.Sagheer and Crossroads 有一个十字路口,分别给出每个方向左右转和直行以及行人的红绿灯的状态,求有没有可能有行人会被车撞 大判断.  附上大佬@ACMLCZH的代码 #include <cstdio> #include <cstring> ][]; inline int…
[题意概述] 在一个十字路口 ,给定红绿灯的情况, 按逆时针方向一次给出各个路口的左转,直行,右转,以及行人车道,判断汽车是否有可能撞到行人 [题目分析] 需要在逻辑上清晰,只需要把所有情况列出来即可 [AC] #include<bits/stdc++.h> using namespace std; int main() { ][]; ; i <= ; i++) ; j <= ; j++) scanf("%d",&light[i][j]); int an…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some str…
C. Sagheer and Nubian Market time limit per test  2 seconds memory limit per test  256 megabytes   On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules.…
B. Sagheer, the Hausmeister time limit per test  1 second memory limit per test  256 megabytes   Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all studen…