結果

問題 No.550 夏休みの思い出(1)
ユーザー convexineqconvexineq
提出日時 2021-02-26 01:18:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,051 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 61,904 KB
最終ジャッジ日時 2024-04-09 05:18:01
合計ジャッジ時間 5,249 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
60,040 KB
testcase_01 AC 54 ms
60,700 KB
testcase_02 AC 54 ms
61,240 KB
testcase_03 AC 54 ms
60,484 KB
testcase_04 AC 54 ms
61,760 KB
testcase_05 AC 55 ms
60,176 KB
testcase_06 AC 54 ms
61,708 KB
testcase_07 AC 55 ms
61,652 KB
testcase_08 AC 55 ms
60,524 KB
testcase_09 AC 55 ms
60,628 KB
testcase_10 AC 55 ms
61,776 KB
testcase_11 AC 53 ms
61,216 KB
testcase_12 AC 54 ms
59,796 KB
testcase_13 AC 55 ms
60,208 KB
testcase_14 AC 54 ms
60,184 KB
testcase_15 AC 54 ms
60,444 KB
testcase_16 AC 54 ms
60,972 KB
testcase_17 AC 55 ms
60,624 KB
testcase_18 AC 53 ms
61,376 KB
testcase_19 AC 55 ms
60,848 KB
testcase_20 AC 54 ms
60,624 KB
testcase_21 AC 55 ms
60,988 KB
testcase_22 AC 54 ms
60,824 KB
testcase_23 AC 54 ms
61,504 KB
testcase_24 AC 54 ms
61,372 KB
testcase_25 AC 55 ms
60,488 KB
testcase_26 AC 56 ms
61,292 KB
testcase_27 AC 54 ms
60,456 KB
testcase_28 AC 54 ms
60,724 KB
testcase_29 AC 54 ms
59,680 KB
testcase_30 AC 55 ms
61,552 KB
testcase_31 AC 54 ms
60,936 KB
testcase_32 AC 55 ms
60,864 KB
testcase_33 AC 55 ms
60,004 KB
testcase_34 AC 55 ms
60,364 KB
testcase_35 AC 56 ms
61,904 KB
testcase_36 AC 54 ms
61,768 KB
testcase_37 AC 54 ms
60,640 KB
testcase_38 AC 55 ms
61,640 KB
testcase_39 AC 54 ms
61,640 KB
testcase_40 AC 55 ms
61,260 KB
testcase_41 AC 54 ms
60,256 KB
testcase_42 AC 55 ms
60,504 KB
testcase_43 AC 55 ms
61,564 KB
testcase_44 AC 55 ms
60,740 KB
testcase_45 AC 55 ms
61,020 KB
testcase_46 AC 54 ms
60,208 KB
testcase_47 AC 54 ms
60,544 KB
testcase_48 AC 54 ms
60,208 KB
testcase_49 AC 55 ms
60,580 KB
testcase_50 AC 54 ms
60,792 KB
testcase_51 AC 55 ms
61,044 KB
testcase_52 AC 55 ms
60,720 KB
testcase_53 AC 54 ms
61,640 KB
testcase_54 AC 55 ms
60,292 KB
testcase_55 AC 56 ms
61,808 KB
testcase_56 AC 55 ms
60,528 KB
testcase_57 AC 54 ms
60,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def inv_gcd(x,y):
    if y==0: return 1,0
    r0,r1,s0,s1 = x,y,1,0
    while r1 != 0:
        a,b = divmod(r0,r1)
        r0, r1, s0, s1 = r1, b, s1, s0-a*s1
    return s0%y,r0 # s0*x + ??*y = r0 = gcd(x,y)

def Chinese_remainder_theorem(r,m):
    assert len(r)==len(m)
    r0, M0 = 0,1
    for r1, M1 in zip(r,m):
        if M0 < M1:
            r0,r1 = r1,r0
            M0,M1 = M1,M0
        minv,g = inv_gcd(M0,M1)
        Q,R = divmod(r1-r0,g)
        if R%g: return (0,0)
        M11 = M1//g
        r0 += Q%M11*minv%M11*M0
        M0 *= M11
    return r0,M0

def f(x): return ((x+a)*x+b)*x+c
def g(x): return (((x+a)%p*x+b)%p*x+c)%p

a,b,c = map(int,input().split())
res = []
primes = [100003, 100019, 100043]
for p in primes:
    r = []
    for i in range(p):
        if g(i) == 0: r.append(i)
    res.append(r)

from itertools import product
ans = []
P = 100003*100019*100043
for lst in product(*res):
    x = Chinese_remainder_theorem(lst,primes)[0]
    if f(x) == 0: ans.append(x)
    if f(x-P) == 0: ans.append(x-P)
ans.sort()
print(*ans)
0