Task: | Kasat |
Sender: | |
Submission time: | 2015-09-12 21:49:46 +0300 |
Language: | Python2 |
Status: | READY |
Result: | 79 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | ACCEPTED | 33 |
#3 | ACCEPTED | 46 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.06 s | 1 | details |
#2 | ACCEPTED | 0.07 s | 2 | details |
#3 | ACCEPTED | 0.07 s | 3 | details |
Code
import sysimport mathimport itertoolsfrom collections import defaultdict#sys.stdin.readline().rstrip()t = int(sys.stdin.readline().rstrip())for i in xrange(t):nums = map(int, sys.stdin.readline().rstrip().split())a,b,c = sorted(nums[:3])tot = sum([a,b,c])end = [tot//3]*3for i in range(tot % 3):end[-i] += 1n = nums[3]#print end, tot, sum([abs(a-end[0]), abs(b-end[1]), abs(c-end[2])]), n//2if tot % 3 == 0 and sum([abs(a-end[0]), abs(b-end[1]), abs(c-end[2])])//2 <= n:qweqwe = sum([abs(a-end[0]), abs(b-end[1]), abs(c-end[2])])n -= qweqwe//2a = b = c = tot//3if n % 2 == 1:print a-1,b,c+1else:print a,b,ccontinued1 = b-ad2 = c-ba += min(d1, d2, n)c -= min(d1, d2, n)n -= min(d1, d2, n)d = max(b-a, c-b)#print a,b,c,n,int(math.ceil(d*2./3))if n > 0 and n < int(math.ceil(d*2./3)):if a < b:a += nif n % 2 == 0:b -= n//2c -= n//2else:b -= n//2 - 1c -= n//2else:c -= nif n % 2 == 0:a += n//2b += n//2else:a += n//2b += n//2 + 1elif n > 0:a = b = c = tot//3if tot % 3 == 1:c += 1if tot % 3 == 2:b += 1c += 1print a,b,c'''c -= nm = res % 3:res = [tot//3]*3for i in range(m):res[i] += 1else:if a < b:a += min(b-a, n)n -= min(b-a, n)elif c > b:a += min(b-a, n)d = min(max(b-a, c-b), n)'''
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
1000 7 69 64 45 37 5 30 81 50 49 37 38 46 37 100 6 ... |
correct output |
---|
46 47 47 24 24 24 45 45 46 43 46 94 32 32 33 ... |
user output |
---|
46 47 47 24 24 24 45 45 46 43 46 94 32 32 33 ... |
Test 2
Group: 2
Verdict: ACCEPTED
input |
---|
1000 19 13 88 978977859 67 57 39 960003440 81 16 67 971611942 92 96 2 957979201 ... |
correct output |
---|
39 40 41 54 54 55 54 55 55 63 63 64 36 37 38 ... |
user output |
---|
39 40 41 54 54 55 54 55 55 63 63 64 36 37 38 ... |
Test 3
Group: 3
Verdict: ACCEPTED
input |
---|
1000 211358104 753479603 549127067 ... |
correct output |
---|
504654924 504654925 504654925 589019272 589019272 589019273 101309993 101309994 101309994 436205296 436205297 436205298 351062567 351062568 351062568 ... |
user output |
---|
504654924 504654925 504654925 589019272 589019272 589019273 101309993 101309994 101309994 436205296 436205297 436205298 351062567 351062568 351062568 ... |