time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output Problem Description Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting…
D. One-Dimensional Battle Ships time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consist…
[链接] 我是链接,点我呀:) [题意] 长度为n的一个序列,其中有一些部分可能是空的,一些部分是长度为a的物品的一部分 (总共有k个长度为a的物品,一个放在位置i长度为a的物品会占据i,i+1,....i+a-1这a个格子 (物品之间必须要有至少一个空格,不能相邻 现在有一个人猜了m个不同的位置 你每次都说那个位置不是物品的一部分.(骗他) 那么请问最少在第几次你会露馅?(知道你在骗他) [题解] 对于一个连续的空白的区间[l,r],设其长度为len=r-l+1 那么这个空白区间最多能放下(l…
传送门 D. One-Dimensional Battle Ships time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line con…
Battle ships Problem DescriptionDear contestant, now you are an excellent navy commander, who is responsible of a tough mission currently.Your fleet unfortunately encountered an enemy fleet near the South Pole where the geographical conditions are ne…
D. One-Dimensional Battle Ships time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consist…
Battle ships Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1007    Accepted Submission(s): 353 Problem Description Dear contestant, now you are an excellent navy commander, who is responsible…
D. One-Dimensional Battle ShipsTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/D Description Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n s…
D. One-Dimensional Battle ShipsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/D Description Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n …
Battle Ships Time Limit: 2 Seconds      Memory Limit: 65536 KB Battle Ships is a new game which is similar to Star Craft. In this game, the enemy builds a defense tower, which has L longevity. The player has a military factory, which can produce N ki…
二分图匹配: 分别按行和列把图展开.hungary二分图匹配. ... 例子: 4 4 *ooo o### **#* ooo* 按行展开. .. . *ooo o#oo oo#o ooo# **#o ooo* ooo* 再按列展开... 7 * 8 *ooooooo oooooooo oooooooo oooooooo *o*ooooo ooooooo* ooooooo* 匹配结果3 Battle ships Time Limit: 2000/1000 MS (Java/Others)    M…
Battle Ships is a new game which is similar to Star Craft. In this game, the enemy builds a defense tower, which has L longevity. The player has a military factory, which can produce N kinds of battle ships. The factory takes tiseconds to produce the…
B - Battle Ships Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3623 Appoint description:   Description Battle Ships is a new game which is similar to Star Craft. In this game, the enemy builds a…
传送门Battle Ships Time Limit: 2 Seconds      Memory Limit: 65536 KB Battle Ships is a new game which is similar to Star Craft. In this game, the enemy builds a defense tower, which has L longevity. The player has a military factory, which can produce N…
题目:pid=5093" target="_blank">hdoj 5093 Battle ships 题意:给你一个n*m的图,图中有冰山 '# ',浮冰 'o' 以及普通海 ' * ',如今要在海中布置尽可能多的炮弹.炮弹不能突波冰山,不能让炮弹互相攻击到.问最大能不知多少个? 分析:二分图的经典题目.关键在于怎么建图,图进行两次编号,按行编号,每一行中能攻击到的一块编号成相同的数,每一列相同.然后对行和列有编号的地方进行连边,求一次最大匹配就可以,我用最大流求的最…
Battle Ships is a new game which is similar to Star Craft. In this game, the enemy builds a defense tower, which has L longevity. The player has a military factory, which can produce N kinds of battle ships. The factory takes ti seconds to produce th…
Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n square cells (that is, on a 1 × n table). At the beginning of the game Alice puts k ships on the field without telling their positio…
题目链接:https://codeforces.com/problemset/problem/567/D 题意: 在一个 $1 \times n$ 的网格上,初始摆放着 $k$ 只船,每只船的长度均为 $a$ 个格子,已知所有船之间均不重叠.不触碰. 现在Bob每次询问Alice第 $i$ 个格子上是否存在船,Alice每次都会说不存在,求在第几次询问时,可以确定Alice撒谎了. 题解: 对于某次询问一个位置 $x$ 是否有船,假设其属于某个最小的区间 $(l,r)$,其中 $l,r$ 分别是…
Battle shipsHDU - 5093 题目大意:n*m的地图,*代表海洋,#代表冰山,o代表浮冰,海洋上可以放置船舰,但是每一行每一列只能有一个船舰(类似象棋的車),除非同行或者同列的船舰中间有冰山挡着,问最多能放多少个船舰? 之前做过一个放置炮的,那时数据小直接暴力加搜索就A了,然而这题暴力搜索的话,直接了当的TLE,没办法只好去学新东西了.二分图这个概念只有在之前的题目中做过匈牙利的板子题,可是具体概念和思路并不了解,这题也正好提醒了我去深入了解.但最近需要做的事情较大,一直想整理的…
题目:51nod: 题目Codeforces: 题目注意到两个战舰不能挨在一起就可以了. // 每一段 struct node{ int left; // 段的左端点 int right; // 段的右端点 int length; // 段长度 int ship; // 段最大容纳战舰数 }arr[]; 每一段可容纳战舰数: ship*a + (ship - 1) <= length;   -->   ship = (length+1) / (a+1);(舍去小数部分) 构造出这么一个数据结构…
题目链接:http://codeforces.com/problemset/problem/567/D 题目意思:给出 1 * n 的 field,编号从左至右依次为 1,2,...,n.问射 m 枪之后(第 i 次射中编号 xi,则 xi 这一点是不能放置船只的!),能不能将 k 只 1 * a 的小船放到这些没有经过被射中编号的 field 中 .由于Alice 每次 shoot 的时候都会说 miss 的,即没有打中,你需要判断第几次shoot 使得整个field 不能放置 k 只 小船,…
一个set水 + 区间判断个数问题.... #include<iostream> #include<cstdio> #include<cstring> #include<set> using namespace std; int L,N,a,M; int main() { set<int> Pos; set<int>::iterator it; cin >> L >> N >> a; { Pos.c…
link:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3623 看起来像完全背包,但是物品价值是变化的,所以很多人搞的很复杂. 晚上的代码要么很复杂,有一个代码虽然很简洁在zoj可以过,但是是错误的.求教lyl神犇,果然思想很深刻,抓住乐问题的本质,想法比网上搜到的所有博客里面的做法都简洁. 事实上,就是简单的DP,抓住一个技巧:让时间倒流,也就是说,把时间反过来考虑,先在将来把船造好,然后在过去用船攻击,哈哈,太巧秒…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1091    Accepted Submission(s): 395 Problem Description Dear contestant, now you are an excellent navy commander, who is responsible of a tough mi…
//这题逼我把匈牙利学了 之前一直很勤快敲网络流 而且不以为耻反以为荣 解:首先按行扫描编号,如果在同一块中(即可以相互攻击),那么将其标为相同的数组,对列也做同样的操作. 然后扫描整张图,如果行编号为a的块与列编号为b的块有公共点,那么将二部图中A集合中a点与B集合中b点相连.最后求出来最大二分匹配数就是答案. (为什么这样做)首先很明显的,二部图中每一条边就对应原图中的一个点,因此,匹配数=边数=最多可放置的战舰数,另外二分图每个点只能匹配一次,对应到原题中就是每一块只能放置一个战舰. #i…
GukiZ and GukiZiana 题意: 区间加 给出$y$查询$a_i=a_j=y$的$j-i$最大值 一开始以为和论文CC题一样...然后发现他带修改并且是给定了值 这样就更简单了.... 每个块维护排好序的结果 修改暴力重构+整块打标记 查询暴力查+整块二分找数量 复杂度$O(SlogS + \frac{N}{S} + S+\frac{N}{S}logS)$ woc求了一节课导数也没求出最值来又发现一开始式子列错了不管了我就开根号了..(我才不会说是因为乱搞了一下更慢了) 貌似是因为…
B. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go…
C. Vasya and Robot time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell (0,0)(0,0). Robot can perfor…
E. Andrew and Taxi time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andrew prefers taxi to other means of transport, but recently most taxi drivers have been acting inappropriately. In orde…
题目的意思是: 如今有一个长度为n,宽为1的方格,在上面能够放大小为1*a船,然后输入为n,k,a.分别为平地的大小,船的数量,船的长度. 一个叫alice的人已经在地图上摆好了船的位置. 然后bob总共能够有m次攻击的机会,然后他每次攻击的点为xi.可是alice并不会告诉它有没有打中(也就是说每次都觉得他是miss的).问你,bob能够在第几次攻击的时候猜測出alice在撒谎,假设猜測不出来则输出-1. 这里每两条相邻的船不能相互接壤. 思路: 用set来维护每一段的区间. 首先.我们最多能…