Hackerrank Even Odd Query Solution

Warning: I dont know sharing it will violate terms of Hackerrank, please feel free to warn me if it does so. As far as I know, related leaderboard is locked.

Hackerrank Weekly Challenges - Week 5 - Even Odd Query: Programming Problems and Competitions :: HackerRank

Hackerrank Weekly Challenges - Week 5 - Even Odd Query Solution: 9FWoNy - Online C++ Compiler & Debugging Tool - Ideone.com

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
 int n, a[100005], q, x, y;
 scanf("%d", &n);
 for(int i=1; i<=n; i++) scanf("%d", &a[i]);
 scanf("%d", &q);
 while(q--) {
  scanf("%d%d", &x, &y);
  if((a[x]%2==1) || (a[x+1]==0 && x<y)) printf("Odd\n");
  else printf("Even\n");
 }
 return 0;
}

note: it goes like a[x]^a[x+1]^a[x+2]^…^a[y]^1, so the fundamental base is always a[x] and power is 1 if x==y, otherwise power is a[x+1] and it goes on. so just pay attn to value of power is zoer, say a[x+1]=0 or a[x+whatsoever]=0, then that zero will render base to 1. i hope you already know that even^whatsoever_except_zero=even and odd^anything_except_zero=odd.
one last thing, you can also check other AC solutions from leaderboard in case you still did not get idea or want to dive deeper. at the time of this writing any editorial has not been published yet.