Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Codechef-2021/SEPT21C/Prefix_Sums.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#pragma GCC optimize ("trapv")
#include <bits/stdc++.h>
#include<algorithm>
#include <vector>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<cstdlib>
#include<sstream>
#include <string.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first
#define ss second
#define pp pair<ll,ll>
#define ll long long
#define ld long double
#define endl "\n"

const ll mod=1e9+7;
void solve()
{
ll n, a=0,b=0,m=1, c=-1,k=0, i=0, j=0, l=1e9+5;
string s,p, q;
cin>>n;
a=(n*(n+1))/2;
if(n%2 || a%2) cout<<"NO"<<endl;
else{
cout<<"YES"<<endl;
vector<ll>v,vec;
rep(i,1,n+1){
if(i<=(n/4) || i>n-n/4) v.pb(i);
else vec.pb(i);
}
rep(i,0,v.size()) cout<<v[i]<<" ";
cout<<endl;
rep(i,0,vec.size()) cout<<vec[i]<<" ";
cout<<endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin. tie(0);cout. tie(0);
ll t=1;
cin>>t;
while(t--)
{
solve();
}
return 0;
}