結果
問題 | No.2198 Concon Substrings (COuNt-CONstruct Version) |
ユーザー |
|
提出日時 | 2022-12-30 00:15:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 729 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 56,064 KB |
最終ジャッジ日時 | 2024-06-23 08:46:14 |
合計ジャッジ時間 | 8,305 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 104 |
ソースコード
import sys,random,bisectfrom collections import deque,defaultdictfrom heapq import heapify,heappop,heappushfrom itertools import permutationsfrom math import log,gcdinput = lambda :sys.stdin.readline()mi = lambda :map(int,input().split())li = lambda :list(mi())M = int(input())N = [0,0,0]for i in range(3)[::-1]:t = 10**(4*i)N[i] = M // tM -= N[i] * tres = []C = [1,100,9999]O = [1,99,9900]for i in range(3):res.append("c"*C[i])res.append("o"*O[i])res.append("n"*N[i])S = "".join(res)print(S)"""T = "con"dp = [0,0,0,0]dp[0] = 1for s in S:ndp = dp.copy()for i in range(3):if s == T[i]:ndp[i+1] += dp[i]dp = ndpassert dp[3] == M"""