Submission #52348766
Source Code Expand
#ABC349_20240413_D
L,R=map(int,input().split())
now=L
ans=[]
if(now==0):
p=1
while p*2<=R:
p*=2
ans.append((now,p))
now=p
while(now!=R):
if(now%2==1):
ans.append((now,now+1))
now+=1
else:
s=0
j=now
flg=1
while(flg):
j//=2
s+=1
if(j%2==0 and j!=0):
continue
else:
flg=0
#s:nowを何回2で割れるか
#j:now=2**s*j
# now=2**(s-1)*j*2///
for i in range(s,-1,-1):
if(R>=(2**i)*(j+1)):
rnow=(2**i)*(j+1)
break
else:
j*=2
ans.append((now,rnow))
now=rnow
print(len(ans))
for i in ans:
print(i[0],i[1])
Submission Info
| Submission Time | |
|---|---|
| Task | D - Divide Interval |
| User | Konini |
| Language | Python (PyPy 3.10-v7.3.12) |
| Score | 450 |
| Code Size | 821 Byte |
| Status | AC |
| Exec Time | 63 ms |
| Memory | 81456 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 450 / 450 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 59 ms | 76440 KiB |
| 00_sample_02.txt | AC | 59 ms | 76328 KiB |
| 00_sample_03.txt | AC | 58 ms | 76376 KiB |
| 01_test_01.txt | AC | 60 ms | 76500 KiB |
| 01_test_02.txt | AC | 60 ms | 76320 KiB |
| 01_test_03.txt | AC | 60 ms | 76304 KiB |
| 01_test_04.txt | AC | 62 ms | 80640 KiB |
| 01_test_05.txt | AC | 62 ms | 80824 KiB |
| 01_test_06.txt | AC | 63 ms | 80888 KiB |
| 01_test_07.txt | AC | 62 ms | 80820 KiB |
| 01_test_08.txt | AC | 61 ms | 81024 KiB |
| 01_test_09.txt | AC | 62 ms | 80588 KiB |
| 01_test_10.txt | AC | 61 ms | 80688 KiB |
| 01_test_11.txt | AC | 63 ms | 81456 KiB |
| 01_test_12.txt | AC | 61 ms | 80520 KiB |
| 01_test_13.txt | AC | 61 ms | 80848 KiB |
| 01_test_14.txt | AC | 61 ms | 81016 KiB |
| 01_test_15.txt | AC | 60 ms | 80988 KiB |
| 01_test_16.txt | AC | 61 ms | 80504 KiB |
| 01_test_17.txt | AC | 61 ms | 80736 KiB |
| 01_test_18.txt | AC | 61 ms | 80592 KiB |
| 01_test_19.txt | AC | 62 ms | 80848 KiB |
| 01_test_20.txt | AC | 60 ms | 80628 KiB |
| 01_test_21.txt | AC | 58 ms | 76388 KiB |
| 01_test_22.txt | AC | 61 ms | 81180 KiB |
| 01_test_23.txt | AC | 61 ms | 80568 KiB |
| 01_test_24.txt | AC | 61 ms | 80820 KiB |
| 01_test_25.txt | AC | 58 ms | 76284 KiB |
| 01_test_26.txt | AC | 58 ms | 76500 KiB |
| 01_test_27.txt | AC | 58 ms | 76536 KiB |
| 01_test_28.txt | AC | 58 ms | 76352 KiB |
| 01_test_29.txt | AC | 59 ms | 76192 KiB |