CF985D Sand Fortress】的更多相关文章

思路: 很奇怪的结论题,不好想.参考了http://codeforces.com/blog/entry/59623 实现: #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 0x7f7f7f7f; ll n, H; bool check(ll m) { ll tmp = min(m, H); ) / <= n; } ll solve(ll n, ll H) { ll l =…
D - Sand Fortress 思路: 二分 有以下两种构造, 分别二分取个最小. 代码: #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pi acos(-1.0) #define LL long long //#define mp make_pair #define pb push_back #define ls rt<<1, l, m #defi…
Sand Fortress time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are going to the beach with the idea to build the greatest sand castle ever in your head! The beach is not as three-dimens…
Description You are going to the beach with the idea to build the greatest sand castle ever in your head! The beach is not as three-dimensional as you could have imagined, it can be described as a line of spots to pile up sand pillars. Spots are numb…
题目链接:https://codeforces.com/contest/985 ’A.Chess Placing 题意:给了一维的一个棋盘,共有n(n必为偶数)个格子.棋盘上是黑白相间的.现在棋盘上有n/2个棋子,让你全部移动到黑色格子或者白色格子,要求步数最少,并输出步数. 题解:由于黑色或者白色都是固定位置,我们对棋子位置排个序,然后全部移动到任意一个颜色,取两个最小步数的最小值就好了. #include<bits/stdc++.h> #define clr(x) memset(x,0,s…
A B /* Huyyt */ #include <bits/stdc++.h> #define mem(a,b) memset(a,b,sizeof(a)) #define mkp(a,b) make_pair(a,b) #define pb push_back ][] = {{, }, {, }, {, -}, { -, }, {, }, {, -}, { -, -}, { -, }}; using namespace std; typedef long long ll; inline v…
3399: [Usaco2009 Mar]Sand Castle城堡 Time Limit: 3 Sec  Memory Limit: 128 MB Description 约翰用沙子建了一座城堡.正如所有城堡的城墙,这城墙也有许多枪眼,两个相邻枪眼中间那部分叫作"城齿".    城墙上一共有N(1≤N≤25000)个城齿,每一个都有一个高度Mi.(1≤尬≤100000).现在约翰想把城齿的高度调成某种顺序下的Bi,B2,-,BN(I≤Bi≤100000). -个城齿每提高一个单位的高…
3399: [Usaco2009 Mar]Sand Castle城堡 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 22  Solved: 17[Submit][Status] Description 约翰用沙子建了一座城堡.正如所有城堡的城墙,这城墙也有许多枪眼,两个相邻枪眼中间那部分叫作“城齿”.    城墙上一共有N(1≤N≤25000)个城齿,每一个都有一个高度Mi.(1≤尬≤100000).现在约翰想把城齿的高度调成某种顺序下的Bi,B2…
3399: [Usaco2009 Mar]Sand Castle城堡 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 37  Solved: 32[Submit][Status][Discuss] Description 约翰用沙子建了一座城堡.正如所有城堡的城墙,这城墙也有许多枪眼,两个相邻枪眼中间那部分叫作“城齿”.    城墙上一共有N(1≤N≤25000)个城齿,每一个都有一个高度Mi.(1≤尬≤100000).现在约翰想把城齿的高度调成某种…
E. Polish Fortress time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output The Malbork castle is the largest brick castle in the world. It was built in 1274 in honor to Holy Mary, and is located near the riv…