/* Detects a 213 occurrence in O(n^2). The solution considers each point of the permutation as a potential "2". Then a linear sweep through the remaining part of the permutation from left to right is used to count the number of ascents that cross this "2", making the "1" and "3". */ #include using namespace std; #define rep(i,a,b) for (auto i=(a); i<(b); ++i) #define iter(it,c) for (auto it = (c).begin(); it != (c).end(); ++it) typedef pair ii; typedef vector vi; typedef vector vii; typedef vector vvi; typedef long long ll; const int INF = 2147483647; int main() { cin.sync_with_stdio(false); int ts; cin >> ts; vi found; rep(t,0,ts) { int n; cin >> n; vi arr(n); rep(i,0,n) { cin >> arr[i]; } bool ok = true; rep(i,0,n) { bool below = false; rep(j,i+1,n) { if (arr[j] < arr[i]) { below = true; } if (arr[j] > arr[i] && below) { ok = false; break; } } if (!ok) { break; } } if (!ok) { found.push_back(t); } } cout << found.size() << endl; iter(it,found) { cout << *it+1 << endl; } return 0; }