MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Codeforces_problems/Balanced ArrayB/solution.cpp:39–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38
39int main()
40{
41 std::ios::sync_with_stdio(false); //fastio
42 int T;
43 cin>>T;
44 while(T--)
45 {
46 ll n;
47 cin>>n;
48 if(n%4 == 2){
49 cout<<"NO"<<endl;
50 continue;
51 }else{
52 cout<<"YES"<<endl;
53 }
54 ll s= 0;
55 for(int i = 0;i<n/2;i++){
56 cout<<2*(i +1 )<<" ";
57 s += 2*(i+1);
58 }
59 for(int i = 0;i<(n/2) - 1;i++){
60 cout<<2*i + 1<<" ";
61 s -= 2*i + 1;
62 }
63 cout<<s<<endl;
64 }
65 return 0;
66}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected