Vessels】的更多相关文章

D. Vessels time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered fr…
暴力+胡乱优化就过了..tags给的东西似乎什么都没用到.....CF的数据是不是有点水啊.....果然是没有营养的题目..... D. Vessels time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is a system of n vessels arranged one above the other as…
题目链接 Vessels 这道题我做得有点稀里糊涂啊==TLE了几发之后改了一行就A了. 具体思路就是记fi为若第i个容器已经盛不下水了,那么接下来盛水的那个容器. hi为若现在要给i号容器加水,当前真正被加水的那个容器. 这样就大大降低了时间复杂度. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a); i <= (b); ++i) ; long long a[N], b[N], f…
题目描述: Vessels time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered…
树状数组,一个想法是当往p注水时,认为是其容量变小了,更新时二分枚举,注意一些优化. #include<cstdio> #include<iostream> #include<cstdlib> #include<cstring> #include<string> #include<algorithm> #include<map> #include<queue> #include<vector> #i…
Codeforces Round #218 (Div. 2) D:http://codeforces.com/problemset/problem/371/D 题意:就是有一些盘子,盘子里可以装水,这些盘子是从上到下一次排开的,然后会有一些操作1,p ,x,表示在第p个盘子里加入水x,如果这个盘子装不下,水就会流向下一个盘子.2 p,表示查询第p个盘子里有多少水. 题解:这一题用到并查集是真的没有想到,也很难想到.水向下流的过程,就相当于儿子找父亲的过程,然后用并查集直接模拟出来,就可以了.具体…
http://codeforces.com/contest/371/problem/D 第一遍写的超时了,然后看了别人的代码,思路都是找一个点的根,在往里面加水的时候碗中的水满的时候建立联系.查询的时候直接查询就行. #include <cstdio> #include <cstring> #include <algorithm> #define LL __int64 #define maxn 500000 using namespace std; int f[maxn…
conscious[英][ˈkɒnʃəs][美][ˈkɑnʃəs]consensus[英][kənˈsensəs][美][kənˈsɛnsəs] scious sensuswaterflood; deluge; flood; flowage; Niagara; spill[英][spɪl][美][spɪl]spell[英][spel][美][spɛl] city urban emperemperortemper irritant Some had begun to build adjacent…
Training address: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=38994#overview B.Xenia and Bit Operations ----Codeforces 339D 线段树大水题..每个节点维护一个flag,flag=1表示此时应与其兄弟节点做或(|)操作,flag=2表示做异或(^)操作,然后pushup... 代码: #include <iostream> #include <cst…
传送门 POUR1 - Pouring water #gcd #recursion Given two vessels, one of which can accommodate a litres of water and the other - b litres of water, determine the number of steps required to obtain exactly c litres of water in one of the vessels. At the be…