C. Cardiogram
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

In this problem, your task is to use ASCII graphics to paint a cardiogram.

A cardiogram is a polyline with the following corners:

That is, a cardiogram is fully defined by a sequence of positive integers a1, a2, ..., an.

Your task is to paint a cardiogram by given sequence ai.

Input

The first line contains integer n (2 ≤ n ≤ 1000). The next line contains the sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 1000). It is guaranteed that the sum of all ai doesn't exceed 1000.

Output

Print max |yi - yj| lines (where yk is the y coordinate of the k-th point of the polyline), in each line print characters. Each character must equal either « / » (slash), « \ » (backslash), «» (space). The printed image must be the image of the given polyline. Please study the test samples for better understanding of how to print a cardiogram.

Note that in this problem the checker checks your answer taking spaces into consideration. Do not print any extra characters. Remember that the wrong answer to the first pretest doesn't give you a penalty.

Sample test(s)
Input
5
3 1 2 5 1
Output
      / \     
 / \ /  \
 /  \
 /  \
\ / 
Input
3
1 5 1
Output
 / \     
\
\
\
\ / 
Note

Due to the technical reasons the answers for the samples cannot be copied from the statement. We've attached two text documents with the answers below.

http://assets.codeforces.com/rounds/435/1.txt

http://assets.codeforces.com/rounds/435/2.txt

//includes
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <list>
#include <utility>
#include <algorithm>
#include <cassert>

using namespace std;

//defines-general
typedef long long ll;
typedef long double ld;
#define to(a) __typeof(a)
#define fill(a,val)  memset(a,val,sizeof(a))
#define repi(i,a,b) for(__typeof(b) i = a;i<b;i++)

//defines-pair
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair

//defines-vector
typedef vector<int> vi;
typedef vector<long long> vll;
#define all(vec)  vec.begin(),vec.end()
#define tr(vec,it)  for(__typeof(vec.begin())  it = vec.begin();it!=vec.end();++it)
#define pb push_back
#define sz size()
#define contains(vec,x) (find(vec.begin(),vec.end(),x)!=vec.end())

int main()
{
     vector<pii > vals;
     char ans[][];
     repi(i, , )
     {
           repi(j, , ) ans[i][j] = ' ';
     }
     int n;
     cin >> n;
     int x=,y=;
     vals.pb(mp(x,y));
     int maxy=;
     int maxx=;
     int add = ;
     repi(i, , n)
     {
           int a;
           cin >> a;
           x+=a;
           y+=((i%==)?:-)*a;
           maxy = max(y,maxy);
           maxx = max(x,maxx);
           vals.pb(mp(x,y));
     }
     repi(i, , n+)
     {
           vals[i].ss = -*(vals[i].ss-maxy);
     }
     repi(i, , n+)
     {
           x = vals[i-].ff;
           y = vals[i-].ss;
           int x1 = vals[i].ff;
           int y1 = vals[i].ss;
           if(i%)
           {
                 for(int j = y1+; j<=y; j++)
                 {
                       ans[j-][x1-(j-y1)] = '/';
                 }
           }
           else
           {
                 for(int j = y+; j<=y1; j++)
                 {
                       ans[j-][x+(j-y-)] = '\\';
                 }
           }
     }
     int maxi = ;
     int maxj = ;
     repi(i, , )
     {
           repi(j, , )
           {
                 if(ans[i][j]!=' ')
                 {
                       maxi = max(i,maxi);
                       maxj = max(j,maxj);
                 }
           }
     }
     repi(i, , maxi+)
     {
           repi(j, , maxj+) printf("%c",ans[i][j]);
           cout << endl;
     }
//    for(pii temp:vals) cout << temp.ff <<" " << temp.ss << endl; cout << endl;
     return ;
}

