Why is it giving wrong answer ?It is clearing all the testcases that I can think of.What is the testcase that I am missing?
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
typedef long long int ll;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
vector<int> v;
//int count=0;
rep(i,0,n)
{
int n1;
cin>>n1;
if (n1 == 1)
cout<<1<<" ";
else
v.push_back(n1);
}
if (v.size()){
sort(v.begin(),v.end(),greater<int>());
if (v[v.size()-1]==2 && v[v.size()-2]==3)
swap(v[v.size()-1],v[v.size()-2]);
rep(i,0,v.size())
{
cout<<v[i]<<" ";
}
}
cout<<endl;
}
return 0;
}