diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-01-14 20:41:09 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-01-14 20:41:09 +0700 |
commit | ce56bd193a7c8c6437443227cd3abb51134e3e7a (patch) | |
tree | 590c003d9f99e9912e0618a8c77d73ed2b481d20 /codechef/hp18.py | |
parent | bf538954817e568322c83030dd2fbc688a3ee13d (diff) | |
download | cp-ce56bd193a7c8c6437443227cd3abb51134e3e7a.tar.gz |
At least I managed to stay in top 10%
Diffstat (limited to 'codechef/hp18.py')
-rwxr-xr-x | codechef/hp18.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/codechef/hp18.py b/codechef/hp18.py new file mode 100755 index 0000000..153ec19 --- /dev/null +++ b/codechef/hp18.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +from functools import reduce +from math import gcd + +for t in range(int(input())): + N, a, b = map(int, input().split()) + lcm = a * b // gcd(a, b) + rm = map(lambda x: (x%a==0, x%lcm==0, x%b==0), map(int, input().split())) + Bob, both, Alice = reduce(lambda x, y: map(int.__add__, x, y), rm) + print('BOB' if Bob + bool(both) > Alice else 'ALICE') |