Submission #2408219

Source Code Expand

Copy
```n = int(input())
xs = [int(c) for c in input().split()]
ys = [int(c) for c in input().split()]

def dp(x, y, mods):
if y > x:
return False
table = [False] * (x + 1)
table[x] = True
mods.sort(reverse=True)
for mod in mods:
for i in range(x + 1):
table[i % mod] = table[i % mod] or table[i]
return table[y]

def ok(mods):
return all(dp(x, y, list(mods)) for x, y in zip(xs, ys))

if not ok(range(1, 51)):
print(-1)
quit(0)

mods = []
for mod in range(50, 0, -1):
if not ok(mods + list(range(1, mod))):
mods.append(mod)

print(sum(2 ** mod for mod in mods))```

#### Submission Info

Submission Time 2018-04-24 09:33:44+0900 C - Remainder Game amylase PyPy3 (2.4.0) 700 619 Byte AC 285 ms 43248 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt, s4.txt, s5.txt
All 700 / 700 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt, 52.txt, 53.txt, s1.txt, s2.txt, s3.txt, s4.txt, s5.txt
Case Name Status Exec Time Memory
01.txt 176 ms 39152 KB
02.txt 247 ms 41968 KB
03.txt 173 ms 39152 KB
04.txt 208 ms 41840 KB
05.txt 257 ms 42864 KB
06.txt 222 ms 41584 KB
07.txt 247 ms 41584 KB
08.txt 177 ms 38768 KB
09.txt 169 ms 38512 KB
10.txt 166 ms 38256 KB
11.txt 171 ms 38256 KB
12.txt 220 ms 42352 KB
13.txt 246 ms 41968 KB
14.txt 232 ms 41584 KB
15.txt 258 ms 42480 KB
16.txt 249 ms 41584 KB
17.txt 263 ms 41712 KB
18.txt 253 ms 41584 KB
19.txt 265 ms 41584 KB
20.txt 249 ms 41584 KB
21.txt 265 ms 41584 KB
22.txt 259 ms 41584 KB
23.txt 285 ms 41584 KB
24.txt 247 ms 41968 KB
25.txt 247 ms 41584 KB
26.txt 239 ms 41584 KB
27.txt 252 ms 41968 KB
28.txt 255 ms 42352 KB
29.txt 265 ms 43120 KB
30.txt 262 ms 41584 KB
31.txt 247 ms 41968 KB
32.txt 173 ms 39024 KB
33.txt 253 ms 41968 KB
34.txt 207 ms 40688 KB
35.txt 273 ms 41584 KB
36.txt 203 ms 40688 KB
37.txt 247 ms 41584 KB
38.txt 205 ms 40688 KB
39.txt 253 ms 41584 KB
40.txt 200 ms 40688 KB
41.txt 263 ms 41584 KB
42.txt 215 ms 40688 KB
43.txt 262 ms 41584 KB
44.txt 233 ms 41584 KB
45.txt 253 ms 41584 KB
46.txt 233 ms 41584 KB
47.txt 267 ms 42480 KB
48.txt 229 ms 41584 KB
49.txt 226 ms 43248 KB
50.txt 218 ms 41584 KB
51.txt 225 ms 43248 KB
52.txt 215 ms 41712 KB
53.txt 254 ms 41712 KB
s1.txt 173 ms 39152 KB
s2.txt 180 ms 39152 KB
s3.txt 165 ms 38256 KB
s4.txt 187 ms 40304 KB
s5.txt 186 ms 39152 KB