Codeforces Round #249 (Div. 2) C. Cardiogram的更多相关文章

  1. 模拟 Codeforces Round #249 (Div. 2) C. Cardiogram

    题目地址:http://codeforces.com/contest/435/problem/C /* 题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:) 模拟题:蛮恶心的,不过也简单 ...

  2. Codeforces Round #249 (Div. 2) (模拟)

    C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  3. Codeforces Round #249 (Div. 2) C题,模拟画图 ----未解决!

    http://codeforces.com/contest/435/problem/C

  4. Codeforces Round #249 (Div. 2)B(贪心法)

    B. Pasha Maximizes time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  5. Codeforces Round #249 (Div. 2) A题

    链接:http://codeforces.com/contest/435/problem/A   A. Queue on Bus Stop time limit per test 1 second m ...

  6. Codeforces Round #249 (Div. 2) D. Special Grid 枚举

    题目链接: http://codeforces.com/contest/435/problem/D D. Special Grid time limit per test:4 secondsmemor ...

  7. Codeforces Round #249 (Div. 2) 总结

    D.E还是很难的.....C不想多说什么... A:提意:给出每一组人的个数,以及一次车载容量,求出最少需要多少次才能载走所有的人. water: http://codeforces.com/cont ...

  8. Codeforces Round #249 (Div. 2) A. Black Square

    水题 #include <iostream> #include <vector> #include <algorithm> using namespace std; ...

  9. Codeforces Round #249 (Div. 2) B. Pasha Maximizes

    看到题目的时候,以为类似插入排序,比较第i个元素和第i-1个元素, 如果第i个元素比第i-1个元素小,则不交换 如果第i个元素比第i-1个元素大,则交换第i个元素和第i-1个元素 继续比较第i-1个元 ...

随机推荐

  1. [CF787D] legacy

    题目 Rick和他的同事们研究出了一种新的有关放射的公式,于是许多坏人就在追赶他们.所以Rick希望在被坏人抓住之前把遗产给Morty. 在他们的宇宙里总共有n颗行星,每颗行星有它自己的编号(编号为1 ...

  2. MongoDB 聚合查询报错

    1.Distinct聚合查询报错 db.users.distinct("uname") db.runCommand({"distinct":"user ...

  3. cronicle 任务调度一主多从安装试用

    cronicle 对于一主多从的安装还是很简单的,对于slave 就是少了setup一步,同时在master 界面,添加下slave 就可以了 就会加入集群中了 项目使用docker-compose ...

  4. Using the Repository and Unit Of Work Pattern in .net core

    A typical software application will invariably need to access some kind of data store in order to ca ...

  5. Python研究

    听说Python是种高级语言,故打算研究一下,看看高级在哪 学习资源:https://www.liaoxuefeng.com/wiki/1016959663602400 由于上面所示的网站对Pytho ...

  6. nginx 访问控制之 限速

    nginx限速可以通过 ngx_http_limit_conn_module 和 ngx_http_limit_req_module 模块来实现限速的功能. 一.ngx_http_limit_conn ...

  7. Linux后台运行和关闭程序、查看后台任务

    fg.bg.jobs.&.ctrl+z   1.&    (最经常被用到)     这个用在一个命令的最后,可以把这个命令放到后台执行   2.ctrl + z     可以将一个正在 ...

  8. 写一个eggjs权限验证中间件

    关于中间件 https://eggjs.org/zh-cn/basics/middleware.html 官方文档说的很清楚了,不再叙述. 我们要达到怎么样一个效果? 用户没有登录不能访问一些特定的页 ...

  9. leetcode 221. 最大正方形

    题目描述: 在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积. 思路分析: 一道动态规划的题.由于是正方形,首先单一的‘1’即为最小的正方形,接下来需要考察其外围区域 ...

  10. JAVA字符编码一:Unicode,GBK,GB2312,UTF-8概念基础

    第一篇:JAVA字符编码系列一:Unicode,GBK,GB2312,UTF-8概念基础 来源:holen'blog   对字符编码与Unicode,ISO 10646,UCS,UTF8,UTF16, ...