Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define ll long long
- #include <bits/stdc++.h>
- #include <stdio.h>
- using namespace std;
- int main()
- {
- int t;
- cin>>t;
- while(t--)
- {
- int n;
- cin>>n;
- if(n%2==0)
- {
- cout<<n/2<<endl;
- for(int i=1;i<=n;i=i+2)
- {
- printf("2 %d %d\n",i,i+1);
- }
- }
- else
- {
- if(n==1)
- {
- cout<<"1"<<endl;
- cout<<"1 1"<<endl;
- }
- else
- {
- cout<<n/2<<endl;
- cout<<"3 1 2 3"<<endl;
- for(int i=4;i<=n;i=i+2)
- {
- printf("2 %d %d\n",i,i+1);
- }
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment