I was giving my first contest on codeforces yesterday but I got runtime error in answer I tried to figure our what was causing this but I didn't get anything can anyone please tell me where is the problem. Your help is much appreciated. Here is the link to the question that is "One and Two" -> https://mirror.codeforces.com/contest/1788/problem/A. Here is the link to my submission -> https://mirror.codeforces.com/contest/1788/submission/192907153
https://mirror.codeforces.com/contest/1788/submission/192915643
You can check out my implementation .
As array contains only 1 & 2 we just have to count no of 2's. If it is odd then we can't break the array into two sub arrays and if count is even then (count_of_2)/2 --> (let count of 2 is 6 then 3 in each subarray) if all are 1 then print 1 else print -1.Hope this is helpfull to you.
N.B: This might not be the best solution.
Sorry for my bad english...