Hi Alex, I haven't tried it during the contest, but here comes what I think about your solution.
Let's say N = 100 so you send the numbers {1, 2, 3, ..., 100} to the judge. Let's assume the judge sends you back {101, 10^9, 10^9-1, ..., 10^9-98}. It's possible since the only guarantee given is that the sum of the 2N numbers will be even. Now let's start with the "big" numbers: we have 99 of them: 10^9, 10^9-1,...,10^9-98. Any partition of these numbers into to disjoint subsets will create two sums with difference bigger than 10^8. (One of the subsets will have more elements than the other.) Now all the small numbers (1,2,3,..,101) are not enough to make up for this big difference since 1+2+3+...+101 < 10^8 Regards, Peter karpov...@gmail.com a következőt írta (2022. április 18., hétfő, 17:03:03 UTC+2): > Hi expert. > I am a beginner in Python. > I try to solve Equal Sum problem, but my submission is failed and I can't > see test cases. > Sample test cases are successful. > Maybe someone can help with fix code below. > > *def getX(nums,x):* > > * for i in nums:* > * if sum(x) == sum(nums):* > * return x* > > * x.insert(0,i)* > * nums.remove(i)* > * if sum(x) == sum(nums):* > * return x* > * elif sum(x) > sum(nums):* > * x.remove(i)* > * nums.insert(0,i)* > * else:* > * getX(nums,x)* > > *def main():* > * T = int(input())* > * for t in range(1, T+1):* > * N = int(input())* > > * A = [i for i in range(N)]* > * print(*A, flush=True)* > > * *B, = map(int, input().split())* > > * N = A+B* > > * N.sort(reverse=True)* > > * X = getX(nums=N,x=[])* > > * print(*X, flush=True)* > > *main()* > > Best Regard, Alex. > -- -- You received this message because you are subscribed to the Google Groups Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/google-code?hl=en --- 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 google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/1e92257b-483d-4eea-ab0f-95722cded7a9n%40googlegroups.com.