Submission #2226793


Source Code Expand

def count(seq):
    seq = sorted(seq)
    arrived = {}
    arrived[seq[0]] = {}
    arrived[seq[0]][seq[1]] = True
    foo = 0
    s = sum(seq)
    while True:
        if (seq[0]&1==1) or (seq[1]&1==1) or (seq[2]&1==1):
            break
        seq = [(s-seq[i])>>1 for i in xrange(3)]
        seq = sorted(seq)
        if seq[0] in arrived.keys():
            if seq[1] in arrived[seq[0]].keys():
                foo = -1
                break
        else:
            arrived[seq[0]] = {}
        arrived[seq[0]][seq[1]] = True
        foo += 1
    return foo

def main():
    seq = [int(x) for x in raw_input().strip().split()]
    print count(seq)

if __name__ == '__main__':
    main()

Submission Info

Submission Time
Task A - Cookie Exchanges
User jki14
Language Python (2.7.6)
Score 300
Code Size 721 Byte
Status AC
Exec Time 12 ms
Memory 2696 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 17
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
in1.txt AC 10 ms 2696 KB
in10.txt AC 11 ms 2696 KB
in11.txt AC 11 ms 2696 KB
in2.txt AC 11 ms 2696 KB
in3.txt AC 11 ms 2696 KB
in4.txt AC 11 ms 2696 KB
in5.txt AC 11 ms 2696 KB
in6.txt AC 10 ms 2696 KB
in7.txt AC 12 ms 2696 KB
in8.txt AC 10 ms 2696 KB
in9.txt AC 11 ms 2696 KB
sample1.txt AC 10 ms 2696 KB
sample2.txt AC 11 ms 2696 KB
sample3.txt AC 11 ms 2696 KB