Submission #8802316
Source Code Expand
#!/usr/bin/env python3 import sys import numpy as np def solve(N: int): #9 ** 5 == 59049 < 10 ** 5 #6 ** 6 == 46656 < 10 ** 5 dp = [float("inf")]*(N + 1) dp[0] = 0 pull_list_9 = [9**i for i in range(1, 6)] pull_list_6 = [6**i for i in range(1, 7)] pull_list = np.array(pull_list_9 + pull_list_6 + [1]) p_s = sorted(pull_list) for i in range(1, N + 1): for j in p_s: if i - j < 0: break dp[i] = min(dp[i], dp[i-j] + 1) print(dp[-1]) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int solve(N) if __name__ == '__main__': main()
Submission Info
Submission Time | |
---|---|
Task | C - Strange Bank |
User | rokki_ac |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 777 Byte |
Status | TLE |
Exec Time | 2108 ms |
Memory | 14820 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1278 ms | 12772 KB |
02.txt | TLE | 2108 ms | 13156 KB |
03.txt | AC | 1186 ms | 12644 KB |
04.txt | AC | 1748 ms | 12900 KB |
05.txt | AC | 1450 ms | 12772 KB |
06.txt | AC | 147 ms | 12404 KB |
07.txt | AC | 147 ms | 12404 KB |
08.txt | AC | 148 ms | 12404 KB |
09.txt | AC | 147 ms | 12404 KB |
10.txt | AC | 156 ms | 12404 KB |
11.txt | AC | 871 ms | 12644 KB |
12.txt | TLE | 2108 ms | 13028 KB |
13.txt | AC | 505 ms | 12516 KB |
14.txt | AC | 155 ms | 12404 KB |
15.txt | AC | 258 ms | 14436 KB |
16.txt | TLE | 2108 ms | 13156 KB |
sample_01.txt | AC | 148 ms | 12404 KB |
sample_02.txt | AC | 147 ms | 12404 KB |
sample_03.txt | AC | 1296 ms | 14820 KB |