Submission #64744688


Source Code Expand

Copy
n,k=map(int,input().split())
mod=10**9
cc=k
from collections import deque
q=deque()
if k>n:
exit(print(1))
for i in range(k):
q.append(1)
cc=k
for _ in range(n-k):
q.append(cc)
cc+=cc
if len(q)>k:
cc-=q.popleft()
cc%=mod
print(cc)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
n,k=map(int,input().split())
mod=10**9
cc=k
from collections import deque
q=deque()
if k>n:
    exit(print(1))
for i in range(k):
    q.append(1)
cc=k
for _ in range(n-k):
    q.append(cc)
    cc+=cc
    if len(q)>k:
        cc-=q.popleft()
    cc%=mod
print(cc)

Submission Info

Submission Time
Task C - K-bonacci
User juntenbanana
Language Python (PyPy 3.10-v7.3.12)
Score 300
Code Size 278 Byte
Status AC
Exec Time 89 ms
Memory 90636 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 34
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_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 68 ms 76792 KB
00_sample_01.txt AC 68 ms 76688 KB
00_sample_02.txt AC 85 ms 88436 KB
01_random_00.txt AC 68 ms 76836 KB
01_random_01.txt AC 71 ms 76792 KB
01_random_02.txt AC 68 ms 76780 KB
01_random_03.txt AC 87 ms 87656 KB
01_random_04.txt AC 83 ms 84204 KB
01_random_05.txt AC 69 ms 76872 KB
01_random_06.txt AC 84 ms 90528 KB
01_random_07.txt AC 85 ms 87688 KB
01_random_08.txt AC 69 ms 76784 KB
01_random_09.txt AC 88 ms 84740 KB
01_random_10.txt AC 84 ms 89252 KB
01_random_11.txt AC 79 ms 81528 KB
01_random_12.txt AC 83 ms 86624 KB
01_random_13.txt AC 73 ms 81756 KB
01_random_14.txt AC 74 ms 81904 KB
01_random_15.txt AC 75 ms 81952 KB
01_random_16.txt AC 72 ms 82036 KB
01_random_17.txt AC 82 ms 88732 KB
01_random_18.txt AC 81 ms 89504 KB
01_random_19.txt AC 72 ms 81860 KB
01_random_20.txt AC 88 ms 87896 KB
01_random_21.txt AC 88 ms 87916 KB
01_random_22.txt AC 85 ms 87908 KB
01_random_23.txt AC 89 ms 88060 KB
01_random_24.txt AC 87 ms 87880 KB
01_random_25.txt AC 68 ms 76992 KB
01_random_26.txt AC 81 ms 83144 KB
01_random_27.txt AC 81 ms 83056 KB
01_random_28.txt AC 68 ms 77024 KB
01_random_29.txt AC 80 ms 90636 KB
01_random_30.txt AC 68 ms 76708 KB


2025-04-26 (Sat)
20:44:12 +09:00