Almost Correct
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
Special Judge, 64bit IO Format: %lld

题目描述

Given a 01-sequence (sequence consisting only of 0s and 1s) s of length n, you need to find two arrays x and y such that
  • Array x and y are of equal length, and the length should not exceed 120.
  • 1 \leq x_i< y_i\leq n for all 1\leq i\leq m, where m is the length of the two arrays.
  • Algorithm \mathrm{SORT}(x,y) can sort all 01-sequences of length n correctly except for the given one. Here algorithm \mathrm{SORT}(x,y) takes as input a 01-sequence a of length n, and is described as follows:
    • Iterate over all integers from 1 to m. For each integer i during the iteration, swap a_{x_i} and a_{y_i} if a_{x_i}>a_{y_i}.

输入描述:

The input contains multiple test cases.
The first line of the input contains an integer T\ (1 \leq T\leq 10^4), the number of test cases.
For each test case, the first line contains an integer n\ (2 \leq n\leq 16).
The next line contains s, the 01-sequence of length n. It is guaranteed that s is not sorted, i.e., there exists some integers 1 \leq i<j \leq n such that s_i=1 and s_j=0.

输出描述:

For each test case, output m\ (0 \leq m \leq 120) in the first line, indicating the length of array x and y.
In the i-th of the next m lines, print x_i and y_i\ (1 \leq x_i<y_i \leq n) separated by a space.
示例1

输入

复制
2
2
10
3
110

输出

复制
0
2
1 2
2 3