結果
問題 | No.1694 ZerOne |
ユーザー | ophhdn |
提出日時 | 2021-10-01 22:18:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 373 ms / 2,000 ms |
コード長 | 1,506 bytes |
コンパイル時間 | 264 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 101,008 KB |
最終ジャッジ日時 | 2024-07-19 11:48:02 |
合計ジャッジ時間 | 8,225 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
80,640 KB |
testcase_01 | AC | 121 ms
80,200 KB |
testcase_02 | AC | 121 ms
80,512 KB |
testcase_03 | AC | 246 ms
89,116 KB |
testcase_04 | AC | 100 ms
80,416 KB |
testcase_05 | AC | 128 ms
81,508 KB |
testcase_06 | AC | 97 ms
80,388 KB |
testcase_07 | AC | 118 ms
81,188 KB |
testcase_08 | AC | 131 ms
81,296 KB |
testcase_09 | AC | 215 ms
89,560 KB |
testcase_10 | AC | 118 ms
81,664 KB |
testcase_11 | AC | 96 ms
80,492 KB |
testcase_12 | AC | 99 ms
80,412 KB |
testcase_13 | AC | 142 ms
83,320 KB |
testcase_14 | AC | 215 ms
89,276 KB |
testcase_15 | AC | 125 ms
81,368 KB |
testcase_16 | AC | 122 ms
81,228 KB |
testcase_17 | AC | 101 ms
80,700 KB |
testcase_18 | AC | 99 ms
80,132 KB |
testcase_19 | AC | 96 ms
80,640 KB |
testcase_20 | AC | 97 ms
80,760 KB |
testcase_21 | AC | 373 ms
101,008 KB |
testcase_22 | AC | 99 ms
80,896 KB |
testcase_23 | AC | 369 ms
100,896 KB |
testcase_24 | AC | 322 ms
94,252 KB |
testcase_25 | AC | 307 ms
94,044 KB |
testcase_26 | AC | 106 ms
80,864 KB |
testcase_27 | AC | 316 ms
98,200 KB |
testcase_28 | AC | 209 ms
86,376 KB |
testcase_29 | AC | 191 ms
86,248 KB |
testcase_30 | AC | 219 ms
88,732 KB |
testcase_31 | AC | 265 ms
91,664 KB |
testcase_32 | AC | 268 ms
91,792 KB |
testcase_33 | AC | 286 ms
94,972 KB |
ソースコード
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from copy import deepcopy import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from operator import mul from functools import reduce from pprint import pprint from copy import deepcopy from math import gcd, log2,atan2,atan,sin,cos,pi import functools import typing def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS(): return sys.stdin.readline().split() def S(): return sys.stdin.readline().strip() def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod=10**9+7 INF=10**30 s=S() n=len(s) idx_list=[] c=s.count("1") for d in range(n): if s[d]=="1": idx_list+=[d] dp=[[defaultdict(int) for _ in range(n)] for _ in range(c+1)] dp[0][0][0]=1 for i in range(c): idx=idx_list[i] for pre in range(n): dd=dp[i][pre] for j in range(pre+1 if i else 0,n): diff=idx-j for k,v in dd.items(): dp[i+1][j][k+diff]+=v ans=0 for f in range(n): ans+=dp[c][f][0] print(ans)