All submissions for this problem are available.
You are given an integer N. Consider a vector a of length N2 accessible via 0-based indexing.
Let's call the following transformation a TVT-transformation (Terrible Vector transformation).
We will call a vector g a good vector if
For some reason, you want to find a vector a of length N2 such that it's elements are either 1 or -1 and after applying TVT-transformation (i.e. b), it results in a good vector.
The first line of input contains an integer T denoting the number of test cases. Each test case is described by one line containing one integer N.
For each test case output one line with the word NO if it's not possible to find such vector. Otherwise output YES on the first line and N2 space-separated integers (each either -1 or 1) on the second - the answer for this test case.
If there are multiple possible answers, output any one of them.
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 100
Input: 2 1 2 Output: YES 1 YES 1 1 1 -1
Subtask 1:(10 points)
- 1 ≤ N ≤ 8
Subtask 2: (20 points)
- 1 ≤ N ≤ 30
Subtask 3: (30 points)
- 1 ≤ N ≤ 60
Subtask 4: (40 points)
- 1 ≤ N ≤ 100
Sample example 2: After TVT-transformation, the vector will transform to (4, 0, 0, 4) which is a good vector for N = 2
|Tags||hadamard hard matrices paley-const pavel1996 sept15 sylvesters williamson|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.4, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.