From 6fb808554f1bd6c81a1e8e3e78ba0fbd5a9c04cb Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Wed, 19 Jul 2023 14:53:23 +0600 Subject: [PATCH] initial commit --- 1367B Even Array/1367B.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 1367B Even Array/1367B.cpp 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