codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1396A.md (1360B)


      1 Source: https://codeforces.com/problemset/problem/1396/A
      2 
      3 A. Multiples of Length
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given an array $a$ of $n$ integers.
     22 
     23 You want to make all elements of $a$ equal to zero by doing the following operation exactly three times:
     24 
     25 * Select a segment, for each number in this segment we can add a multiple of $len$ to it, where $len$ is the length of this segment (added integers can be different).
     26 
     27 It can be proven that it is always possible to make all elements of $a$ equal to zero.
     28 
     29 Input
     30 
     31 The first line contains one integer $n$ ($1 \le n \le 100\,000$): the number of elements of the array.
     32 
     33 The second line contains $n$ elements of an array $a$ separated by spaces: $a_1, a_2, \dots, a_n$ ($-10^9 \le a_i \le 10^9$).
     34 
     35 Output
     36 
     37 The output should contain six lines representing three operations.
     38 
     39 For each operation, print two lines:
     40 
     41 * The first line contains two integers $l$, $r$ ($1 \le l \le r \le n$): the bounds of the selected segment.
     42 * The second line contains $r-l+1$ integers $b_l, b_{l+1}, \dots, b_r$ ($-10^{18} \le b_i \le 10^{18}$): the numbers to add to $a_l, a_{l+1}, \ldots, a_r$, respectively; $b_i$ should be divisible by $r - l + 1$.
     43 
     44 Example
     45 
     46 Input
     47 
     48 ```
     49 4
     50 1 3 2 4
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 1 1 
     57 -1
     58 3 4
     59 4 2
     60 2 4
     61 -3 -6 -6
     62 ```