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. [Unit test] jasmine createSpyObj

    beforeEach(() => { contextStub = { debug: false, engine: jasmine.createSpyObj('engine', [ 'create ...

  2. LeetCode 499. The Maze III

    原题链接在这里:https://leetcode.com/problems/the-maze-iii/ 题目: There is a ball in a maze with empty spaces ...

  3. Numpy | 03 数据类型

    numpy 支持的数据类型比 Python 内置的类型要多很多,基本上可以和 C 语言的数据类型对应上,其中部分类型对应为 Python 内置的类型. 下表列举了常用 NumPy 基本类型: 名称 描 ...

  4. MYSQL中group_concat( )函数中参数的排序方法

    使用mysql中的group_concat( )函数连接指定字段时,可以先对该字段进行排序. PS:是因为二刷mysql的51道题的第12题遇到的:查询和" 01 "号同学学习的课 ...

  5. 基于docker-compose部署 简单nsq 集群

    主要目的是搭建一个测试环境,同时使用了nodejs 客户端sdk nsq 简单了解 nsqd:一个负责接收.排队.转发消息到客户端的守护进程 nsqlookupd:管理拓扑信息并提供最终一致性的发现服 ...

  6. presto-gateway nodejs client

    目前已经有了好几个presto nodejs 的client,为了方便presto-gateway 的连接,修改了一个现有的nodejs client 可以方便的连接presto-gateway 原理 ...

  7. 用于 Quinella/Exacta/Trifecta/Pick Four/Pick Six/Quaddie/Superfecta 7大规则的测试

    上2篇给了详细API 设计,下面我们来模拟测试下: Quinella: self.bet_type = "Quinella" self.nraces = 1 self.horse_ ...

  8. A`>G?~C009

    A`>G?~C009 这场怎么才5题...看完猫的提交记录以为猫猫没写这场F A Multiple Array 直接做 B Tournament 直接树d C Division into Two ...

  9. idea2017显示maven Project菜单

    右侧就出现 maven project菜单了.

  10. 解析生效测试方法 执行命令 ping 域名 得不到 IP 主要有如下几个原因:

    https://help.aliyun.com/knowledge_detail/39834.html dig https://cloud.tencent.com/document/product/3 ...