Submission #68781947


Source Code Expand

# (2n+1)^2 + (4X-1) = m*m
# (m-(2n+1))*(m+(2n+1)) = (4X-1)
X = int(input())

Y = 4 * X - 1


aY = abs(Y)

divisors = []

d = 1
while d*d <= aY:
    if aY % d == 0:
        divisors.append(d)
        divisors.append(-d)
        other = aY // d
        if other != d:
            divisors.append(other)
            divisors.append(-other)

    d += 1

ans = []
for d in divisors:
    other = Y // d
    sm = (other + d) // 2
    dif = (other - d) // 2
    if dif % 2 == 0:continue
    m = sm
    n = (dif + 1) // 2
    ans.append(-n)

ans = sorted(set(ans))
print(len(ans))    
print(*ans)


Submission Info

Submission Time
Task G - sqrt(n²+n+X)
User catupper
Language Python (PyPy 3.10-v7.3.12)
Score 575
Code Size 628 Byte
Status AC
Exec Time 118 ms
Memory 81896 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 575 / 575
Status
AC × 3
AC × 63
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 01_handmade_16.txt, 01_handmade_17.txt, 01_handmade_18.txt, 01_handmade_19.txt, 01_handmade_20.txt, 01_handmade_21.txt, 01_handmade_22.txt, 01_handmade_23.txt, 01_handmade_24.txt, 01_handmade_25.txt, 01_handmade_26.txt, 01_handmade_27.txt, 01_handmade_28.txt, 01_handmade_29.txt, 01_handmade_30.txt, 01_handmade_31.txt, 01_handmade_32.txt, 01_handmade_33.txt, 01_handmade_34.txt, 01_handmade_35.txt, 01_handmade_36.txt, 01_handmade_37.txt, 01_handmade_38.txt, 01_handmade_39.txt, 01_handmade_40.txt, 01_handmade_41.txt, 01_handmade_42.txt, 01_handmade_43.txt, 01_handmade_44.txt, 01_handmade_45.txt, 01_handmade_46.txt, 01_handmade_47.txt, 01_handmade_48.txt, 01_handmade_49.txt, 02_radom_00.txt, 02_radom_01.txt, 02_radom_02.txt, 02_radom_03.txt, 02_radom_04.txt, 02_radom_05.txt, 02_radom_06.txt, 02_radom_07.txt, 02_radom_08.txt, 02_radom_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 56 ms 76692 KiB
00_sample_01.txt AC 56 ms 76796 KiB
00_sample_02.txt AC 57 ms 80960 KiB
01_handmade_00.txt AC 56 ms 76520 KiB
01_handmade_01.txt AC 57 ms 76508 KiB
01_handmade_02.txt AC 56 ms 76688 KiB
01_handmade_03.txt AC 56 ms 76480 KiB
01_handmade_04.txt AC 55 ms 76304 KiB
01_handmade_05.txt AC 56 ms 76488 KiB
01_handmade_06.txt AC 55 ms 76552 KiB
01_handmade_07.txt AC 56 ms 76484 KiB
01_handmade_08.txt AC 57 ms 76748 KiB
01_handmade_09.txt AC 56 ms 76512 KiB
01_handmade_10.txt AC 55 ms 76632 KiB
01_handmade_11.txt AC 55 ms 76456 KiB
01_handmade_12.txt AC 56 ms 76684 KiB
01_handmade_13.txt AC 55 ms 76480 KiB
01_handmade_14.txt AC 55 ms 76792 KiB
01_handmade_15.txt AC 55 ms 76628 KiB
01_handmade_16.txt AC 56 ms 76200 KiB
01_handmade_17.txt AC 56 ms 76212 KiB
01_handmade_18.txt AC 55 ms 76604 KiB
01_handmade_19.txt AC 55 ms 76592 KiB
01_handmade_20.txt AC 55 ms 76444 KiB
01_handmade_21.txt AC 116 ms 80748 KiB
01_handmade_22.txt AC 104 ms 81096 KiB
01_handmade_23.txt AC 105 ms 80768 KiB
01_handmade_24.txt AC 79 ms 81032 KiB
01_handmade_25.txt AC 87 ms 81124 KiB
01_handmade_26.txt AC 118 ms 81036 KiB
01_handmade_27.txt AC 116 ms 80812 KiB
01_handmade_28.txt AC 117 ms 80972 KiB
01_handmade_29.txt AC 115 ms 80744 KiB
01_handmade_30.txt AC 116 ms 80820 KiB
01_handmade_31.txt AC 114 ms 81152 KiB
01_handmade_32.txt AC 115 ms 80864 KiB
01_handmade_33.txt AC 116 ms 80992 KiB
01_handmade_34.txt AC 115 ms 81132 KiB
01_handmade_35.txt AC 116 ms 80696 KiB
01_handmade_36.txt AC 115 ms 80776 KiB
01_handmade_37.txt AC 118 ms 80848 KiB
01_handmade_38.txt AC 116 ms 81060 KiB
01_handmade_39.txt AC 116 ms 80928 KiB
01_handmade_40.txt AC 116 ms 80768 KiB
01_handmade_41.txt AC 115 ms 80800 KiB
01_handmade_42.txt AC 115 ms 80800 KiB
01_handmade_43.txt AC 115 ms 81000 KiB
01_handmade_44.txt AC 115 ms 80764 KiB
01_handmade_45.txt AC 116 ms 80864 KiB
01_handmade_46.txt AC 116 ms 80848 KiB
01_handmade_47.txt AC 117 ms 80768 KiB
01_handmade_48.txt AC 116 ms 80820 KiB
01_handmade_49.txt AC 115 ms 81896 KiB
02_radom_00.txt AC 107 ms 81152 KiB
02_radom_01.txt AC 100 ms 80848 KiB
02_radom_02.txt AC 81 ms 80728 KiB
02_radom_03.txt AC 113 ms 80892 KiB
02_radom_04.txt AC 112 ms 81068 KiB
02_radom_05.txt AC 100 ms 80916 KiB
02_radom_06.txt AC 94 ms 81088 KiB
02_radom_07.txt AC 86 ms 80724 KiB
02_radom_08.txt AC 101 ms 81008 KiB
02_radom_09.txt AC 108 ms 80760 KiB