diff --git a/1367B Even Array/1367B.cpp b/1367B Even Array/1367B.cpp new file mode 100644 index 0000000..7f1893d --- /dev/null +++ b/1367B Even Array/1367B.cpp @@ -0,0 +1,35 @@ +#include +using namespace std; +using ll = long long; + + +void solve() +{ + int n; + cin>>n; + int odd_ct=0, even_ct=0; + for(int i=0; i < n; ++i) + { + int x; + cin>>x; + if(i%2==0 && x%2!=0) + even_ct++; + else if(i%2!=0 && x%2==0) + odd_ct++; + } + if(odd_ct!=even_ct) + cout<<-1<> TC; + cin.ignore(); + while (TC--) solve(); +} \ No newline at end of file