message
stringlengths
2
23.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
97
109k
cluster
float64
0
0
__index_level_0__
int64
194
217k
Provide a correct Python 3 solution for this coding contest problem. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq 3000 Input Input is given from Standard Input in the f...
instruction
0
28,911
0
57,822
"Correct Solution: ``` s=input() t=input() a=len(s) b=len(t) dp=[[0]*(b+1) for i in range(a+1)] for i in range(a): for j in range(b): if s[i]==t[j]: dp[i+1][j+1]=dp[i][j]+1 else: dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]) res='' while a!=0 and b!=0: if dp[a][b]==dp[a-1][b]: a-=1 elif dp[a][b]...
output
1
28,911
0
57,823
Provide a correct Python 3 solution for this coding contest problem. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq 3000 Input Input is given from Standard Input in the f...
instruction
0
28,912
0
57,824
"Correct Solution: ``` s = input() t = input() lenS = len(s) lenT = len(t) dp = [] for i in range(lenS+1): dp.append([0]*(lenT+1)) for i in range(1,lenS+1): for j in range(1,lenT+1): if s[i-1]==t[j-1]: dp[i][j]=dp[i-1][j-1]+1 else: dp[i][j]=max(dp[i-1][j],dp[i][j-1]) ans=...
output
1
28,912
0
57,825
Provide a correct Python 3 solution for this coding contest problem. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq 3000 Input Input is given from Standard Input in the f...
instruction
0
28,913
0
57,826
"Correct Solution: ``` s = input() t = input() ls = len(s) lt = len(t) ans = "" dp = [[0]*(ls+1) for i in range(lt+1)] for i in range(1,lt+1): for j in range(1,ls+1): dp[i][j] = max(dp[i-1][j],dp[i][j-1]) if s[j-1] == t[i-1]: dp[i][j] = dp[i-1][j-1]+1 i = lt j = ls while i-1>=0 and j-...
output
1
28,913
0
57,827
Provide a correct Python 3 solution for this coding contest problem. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq 3000 Input Input is given from Standard Input in the f...
instruction
0
28,914
0
57,828
"Correct Solution: ``` s=input() t=input() S=len(s) T=len(t) ans=[[0 for e in range(S+1)] for f in range(T+1)] chk=[] for a in range(1,T+1): for b in range(1,S+1): if t[a-1]==s[b-1]: ans[a][b]=ans[a-1][b-1]+1 else: if ans[a-1][b]>ans[a][b-1]: ans[a][b]=ans[a-1][b] else: ans[a][b]=ans[a][b-1] x,y=T...
output
1
28,914
0
57,829
Provide a correct Python 3 solution for this coding contest problem. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq 3000 Input Input is given from Standard Input in the f...
instruction
0
28,915
0
57,830
"Correct Solution: ``` s1=input() s2=input() n1=len(s1) n2=len(s2) dp=[[0 for i in range(n2+1)] for j in range(n1+1)] for i in range(1,n1+1): for j in range(1,n2+1): if s1[i-1]==s2[j-1]: dp[i][j]=1+dp[i-1][j-1] else: dp[i][j]=max(dp[i-1][j],dp[i][j-1]) s="" i,j=n1,n2 while ...
output
1
28,915
0
57,831
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,916
0
57,832
Yes
output
1
28,916
0
57,833
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,917
0
57,834
Yes
output
1
28,917
0
57,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,918
0
57,836
Yes
output
1
28,918
0
57,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,919
0
57,838
Yes
output
1
28,919
0
57,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,920
0
57,840
No
output
1
28,920
0
57,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,921
0
57,842
No
output
1
28,921
0
57,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,922
0
57,844
No
output
1
28,922
0
57,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given strings s and t. Find one longest string that is a subsequence of both s and t. Constraints * s and t are strings consisting of lowercase English letters. * 1 \leq |s|, |t| \leq ...
instruction
0
28,923
0
57,846
No
output
1
28,923
0
57,847
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,940
0
57,880
"Correct Solution: ``` a = list(map(lambda x: ord(x)-ord("a"), list(input()))) n = len(a) m = 26 b = [1]*(n+1) prev = [n]*m G = [[] for i in range(n+1)] for i in reversed(range(n)): ai = a[i] tmp = min(b[j] for j in prev) for j in prev: G[i].append(j) b[i] = tmp+1 prev[ai] = i cnt = min(b[...
output
1
28,940
0
57,881
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,941
0
57,882
"Correct Solution: ``` # coding: utf-8 # Your code here! import sys read = sys.stdin.read readline = sys.stdin.readline #n, = map(int,readline().split()) s = input() def next_index(N,s): D = [-1]*26 E = [None]*(N+1) cA = ord('a') for i in range(N-1, -1, -1): E[i+1] = D[:] D[ord(s[i])-c...
output
1
28,941
0
57,883
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,942
0
57,884
"Correct Solution: ``` S=input() N=len(S) a=ord('a') alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] K=[[N]*(N+1) for i in range(26)] for i in range(N-1,-1,-1): x=ord(S[i])-a for j in range(26): if j==x: K[j][i]=i co...
output
1
28,942
0
57,885
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,943
0
57,886
"Correct Solution: ``` from itertools import accumulate S = list(map(ord, input().strip())) N = len(S) atype = set() seg = [0]*N seg[-1] = 1 for i in range(N-1, -1, -1): atype.add(S[i]) if len(atype) == 26: atype = set() seg[i] = 1 inf = 1<<32 idx = [[inf]*N for _ in range(26)] for i in range...
output
1
28,943
0
57,887
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,944
0
57,888
"Correct Solution: ``` def main(): import sys input = sys.stdin.readline a = list(input())[:-1] #print(a) n = len(a) d = dict() for i in range(26): d[chr(i+97)] = chr(i+97) for i in range(n-1,-1,-1): min_key = 'zz' min_len = 10**9 for e in d: ...
output
1
28,944
0
57,889
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,945
0
57,890
"Correct Solution: ``` """ Writer: SPD_9X2 https://atcoder.jp/contests/arc081/tasks/arc081_c 1文字がありうるのは、出てない文字があるとき 2文字がありうるのは、全ての文字が1度出たのち、もう一度すべての文字が1度現れてない場合 つまり答えの文字数はこの方法で分かる では辞書順最小のものは? k文字であることがわかっていたとする。 この時、どの文字も最低k-1回出現している 最後の文字は、k回出現してない文字の内、辞書順最小の物 最後から1番目は、k-1回目の出現の後、最後の文字が出ていない者 最後から2番目は、 abcの3文字しかな...
output
1
28,945
0
57,891
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,946
0
57,892
"Correct Solution: ``` a = list(map(lambda x: ord(x)-ord("a"), list(input()))) n = len(a) m = 26 b = [0]*n pos = [[] for i in range(m)] s = set() cnt = 0 for i in reversed(range(n)): b[i] = cnt if a[i] not in s: s.add(a[i]) pos[a[i]].append(i) if len(s) == m: cnt += 1 s = set() ...
output
1
28,946
0
57,893
Provide a correct Python 3 solution for this coding contest problem. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `...
instruction
0
28,947
0
57,894
"Correct Solution: ``` from collections import deque alpha = "abcdefghijklmnopqrstuvwxyz" A = input() n = len(A) B = ord('a') links = [None]*(n+3) link = [n]*26 for i in range(n-1, -1, -1): links[i] = link[:] link[ord(A[i]) - B] = i links[-1] = link deq = deque() deq.append(-1) prev = {-1: (None, 0)} while d...
output
1
28,947
0
57,895
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,948
0
57,896
Yes
output
1
28,948
0
57,897
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,949
0
57,898
Yes
output
1
28,949
0
57,899
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,950
0
57,900
Yes
output
1
28,950
0
57,901
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,951
0
57,902
Yes
output
1
28,951
0
57,903
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,952
0
57,904
No
output
1
28,952
0
57,905
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,953
0
57,906
No
output
1
28,953
0
57,907
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,954
0
57,908
No
output
1
28,954
0
57,909
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and...
instruction
0
28,955
0
57,910
No
output
1
28,955
0
57,911
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice and Bob are playing a game on strings. Initially, they have some string t. In one move the first player selects the character c present in t and erases all it's occurrences in t, thus spl...
instruction
0
29,115
0
58,230
No
output
1
29,115
0
58,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice and Bob are playing a game on strings. Initially, they have some string t. In one move the first player selects the character c present in t and erases all it's occurrences in t, thus spl...
instruction
0
29,116
0
58,232
No
output
1
29,116
0
58,233
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice and Bob are playing a game on strings. Initially, they have some string t. In one move the first player selects the character c present in t and erases all it's occurrences in t, thus spl...
instruction
0
29,117
0
58,234
No
output
1
29,117
0
58,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice and Bob are playing a game on strings. Initially, they have some string t. In one move the first player selects the character c present in t and erases all it's occurrences in t, thus spl...
instruction
0
29,118
0
58,236
No
output
1
29,118
0
58,237
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,220
0
58,440
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` from sys import stdin,stdout,stderr def lcp(string): l=len(string) lis=[0]*l j=1 k=0 while j<l: if string[j]==string[k]: lis[j]=k+1 j+=1 k+=1 elif k>0: ...
output
1
29,220
0
58,441
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,222
0
58,444
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` ## necessary imports import sys input = sys.stdin.readline # from math import * # swap_array function def swaparr(arr, a,b): temp = arr[a]; arr[a] = arr[b]; arr[b] = temp ## gcd function def gcd(a,b): if a == 0: ...
output
1
29,222
0
58,445
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,223
0
58,446
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` P=input() m = len(P) f=[0]*m j=1 k=0 while j<m: if P[j]==P[k]: f[j]=k+1 j+=1 k+=1 elif k>0: k=f[k-1] else: j+=1 l=f.pop() if l: if l in f: print(P[:l]) elif f[l-1...
output
1
29,223
0
58,447
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,227
0
58,454
Yes
output
1
29,227
0
58,455
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,228
0
58,456
Yes
output
1
29,228
0
58,457
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,229
0
58,458
Yes
output
1
29,229
0
58,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,230
0
58,460
Yes
output
1
29,230
0
58,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,231
0
58,462
No
output
1
29,231
0
58,463
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,232
0
58,464
No
output
1
29,232
0
58,465
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,233
0
58,466
No
output
1
29,233
0
58,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little late...
instruction
0
29,234
0
58,468
No
output
1
29,234
0
58,469
Provide tags and a correct Python 3 solution for this coding contest problem. A and B are preparing themselves for programming contests. After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes. A l...
instruction
0
29,525
0
59,050
Tags: data structures, dp, two pointers Correct Solution: ``` x=list(map(int,input().split())) s=list(input().rstrip()) n=len(s) cx=[0]*(n+1) for i in range(1,n+1): cx[i]=x[ord(s[i-1])-ord("a")] for i in range(1,n+1): cx[i]+=cx[i-1] pos=[{} for i in range(26)] ans=0 for i in range(n): ss=s[i] ans+=pos[ord(ss)-o...
output
1
29,525
0
59,051
Provide tags and a correct Python 3 solution for this coding contest problem. A and B are preparing themselves for programming contests. After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes. A l...
instruction
0
29,526
0
59,052
Tags: data structures, dp, two pointers Correct Solution: ``` xx = [int(i) for i in input().split()] s = input() x = [{} for _ in range(0,26)] ss = 0 ans = 0 for i in s: ans += x[ord(i)-97].get(ss,0) ss += xx[ord(i)-97] x[ord(i)-97][ss] = x[ord(i)-97].get(ss,0)+1 print(ans) ```
output
1
29,526
0
59,053
Provide tags and a correct Python 3 solution for this coding contest problem. A and B are preparing themselves for programming contests. After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes. A l...
instruction
0
29,527
0
59,054
Tags: data structures, dp, two pointers Correct Solution: ``` #!/usr/bin/env python import os import sys from io import BytesIO, IOBase #from bisect import bisect_left as bl #c++ lowerbound bl(array,element) #from bisect import bisect_right as br #c++ upperbound br(array,element) from coll...
output
1
29,527
0
59,055
Provide tags and a correct Python 3 solution for this coding contest problem. A and B are preparing themselves for programming contests. After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes. A l...
instruction
0
29,528
0
59,056
Tags: data structures, dp, two pointers Correct Solution: ``` w = [int(x) for x in input().split()] c = [{} for i in range(26)] val, s = 0, 0 for i in [ord(ch) - ord('a') for ch in input()]: if s - w[i] in c[i]: val += c[i][s - w[i]] c[i][s] = c[i][s] + 1 if s in c[i] else 1 s += w[i] print(val) ```
output
1
29,528
0
59,057
Provide tags and a correct Python 3 solution for this coding contest problem. A and B are preparing themselves for programming contests. After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes. A l...
instruction
0
29,529
0
59,058
Tags: data structures, dp, two pointers Correct Solution: ``` score=[] from collections import * z=list(map(int,input().split())) s=input() for i in range(26): score.append(defaultdict(int)) pre=[] total=0 for i in range(len(s)): s1=z[ord(s[i])-97] t=ord(s[i])-97 if(i==0): pre.append(s1) el...
output
1
29,529
0
59,059
Provide tags and a correct Python 3 solution for this coding contest problem. A and B are preparing themselves for programming contests. After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes. A l...
instruction
0
29,530
0
59,060
Tags: data structures, dp, two pointers Correct Solution: ``` score=[] from collections import * z=list(map(int,input().split())) s=input() for i in range(26): score.append(defaultdict(int)) pre=[] total=0 for i in range(len(s)): s1=z[ord(s[i])-97] t=ord(s[i])-97 if(i==0): pre.append(s1) el...
output
1
29,530
0
59,061