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…
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 …
一个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…
题目的意思是: 如今有一个长度为n,宽为1的方格,在上面能够放大小为1*a船,然后输入为n,k,a.分别为平地的大小,船的数量,船的长度. 一个叫alice的人已经在地图上摆好了船的位置. 然后bob总共能够有m次攻击的机会,然后他每次攻击的点为xi.可是alice并不会告诉它有没有打中(也就是说每次都觉得他是miss的).问你,bob能够在第几次攻击的时候猜測出alice在撒谎,假设猜測不出来则输出-1. 这里每两条相邻的船不能相互接壤. 思路: 用set来维护每一段的区间. 首先.我们最多能…
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…
A. Lineland Mail time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output All cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position xi — a coordi…
A题: 题目地址:Lineland Mail #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <algorithm> #include <set> #include <queue> #include…
567A Lineland Mail题意:一些城市在一个x轴上,他们之间非常喜欢写信交流.送信的费用就是两个城市之间的距离,问每个城市写一封信给其它城市所花费的最小费用和最大的费用. 没什么好说的.直接做.特判最左边的和最右边的.其它的最小值在相邻的城市取,最大的在两边的城市与本城市取最大值. 代码: #include <set> #include <map> #include <queue> #include <stack> #include <de…
By brant-ruan Yeah, I feel very happy When you want to give up, think why you have held on so long. Just fight. Somebody may ask you: Why would you want to do that? Yeah, because I want to know how it works. Assembly language programming is about mem…