Hi there,
i write my code in c++ and python 3 as well but both of them showing 
Runtime error when i submit my attempt at codejam, You plese tell me, what 
is wrong in my code.
Following in my Python3 code:

def mergeSort(arr):
>     if len(arr) > 1:
>         mid = len(arr) // 2  # Finding the mid of the array
>         L = arr[:mid]  # Dividing the array elements
>         R = arr[mid:]  # into 2 halves
>
>         mergeSort(L)  # Sorting the first half
>         mergeSort(R)  # Sorting the second half
>
>         i = j = k = 0
>
>         # Copy data to temp arrays L[] and R[]
>         while i < len(L) and j < len(R):
>             if L[i] < R[j]:
>                 arr[k] = L[i]
>                 i += 1
>             else:
>                 arr[k] = R[j]
>                 j += 1
>             k += 1
>
>         # Checking if any element was left
>         while i < len(L):
>             arr[k] = L[i]
>             i += 1
>             k += 1
>
>         while j < len(R):
>             arr[k] = R[j]
>             j += 1
>             k += 1
> q = int(input())
> for _ in range(1,q+1):
>     n,l = map(int, input().split(" "))
>     input_list = list(input().split(" "))
>
>     arr = [True]*(n+1)
>     arr[0] = False
>     arr[1] = False
>     arr[2] = False
>     alpha = {}
>     p = 2
>     count = 0
>     while p*p <= n:
>         z = 0
>         for i in range(p*2,n+1,p):
>             if(arr[i]==True):
>                 arr[i] = False
>                 count += 1
>         p += 1
>     val = n-count
>     prime = []
>
>     for i in range(n+1):
>         if arr[i] == True:
>             prime.append(i)
>     flag  = False
>     seprated_primes = []
>     seprated_primes_duplicate = []
>     for i in range(len(prime)-1):
>         for j in range(len(prime)):
>             if(int(prime[i])*int(prime[j]) == int(input_list[0])):
>                 seprated_primes.append(int(prime[i]))
>                 seprated_primes.append(int(prime[j]))
>                 flag = True
>                 break
>         if flag:
>             break
>
>     check = seprated_primes[len(seprated_primes)-1]
>     # print(len(input_list))
>     # print(l)
>     for i in range(1,l):
>         t = int(input_list[i])//check
>         check = t
>         seprated_primes.append(t)
>     for i in range(l+1):
>         seprated_primes_duplicate.append(seprated_primes[i])
>     mergeSort(seprated_primes)
>     pre = -1
>     character = 65
>     for i in range(l+1):
>         if pre == seprated_primes[i]:
>             continue
>         alpha[seprated_primes[i]] = chr(character)
>         pre = seprated_primes[i]
>         character += 1
>     result = ""
>     for i in range(l+1):
>         result += alpha[seprated_primes_duplicate[i]]
>     print("Case #{}: {}".format(_,result))
>
>

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/c76efb51-a3a3-45f3-83a3-b2f7660ea14a%40googlegroups.com.

Reply via email to