Blog

  • Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

  • B. Transfusion

    You are given an array aa of length nn. In one operation, you can pick an index ii from 22 to n−1n−1 inclusive, and do one of the following actions:

    • Decrease ai−1ai−1 by 11, then increase ai+1ai+1 by 11.
    • Decrease ai+1ai+1 by 11, then increase ai−1ai−1 by 11.

    After each operation, all the values must be non-negative. Can you make all the elements equal after any number of operations?

    Input

    First line of input consists of one integer tt (1≤t≤1041≤t≤104)  — the number of test cases.

    First line of each test case consists of one integer nn (3≤n≤2⋅1053≤n≤2⋅105).

    Second line of each test case consists of nn integers aiai (1≤ai≤1091≤ai≤109).

    It is guaranteed that the sum of nn of all test cases doesn’t exceed 2⋅1052⋅105.

    Output

    For each test case, print «YES» without quotation marks if it is possible to make all the elements equal after any number of operations; otherwise, print «NO» without quotation marks.

    You can print answers in any register: «yes», «YeS», «nO»  — will also be considered correct.