CF435C.Cardiogram

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 _a_1, _a_2, ..., a__n.

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

在本题中,你需要使用 ASCII 图形绘制一张心电图。

心电图是一条具有如下顶点的折线:

即,心电图完全由一个正整数序列 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n 所确定。

你的任务是根据给定的序列 aia_i 绘制对应的心电图。

输入格式

The first line contains integer n (2 ≤ n ≤ 1000). The next line contains the sequence of integers _a_1, _a_2, ..., a__n (1 ≤ a__i ≤ 1000). It is guaranteed that the sum of all a__i doesn't exceed 1000.

第一行包含一个整数 nn(2 ≤ n ≤ 10002 \leq n \leq 1000)。第二行包含一个整数序列 a1, a2, ..., ana_1, a_2, ..., a_n(1 ≤ ai ≤ 10001 \leq a_i \leq 1000)。保证所有 aia_i 的总和不超过 10001000。

输出格式

Print max |y__i - y__j| lines (where y__k 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.

输出 _max_ |_y__i_ - _y__j_| 行(其中 _y__k_ 表示折线第 k 个点的 y 坐标),每行输出 个字符。每个字符必须为 « / »(正斜杠)、« \ »(反斜杠)或 « »(空格)之一。所输出的图像必须精确对应给定的折线图。请参考样例测试以更清晰地理解心电图(cardiogram)的打印方式。

注意:本题评测器在检查答案时会严格考虑空格。请勿输出任何额外字符。另外请注意,第一组预测试(pretest)若答错不会产生罚时。

输入输出样例

  • 输入#1

    5
    3 1 2 5 1

    输出#1

     / \     
       / \ /   \    
      /       \   
     /         \  
              \ / 
  • 输入#2

    3
    1 5 1

    输出#2

     / \     
      \    
       \   
        \  
         \ / 

说明/提示

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

由于技术原因,样例的答案无法从题目描述中直接复制。我们在下方附上了两个包含答案的文本文件。

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

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

输入解题思路,AI测评打分。不知道怎么写?

首页