結果
問題 | No.3014 岩井満足性問題 |
ユーザー |
![]() |
提出日時 | 2025-01-25 15:13:05 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,477 bytes |
コンパイル時間 | 585 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 26,112 KB |
最終ジャッジ日時 | 2025-01-25 23:42:32 |
合計ジャッジ時間 | 41,834 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 4 TLE * 8 |
ソースコード
#import sys#input = lambda: sys.stdin.readline().rstrip()# sys.setrecursionlimit(10**7)# sys.set_int_max_str_digits(10**6)# import pypyjit# pypyjit.set_param('max_unroll_recursion=-1')def mp():return map(int,input().split())def lmp():return list(map(int,input().split()))def lm1(LIST): return list(map(lambda x:x-1, LIST))def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]def stoi(LIST):return list(map(int,LIST))def itos(LIST):return list(map(str,LIST))def atoi(LIST): return [ord(i)-ord("a") for i in LIST]def Atoi(LIST): return [ord(i)-ord("A") for i in LIST]def LT(LIST,N): return LIST[bisect.bisect_left(LIST,N)-1]def LE(LIST,N): return LIST[bisect.bisect_right(LIST,N)-1]def GT(LIST,N): return LIST[bisect.bisect_right(LIST,N)]def GE(LIST,N): return LIST[bisect.bisect_left(LIST,N)]def bitA(X,A):return X & 1<<A == 1<<Adef gtoi(x,y,h,w):return x*w+yimport mathimport bisectimport heapqimport timeimport random as rdimport itertoolsfrom copy import copy as ccfrom copy import deepcopy as dcfrom itertools import accumulate, productfrom collections import Counter, defaultdict, deque# from atcoder.dsu import DSU# from atcoder.fenwicktree import FenwickTree# from atcoder.segtree import SegTree # (op, ide_ele, LIST)# from atcoder.lazysegtree import LazySegTree # (op, ide_ele, mapping, composition, _id, lst)def ceil(U,V):return (U+V-1)//Vdef modf1(N,MOD):return (N-1)%MOD+1def pmat(list):for i in list:print(*i)m4 = [[1,0],[0,1],[-1,0],[0,-1]]m8 = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]inf = (1<<63)-1mod = 998244353n,d,K = mp()a = lmp()c = lmp()dp = [[-inf]*(K+1) for i in range(d+1)]dp[0][0] = 0for i in range(n):nxt = [[-inf]*(K+1) for _ in range(d+1)]for j in range(d):for k in range(K+1):if dp[j][k] == -inf:continuenxt[j+1][min(K,k+c[i])] = max(nxt[j+1][min(K,k+c[i])], dp[j][k]+a[i])nxt[j][k] = max(nxt[j][k],dp[j][k])dp = nxtans = dp[d][K]if ans ==-inf:print("No")else:print(ans)## s = input()# if len(s) < 3:# print(0)# exit()# ind = -1# for i in range(len(s)-2):# if s[i] == "1" and s[i+1] == "1" and s[i+2] == "0":# ind = i# break# if ind == -1:# print(0)# exit()# co = 0# ans = 0# for i in range(ind,len(s)):# if s[i] == "1":co += 1# if s[i] == "0":# ans += ceil((co-1),2)# if co % 2 == 1:co-=1# print(ans)#