Submission #56989855
Source Code Expand
Copy
import sysrints = lambda: list(map(int, sys.stdin.readline().split()))M = 60L = int(1e5)N, K = rints()A = list(range(L)) # 最初の遷移を入れる配列for i in range(L):j = iy = 0while j > 0:y += j % 10j //= 10A[i] = (i + y) % Ldp = [[0] * L for _ in range(M + 1)]dp[0] = Afor i in range(M):for j in range(L):dp[i + 1][j] = dp[i][dp[i][j]]
import sys rints = lambda: list(map(int, sys.stdin.readline().split())) M = 60 L = int(1e5) N, K = rints() A = list(range(L)) # 最初の遷移を入れる配列 for i in range(L): j = i y = 0 while j > 0: y += j % 10 j //= 10 A[i] = (i + y) % L dp = [[0] * L for _ in range(M + 1)] dp[0] = A for i in range(M): for j in range(L): dp[i + 1][j] = dp[i][dp[i][j]] ans = N p = 0 while K > 0: if K & 1: ans = dp[p][ans] p += 1 K >>= 1 print(ans)
Submission Info
Submission Time | |
---|---|
Task | 058 - Original Calculator(★4) |
User | gigolo |
Language | Python (PyPy 3.10-v7.3.12) |
Score | 4 |
Code Size | 539 Byte |
Status | AC |
Exec Time | 116 ms |
Memory | 130584 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 4 / 4 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt |
All | 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 03_fixed_01.txt, 03_fixed_02.txt, 03_fixed_03.txt, 03_fixed_04.txt, 03_fixed_05.txt, 03_fixed_06.txt, 04_special_01.txt, 04_special_02.txt, 04_special_03.txt, 04_special_04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01_sample_01.txt | AC | 111 ms | 130232 KB |
01_sample_02.txt | AC | 110 ms | 130360 KB |
01_sample_03.txt | AC | 110 ms | 130076 KB |
02_random_01.txt | AC | 110 ms | 130268 KB |
02_random_02.txt | AC | 112 ms | 130580 KB |
02_random_03.txt | AC | 116 ms | 129976 KB |
02_random_04.txt | AC | 113 ms | 130152 KB |
02_random_05.txt | AC | 111 ms | 130004 KB |
02_random_06.txt | AC | 112 ms | 130260 KB |
02_random_07.txt | AC | 113 ms | 130484 KB |
02_random_08.txt | AC | 112 ms | 130024 KB |
02_random_09.txt | AC | 115 ms | 130300 KB |
02_random_10.txt | AC | 110 ms | 130008 KB |
02_random_11.txt | AC | 111 ms | 130188 KB |
02_random_12.txt | AC | 111 ms | 130212 KB |
02_random_13.txt | AC | 111 ms | 130164 KB |
02_random_14.txt | AC | 110 ms | 130024 KB |
02_random_15.txt | AC | 110 ms | 130452 KB |
03_fixed_01.txt | AC | 111 ms | 130056 KB |
03_fixed_02.txt | AC | 111 ms | 130536 KB |
03_fixed_03.txt | AC | 110 ms | 130156 KB |
03_fixed_04.txt | AC | 110 ms | 130272 KB |
03_fixed_05.txt | AC | 110 ms | 130584 KB |
03_fixed_06.txt | AC | 110 ms | 130496 KB |
04_special_01.txt | AC | 111 ms | 130216 KB |
04_special_02.txt | AC | 111 ms | 130208 KB |
04_special_03.txt | AC | 111 ms | 130444 KB |
04_special_04.txt | AC | 110 ms | 130256 KB |