Submission #35040426


Source Code Expand

Copy
def binary_search(N):
l=0
r=2000000000
while r-l>1:
m=(r+l)//2
if m*(m+1)//2 <= N+1:
l=m
else:
r=m
print(N+1-l)
N=int(input())
binary_search(N)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
def binary_search(N):
    l=0
    r=2000000000
    while r-l>1:
        m=(r+l)//2
        if m*(m+1)//2 <= N+1:
            l=m
        else:
            r=m
    print(N+1-l)

N=int(input())

binary_search(N)

Submission Info

Submission Time
Task B - log
User progra
Language PyPy3 (7.3.0)
Score 400
Code Size 222 Byte
Status AC
Exec Time 58 ms
Memory 61932 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 33
Set Name Test Cases
Sample sample.txt, sample_2.txt
All 1.txt, 1000000000000000000.txt, 11200.txt, 124503869.txt, 1312150450968416.txt, 15630162310904.txt, 19228110662.txt, 2.txt, 252509054433933446.txt, 27596462479.txt, 3.txt, 335408917861648771.txt, 39435.txt, 4.txt, 5.txt, 522842184971407774.txt, 55074593704796560.txt, 5952398887941493.txt, 5952398887941494.txt, 5952398887941495.txt, 635722518108209.txt, 645762258982631931.txt, 779547116602436425.txt, 812742.txt, 8150428669018.txt, 819875141880895727.txt, 822981260158260521.txt, 84324828731963981.txt, 919845426262703496.txt, 999999998765257139.txt, 999999999999999999.txt, sample.txt, sample_2.txt
Case Name Status Exec Time Memory
1.txt AC 58 ms 61720 KB
1000000000000000000.txt AC 51 ms 61716 KB
11200.txt AC 43 ms 61912 KB
124503869.txt AC 49 ms 61788 KB
1312150450968416.txt AC 49 ms 61932 KB
15630162310904.txt AC 52 ms 61740 KB
19228110662.txt AC 47 ms 61692 KB
2.txt AC 46 ms 61888 KB
252509054433933446.txt AC 50 ms 61684 KB
27596462479.txt AC 49 ms 61892 KB
3.txt AC 48 ms 61732 KB
335408917861648771.txt AC 47 ms 61744 KB
39435.txt AC 49 ms 61724 KB
4.txt AC 48 ms 61776 KB
5.txt AC 48 ms 61648 KB
522842184971407774.txt AC 50 ms 61888 KB
55074593704796560.txt AC 47 ms 61736 KB
5952398887941493.txt AC 51 ms 61776 KB
5952398887941494.txt AC 50 ms 61904 KB
5952398887941495.txt AC 49 ms 61876 KB
635722518108209.txt AC 49 ms 61872 KB
645762258982631931.txt AC 52 ms 61888 KB
779547116602436425.txt AC 50 ms 61896 KB
812742.txt AC 49 ms 61924 KB
8150428669018.txt AC 47 ms 61912 KB
819875141880895727.txt AC 51 ms 61832 KB
822981260158260521.txt AC 47 ms 61784 KB
84324828731963981.txt AC 46 ms 61900 KB
919845426262703496.txt AC 50 ms 61900 KB
999999998765257139.txt AC 49 ms 61840 KB
999999999999999999.txt AC 53 ms 61904 KB
sample.txt AC 48 ms 61844 KB
sample_2.txt AC 52 ms 61908 KB


2025-04-24 (Thu)
21:39:59 +00:00