Advertisement
Ankit_132

C

Apr 13th, 2024
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll     long long
  5. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  6. #define ff     first
  7. #define ss     second
  8. #define pb     push_back
  9.  
  10. int main()
  11. {
  12.     _test
  13.     {
  14.         int n;
  15.         cin>>n;
  16.         int ans=0;
  17.         for(int i=1;i<=n;i++) ans+=1ll*i*(2*i-1);
  18.  
  19.         cout<<ans<<" "<<n*2<<"\n";
  20.  
  21.         for(int i=n;i;i--){
  22.  
  23.             cout<<1<<" "<<i<<" ";
  24.             for(int j=1;j<=n;j++) cout<<j<<" ";
  25.             cout<<"\n";
  26.  
  27.             cout<<2<<" "<<i<<" ";
  28.             for(int j=1;j<=n;j++) cout<<j<<" ";
  29.             cout<<"\n";
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement