D - Record of the Attack at the Orbit

Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

Description

The long-range laser at the board of combat spaceship “Rickenbacker” had successfully destroyed all the launching pads on the surface of enemy planet Orkut. Within less than a day, race Shodan had surrendered.
The captain of “Rickenbacker” expected a promotion. His enviers, in their turn, were trying to persuade the high command that the captain was a liar—no one is able to be so quick on the uptake and to strike so many targets during an attack at the orbit. The captain understood that he was to defend his honour and prepare a detailed report on the mission accomplished. For a start, he decided to draw all the destroyed pads on one graph.
The laser direction system is bound to a rectangular Cartesian coordinates. All the coordinates of the destroyed pads in these coordinates are integers. Axes should be depicted with symbols “|” (vertical slash, to show the y-axis), “-” (minus, to show the x-axis), “+” (plus, to show the origin). Spots where the destroyed pads were situated should be depicted with symbol “*” (asterisk). All the other points should be depicted with symbol “.” (dot). The x-axis in the graph should be directed to the right, and the y-axis should be directed upwards. One symbol in the graph corresponds to one unit on the x-axis horizontally and to one unit on the y-axis vertically. The axes should be depicted in the graph, but they may be completely covered with symbols “*”.

Input

The first line contains an integer n (1 ≤ n ≤ 250) that is the number of destroyed launching pads. Each of the following n lines contains coordinates of one pad. All the coordinates are integers not exceeding 100 by absolute value. No two pads are situated at the same point.

Output

Output the required graph. The first line should correspond to the maximum value of y (or 0), and the last one should correspond to the minimum value of y (or 0). Each line should have the same amount of symbols. The first symbol in the line should correspond to the minimum value of x (or 0) and the last one should correspond to the maximum value of x (or 0).

Sample Input

input output
8
-10 5
-7 3
-4 2
-9 4
0 1
6 -1
3 0
8 -3
*.........|........
.*........|........
...*......|........
......*...|........
..........*........
----------+--*-----
..........|.....*..
..........|........
..........|.......*
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
char Map[][];
struct node{
int x,y; }que[];
bool cmp1(struct node t1,struct node t2){ return t1.x<t2.x;
} bool cmp2(struct node t1,struct node t2){ return t1.y>t2.y;
} int main(){
int n;
while(scanf("%d",&n)!=EOF){ for(int i=;i<=;i++)
for(int j=;j<=;j++)
Map[i][j]='.'; for(int i=;i<=;i++){
Map[i][]='-';
Map[][i]='|';
}
Map[][]='+';
for(int i=;i<n;i++){ scanf("%d%d",&que[i].x,&que[i].y);
int tx=que[i].x+;
int ty=que[i].y+; Map[tx][ty]='*'; }
int x1,x2,y1,y2;
sort(que,que+n,cmp1);
x1=que[].x+;
x2=que[n-].x+;
sort(que,que+n,cmp2);
y1=que[].y+;
y2=que[n-].y+;
if(y1>&&y2>)
y2=;
else if(y1<&&y2<)
y1=;
if(x1>&&x2>)
x1=;
else if(x1<&&x2<)
x2=;
for(int i=y1;i>=y2;i--){
for(int j=x1;j<=x2;j++){
printf("%c",Map[j][i]);
}
printf("\n");
} }
return ;
}

URAL 1944 大水题模拟的更多相关文章

  1. BZOJ_1621_[Usaco2008_Open]_Roads_Around_The_Farm_分岔路口(模拟+大水题)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1621\(n\)头奶牛,刚开始在一起,每次分成\(x\)和\(x+m\)两部分,直到不能再分,问 ...

  2. 第三届山西省赛1004 一道大水题(scanf)

    一道大水题 时间限制: C/C++ 2000ms; Java 4000ms 内存限制: 65535KB 通过次数: 44 总提交次数: 1020 问题描述 Dr. Pan作为上兰帝国ACM的总负责人, ...

  3. PAT甲题题解-1101. Quick Sort (25)-大水题

    快速排序有一个特点,就是在排序过程中,我们会从序列找一个pivot,它前面的都小于它,它后面的都大于它.题目给你n个数的序列,让你找出适合这个序列的pivot有多少个并且输出来. 大水题,正循环和倒着 ...

  4. PAT甲题题解-1117. Eddington Number(25)-(大么个大水题~)

    如题,大水题...贴个代码完事,就这么任性~~ #include <iostream> #include <cstdio> #include <algorithm> ...

  5. 【数据结构】 最小生成树(四)——利用kruskal算法搞定例题×3+变形+一道大水题

    在这一专辑(最小生成树)中的上一期讲到了prim算法,但是prim算法比较难懂,为了避免看不懂,就先用kruskal算法写题吧,下面将会将三道例题,加一道变形,以及一道大水题,水到不用高级数据结构,建 ...

  6. Wannafly挑战赛21:C - 大水题

    链接:Wannafly挑战赛21:C - 大水题 题意: 现在给你N个正整数ai,每个数给出一“好数程度” gi(数值相同但位置不同的数之间可能有不同的好数程度).对于在 i 位置的数,如果有一在j位 ...

  7. 大水题(water)

    题目描述dzy 定义一个 $n^2$ 位的数的生成矩阵 $A$ 为一个大小为 $n \times n$ 且 Aij 为这个数的第 $i \times n+j-n$ 位的矩阵.现在 dzy 有一个数 $ ...

  8. [BFS,大水题] Codeforces 198B Jumping on Walls

    题目:http://codeforces.com/problemset/problem/198/B Jumping on Walls time limit per test 2 seconds mem ...

  9. ACM: NBUT 1105 多连块拼图 - 水题 - 模拟

    NBUT 1105  多连块拼图 Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:  Practice  Appoint ...

随机推荐

  1. 旧文备份:怎样利用好单片机上的存储器资源来实现OD的存储与访问

    我们知道OD(对象字典)是CANopen的核心,所有功能都是围绕它开展的,是协议栈的数据中心,良好的OD实现是协议栈高效稳定运行的基础,而OD的实现最基本的一点就是怎么去保存它.因为OD的内容比较杂, ...

  2. System.Web

    如果 using System.Web:还是调用不出来其中的类,请在引用的位子添加 System.Web  引用,有的版本不自带这个命名空间. 类: HttpResponse类       用于绘画验 ...

  3. 项目部署到自己的IIS上

    一般我们只能在本机上才可以开到我们的项目,这个是不需要连网的 如果想让我们的项目在网站中打开,别人也可以看到,就需要把我们的项目部署到服务器上了,输入IP就可以看到我们的项目 发布项目 然后发布网站 ...

  4. python的模块

    前言 在开发过程中,为了编写可维护的代码,我们会将很多函数进行分组,放到不同的文件中去.这样每个包的代码相对来说就会减少,也利于后期的维护和重复的使用.很多编程语言都采用这样的组织代码方式,在pyth ...

  5. Json数据常用操作

    JSON字符串: var str1 = '{ "name": "cs", "sex": "man" }'; JSON对象 ...

  6. 洛谷题解:P1209 【[USACO1.3]修理牛棚 Barn Repair】

    原题传送门:https://www.luogu.org/problemnew/show/P1209 首先,这是一道贪心题.  我们先来分析它的贪心策略.  例如,样例:  4 50 18  3 4 6 ...

  7. gdb几个操作

    如果进程转为守护进程,可设置如下跟进子进程 set follow-fork-mode child 输出变量/函数/返回值有print, call, display,自行选择 对于打印value has ...

  8. 基于 win7下虚拟机的 GNSS-SDR安装过程

    最近在安装 GNSS-SDR软件时,遇到了很多问题,这里回顾了我的安装过程,罗列了所遇到的问题和解决办法.希望后来者不要再踩这些坑了! 首先,在官方文档中看到,GNSS-SDR目前并不支持直接在 Wi ...

  9. centos7 多网卡修改默认路由

    最近在virtualbox里搭了一个centos7的虚拟机,但是网络这一块总是有问题. 单网卡下的问题: 1.当我配置连接方式为NAT网络地址转换的时候,虚拟机可以访问外网.但是在网络地址转换的情况下 ...

  10. mysql 创建用户、授权、修改密码

    以下操作都要在mysql所在机器操作 一.创建用户 CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456'; 或 insert into mysql. ...