Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Numerics;
- class Solution {
- static void Main(String[] args) {
- int N = Convert.ToInt32(Console.ReadLine());
- string[] B_temp = Console.ReadLine().Split(' ');
- int[] B = Array.ConvertAll(B_temp,Int32.Parse);
- int oddCount=0,start=-1,end=0,result = 0;
- //List<Vector2> pairs = new List<Vector2>();
- for(int i=0;i<N;i++){
- if(B[i]%2!=0) {
- oddCount++;
- if(start==-1) start = i;
- else{
- end = i;
- result += (end-start)*2;
- start=-1;
- end=-1;
- }
- }
- }
- if(oddCount%2==0){
- Console.WriteLine(result);
- }else{
- Console.WriteLine("NO");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement