We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20c52d3 commit db68ec5Copy full SHA for db68ec5
1367B - Even Array.cpp
@@ -0,0 +1,37 @@
1
+// ॐ नमः शिवाय
2
+#include<bits/stdc++.h>
3
+using namespace std;
4
+
5
+// Code Written By: Vikash Patel
6
+// Codeforces Profile: https://codeforces.com/profile/vikashpatel
7
8
+int main()
9
+{
10
+ int t;
11
+ cin>>t;
12
+ while(t--)
13
+ {
14
+ int n;
15
+ cin>>n;
16
+ int a[n];
17
+ for(int i=0; i<n; i++)
18
19
+ cin>>a[i];
20
+ }
21
+ int od = 0, ev = 0;
22
23
24
+ if(i%2 != a[i]%2)
25
26
+ if(a[i]%2 == 1)
27
+ od++;
28
+ else
29
+ ev++;
30
31
32
+ if(od == ev)
33
+ cout<<od<<endl;
34
35
+ cout<<-1<<endl;
36
37
+}
0 commit comments