problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p02935 | u967233756 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['import numpy as np\n\nn = int(input())\nv = np.array(list(map(int,input().split())))\nv_sort = np.sort(v)\ntemp = 0\n\nfor index in range(n-1):\n temp = int((v_sort[0]+v_sort[1])/2)\n v_sort = np.delete(v_sort,0)\n v_sort = np.delete(v_sort,0)\n v_sort = np.append(v_sort,temp)\n v_sort = np.sort(v_sort)\n\nprint... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s309169706', 's725861187', 's868482673'] | [12396.0, 12396.0, 12392.0] | [151.0, 160.0, 150.0] | [320, 315, 310] |
p02935 | u970109776 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['#include <math.h>\n\n#include <algorithm>\n\n#include <map>\n#include <string>\n\n\nusing namespace std;\n\nint main() {\n int N;\n cin >> N;\n vector<double> V(N);\n for (size_t i = 0; i < N; i++) {\n cin >> V[i];\n }\n\n while (V.size() != 1) {\n sort(V.rbegin(), V.rend());\n int a = V.back();\n V... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s383218730', 's627832101', 's790748440', 's832078108'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [479, 479, 494, 160] |
p02935 | u971096161 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['N = int(input())\nV = list(map(int, input().split()))\n\nV = sorted(V)\n\nans = 0.0\n\nfor v in V:\n ans += v\n ans /=2.0\n \nprint(ans)', 'N = int(input())\nV = list(map(int, input().split()))\n\nV = sorted(V)\n\nans = V[0]\n\nfor v in V[1:]:\n ans += v\n ans /=2.0\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s140975781', 's630554211'] | [2940.0, 3064.0] | [17.0, 18.0] | [128, 133] |
p02935 | u972658925 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['n = int(input())\nv = sorted(list(map(int,input().split())))\n\nfor _ in range(n-1):\n x = v[0]\n y = v[1]\n num = (x+y)/2\n del v[0]\n v[0] = num\n\nprint(int(v[0]))', 'n = int(input())\nv = sorted(list(map(int,input().split())))\n\nfor _ in range(n-1):\n x = v[0]\n y = v[1]\n num = (x+y)/2\n... | ['Wrong Answer', 'Accepted'] | ['s358962210', 's619468169'] | [9060.0, 9204.0] | [33.0, 31.0] | [171, 166] |
p02935 | u974320150 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['total_num = int(input())\nmaterials = input().split()\n\nfor key,value in enumerate(materials):\n materials[key] = int(value)\n\nmaterials.sort()\ntotal_value = materials[0] + materials[1] / 2\n\n\nmaterials.pop(0)\nmaterials.pop(0)\n\nfor index,value in enumerate(materials):\n if(index + 1 <= total_num - 2):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s144709432', 's968173158', 's383550990'] | [3064.0, 3064.0, 3060.0] | [17.0, 19.0, 18.0] | [419, 429, 424] |
p02935 | u974665134 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['N = int(input())\nA = sorted(list(map(int, input().split())))\n\nfor i in range N-1\n\tA[i+1] = A[i] + A[i+1]\n\n print(A[N-1])', 'N = int(input())\nA = sorted(list(map(int, input().split())))\n\nfor i in range(N-1):\n A[i+1] = (A[i] + A[i+1])/2\n\n print(A[N-1])', 'N = int(input())\nA = sorted(list(map(int, input... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s300478732', 's328634505', 's821158815', 's866788250', 's390052492'] | [2940.0, 2940.0, 2940.0, 3064.0, 3060.0] | [17.0, 17.0, 17.0, 18.0, 17.0] | [120, 129, 125, 126, 138] |
p02935 | u982152304 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['n = int(input())\nv = list(map(int, input().split()))\n\nv.sort()\n\nmean = v[0]\nfor i in v:\n mean = (mean + v)/2\n\n \nprint(mean)', 'n = int(input())\nv = list(map(int, input().split()))\n\nv.sort()\n\nmean = v[0]\nfor i in v:\n mean = (mean + i)/2\n\n \nprint(mean)'] | ['Runtime Error', 'Accepted'] | ['s507691905', 's467728265'] | [2940.0, 3316.0] | [17.0, 23.0] | [125, 125] |
p02935 | u985125584 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['import math\n\nN = int(input())\nv = list(map(int, input().split()))\n\nv.sort(reverse=True)\n\nwhile len(v) > 1:\n v.append((v.pop() + v.pop())/2)\n\nprint(v)\n\n\n\n\n\n\n', 'import math\n\nN = int(input())\nv = list(map(int, input().split()))\n\nv.sort(reverse=True)\n\nwhile len(v) > 1:\n v.append((v.pop() +... | ['Wrong Answer', 'Accepted'] | ['s744314579', 's235237377'] | [2940.0, 2940.0] | [18.0, 17.0] | [159, 162] |
p02935 | u985963315 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['N = int(input())\nL = list(map(int, input()))\nL.sorted\nans = reduce(lambda x, y: (x + y)/2, L)\nprint(ans)', 'from functools import reduce\nN = int(input())\nL = list(map(int, input().split()))\nL.sort()\nprint(reduce(lambda x, y: (x + y)/2, L))'] | ['Runtime Error', 'Accepted'] | ['s480427520', 's538216784'] | [2940.0, 3572.0] | [17.0, 22.0] | [104, 131] |
p02935 | u987164499 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['n = int(input())\nv = list(map(int,input().split()))\n\nv.sort()\n\nvalue = v[0]\n\nfor i in range(1,n):\n value = (value+v[i])//2\n\nprint(value)', 'n = int(input())\nv = list(map(int,input().split()))\n\nv.sort()\nans = v[0]\n\nfor i in range(1,n):\n ans = (ans+v[i])/2\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s898235261', 's094593929'] | [2940.0, 9076.0] | [17.0, 26.0] | [139, 129] |
p02935 | u989654188 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['n = int(input())\nv = list(map(int,input().split()))\n\nv = sorted(v)\nprint(v)\ndef dfs (l):\n if len(l)==1:\n return l[0]\n num = (l[0]+l[1])/2.0\n l = l[2:]\n # print(l)\n l.append(num)\n # print(l)\n l = sorted(l)\n return dfs(l)\n\n\n\nprint(dfs(v))', 'import sys\nsys.setrecursion... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s649013424', 's697205953', 's475741081'] | [3064.0, 3064.0, 3064.0] | [17.0, 19.0, 17.0] | [268, 471, 270] |
p02935 | u992648619 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['n = int(input())\nv = map(int, input().split())\n\nv.sort()\n\nvalue = v[0]\nfor i in range(1, len(v)):\n value = (value + v[i]) / 2\n\nprint(value) \n ', 'n = int(input())\nv = list(map(int, input().split()))\n\nv.sort()\n\nvalue = v[0]\nfor i in range(1, len(v)):\n value = (value + v[i]) / 2\n\nprint... | ['Runtime Error', 'Accepted'] | ['s798916729', 's061409729'] | [2940.0, 2940.0] | [18.0, 17.0] | [156, 147] |
p02935 | u993435350 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['N = int(input())\nL = sorted(list(map(int, input().split())))\n\nprint(L)\n\nfor i in range(0,N - 1):\n L [i+1] = (L[i] + L[i+1]) / 2\n\nprint(L[N-1])\n\n', 'N = int(input())\nL = sorted(list(map(int, input().split())))\n\nfor i in range(0,N - 1):\n L [i+1] = (L[i] + L[i+1]) / 2\n\nprint(L[N-1])'] | ['Wrong Answer', 'Accepted'] | ['s975047472', 's630216158'] | [2940.0, 3064.0] | [18.0, 18.0] | [145, 133] |
p02935 | u994882034 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['N = int(input())\na = list(map(int,input().split()))\n\ndef ave(c1,c2):\n av = (c1 + c2)/2\n return av\n\nfor i in range(N-1):\n for j in range(i+1,N):\n if a[j] <= a[i]:\n tmp = a[i]\n a[i] = a[j]\n a[j] =tmp\nprint(a)\n\nfor i in range(N-1):\n average = ave(a[0],a[1])\n a.pop(0)\n a.pop(0)\n... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s098992380', 's231140455', 's352254939', 's790297246', 's812449986', 's728903546'] | [3064.0, 3064.0, 3316.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 21.0, 20.0, 18.0, 17.0] | [339, 330, 350, 337, 328, 162] |
p02935 | u998082063 | 2,000 | 1,048,576 | You have a pot and N ingredients. Each ingredient has a real number parameter called _value_ , and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 wh... | ['n = int(input())\ns = list(map(int,input().split()))\nmin_ave = 100000\nfor i, val in enumerate(s):\n for j, val2 in enumerate(s):\n if i == j:\n continue\n ave = (val + val2) / 2\n if min_ave > ave:\n min_ave = ave \nprint((max(s) + min_ave)/2)', 'n = int(input())\nlis =... | ['Wrong Answer', 'Accepted'] | ['s858334116', 's672812256'] | [3060.0, 2940.0] | [19.0, 17.0] | [281, 124] |
p02937 | u007550226 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\nls,lt = len(s),len(t)\ni = j = 0\nsi = lp = 0\nwhile True:\n tc = t[i]\n si = s.find(tc)\n if si == -1:\n print(-1)\n exit(0)\n else:\n if i == lt-1:\n print(lp*ls + si+1)\n exit(0)\n else:\n while True:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s343983097', 's860265954', 's313984504'] | [3316.0, 3316.0, 3444.0] | [864.0, 1069.0, 946.0] | [668, 677, 680] |
p02937 | u028620830 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import itertools\n\ns = input()\nt = input()\nobj = {}\n\nloop_num = 0\ntemp_num = -1\n\nfor i in range(len(s)):\n char = s[i]\n if not (char in obj):\n obj[char] = [i]\n else:\n obj[char].append(i)\n\nfor i in range(len(t)):\n char = t[i]\n if not (char in obj):\n loop_num = -1\n ... | ['Runtime Error', 'Accepted'] | ['s934569566', 's216595017'] | [7564.0, 7540.0] | [53.0, 151.0] | [627, 637] |
p02937 | u036340997 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\n\nfor i in range(len(t)):\n if not t[i] in s:\n print(-1)\n break\nelse:\n j = 0\n for i in rane(len(t)):\n j = s[j:].find(t[i])\n if j == -1:\n counter += 1\n j = s.find(t[i])\n print(counter * len(s) + j + 1)', 's = input()\nt = input()\n\nfor i in range(len(t)):\... | ['Runtime Error', 'Accepted'] | ['s071515203', 's699585760'] | [3316.0, 3316.0] | [321.0, 921.0] | [248, 295] |
p02937 | u052499405 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["#!/usr/bin/env python3\n \nimport sys\n\nfrom heapq import heappush, heappop, heappushpop\nfrom collections import defaultdict\n\n\ninput = sys.stdin.readline\n \nS = input()\nT = input()\nlenS = len(S)\nlenT = len(T)\nF1 = [False]*26\nF2 = [False]*26\nalpha = 'abcdefghijklmnopqrstuvwxyz'\nfor i in range(lenS):\n ... | ['Runtime Error', 'Accepted'] | ['s225196451', 's719687626'] | [3692.0, 3952.0] | [55.0, 1989.0] | [705, 680] |
p02937 | u066253157 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\n\ns_ = s[:]\n\nti = 0\nans = 0\nflag = True\n\nwhile ti < len(t):\n si = s_.find(t[ti])\n \n if si != -1:\n ans += si + 1\n s_ = s_[si+1:]\n ti += 1\n flag = False\n else:\n if flag:\n print(-1)\n flag = False\n ... | ['Wrong Answer', 'Accepted'] | ['s298174483', 's462043231'] | [3456.0, 3456.0] | [1771.0, 1760.0] | [403, 360] |
p02937 | u077291787 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['# ABC138E - Strings of Impurity\nimport sys\ninput = sys.stdin.readline\n\ndef main():\n S = input()\n T = input()\n if set(T) <= set(S):\n lim_s, lim_t = len(S) - 1, len(T)\n ans, cur, idx = 1, 0, -1\n while cur < lim_t:\n x = S[idx + 1 :].find(T[cur])\n if x == -1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s237814032', 's631227101', 's859782935'] | [3316.0, 3316.0, 8052.0] | [884.0, 884.0, 101.0] | [579, 541, 790] |
p02937 | u094191970 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s=input()\nt=input()\n\nans=0\ns_inx=0\nt_inx=0\ns_l=len(s)\nt_l=len(t)\n\nc=0\nwhile t_inx<=t_l-1:\n try:\n temp_inx=s[s_inx:].index(t[t_inx])\n s_inx+=temp_inx+1\n t_inx+=1\n c=0\n except:\n c+=1\n s_inx=0\n ans+=s_l\n\n if c==2:\n print(-1)\n exit()\nelse:\n ans+=s_inx+1\n\nprint(ans... | ['Wrong Answer', 'Accepted'] | ['s321473701', 's945844928'] | [3316.0, 3316.0] | [973.0, 967.0] | [292, 290] |
p02937 | u098012509 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\n\nincluding = True\nfor x in t:\n if x not in s:\n including = False\n break\nif not including:\n print(-1)\n return\n\n\nx = 0\ny = 0\nwhile True:\n index = x % len(s)\n if s[index] == t[y]:\n y += 1\n if y == len(t):\n break\n x += ... | ['Runtime Error', 'Accepted'] | ['s126129716', 's575766959'] | [3064.0, 7540.0] | [18.0, 191.0] | [312, 500] |
p02937 | u107639613 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["import bisect\n\ns = input()\nt = input()\nT = set(t)\ns_num = len(s)\nt_num = len(T)\n\n# make a dictonary whose keys are the alphabets in t\ndict = {}\nappearing_times = {}\n\n# when each alphabet in t appears in s\nfor w in T:\n dict[w] = []\n appearing_times[w] = 0\n index = -1\n while True:\n ... | ['Runtime Error', 'Accepted'] | ['s786064538', 's042216174'] | [7284.0, 7284.0] | [190.0, 175.0] | [953, 996] |
p02937 | u133886644 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['use std::io::stdin;\nuse std::time::SystemTime;\nuse std::collections::HashMap;\n\n#[allow(dead_code)]\nfn read_line() -> String {\n let mut s = String::new();\n stdin().read_line(&mut s).unwrap();\n s.trim().to_string()\n}\n\n#[allow(dead_code)]\nfn read<T>() -> T\nwhere T: std::str::FromStr\n{\n read_li... | ['Runtime Error', 'Accepted'] | ['s693506060', 's845336449'] | [2940.0, 11100.0] | [17.0, 130.0] | [2180, 1067] |
p02937 | u139112865 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["#138_E\nfrom bisect import bisect_left, bisect_right\n\ns = input()\nt = input()\nif set(s) >= set(t):\n al_idx = [[] for _ in range(26)]\n ss = s * 2\n alp = 'abcdefghijklmnopqrstuvwxyz'\n for i in range(len(ss)):\n al_idx[alp.index(ss[i])].append(i)\n \n tmp = -1\n ans = 0\n for j in ... | ['Wrong Answer', 'Accepted'] | ['s768714439', 's564416075'] | [13276.0, 12020.0] | [308.0, 215.0] | [590, 571] |
p02937 | u141610915 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from collections import defaultdict as dd\nfrom bisect import bisect_left as bl\ns = input()\nt = input()\nind = dd(list)\nres = 0\nfor i in range(len(s)):\n ind[s[i]].append(i)\n#print(ind)\nfor i in range(len(t)):\n if len(ind[t[i]]) == 0:\n print(-1)\n exit(0)\n temp = bl(ind[t[i]], res % len(s))\n #prin... | ['Runtime Error', 'Accepted'] | ['s381490744', 's503403148'] | [7924.0, 3316.0] | [213.0, 1349.0] | [518, 165] |
p02937 | u169138653 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["from bisect import bisect_left\ndef main():\n s=input()\n t=input()\n n=len(t)\n m=len(s)\n lindex=[[] for _ in range(26)]\n for i in range(m):\n if s[i] in t:\n lindex[ord(s[i])-97].append(i)\n for i in range(n):\n if len(lindex[ord(t[i])-97])==0:\n print(-1)\n exit()\n cnt=0\n for i in... | ['Runtime Error', 'Accepted'] | ['s818903176', 's820168321'] | [7540.0, 7668.0] | [329.0, 382.0] | [489, 577] |
p02937 | u175743386 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\ns_len = len(s)\nt_len = len(t)\ns_list = [s[i] for i in range(s_len)]\nstr_sum = 0\nfor i in range(t_len):\n try:\n num = s_list.index(t[i])\n str_num += num+1\n s_list = s_list[num+1:] + s_list[:num+1]\n except:\n str_num = -1\n break\nprint(str_num) ', 'from collections i... | ['Wrong Answer', 'Accepted'] | ['s609844307', 's678281302'] | [4084.0, 7924.0] | [25.0, 133.0] | [282, 573] |
p02937 | u191874006 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["#!/usr/bin/env python3\n#ABC138 E\n\nimport sys\nimport math\nimport bisect\nsys.setrecursionlimit(1000000000)\nfrom heapq import heappush, heappop,heappushpop\nfrom collections import defaultdict\nfrom itertools import accumulate\nfrom collections import Counter\nfrom collections import deque\nfrom operator import i... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s665509548', 's738966291', 's058545325'] | [10820.0, 5364.0, 3980.0] | [918.0, 2104.0, 1520.0] | [1166, 1168, 937] |
p02937 | u201660334 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import bisect\n\ns = input()\nt = input()\nn = len(s)\ns0 = {}\nfor i in range(n):\n s0.setdefault(s[i], [])\n s0[s[i]].append(i)\nprint(s0)\nnum1 = 0\nnum2 = -1\nflag = True\nfor i in t:\n if i not in s:\n flag = False\n break\n num = bisect.bisect_right(s0[i], num2)\n if num == len(s0[i... | ['Wrong Answer', 'Accepted'] | ['s851075464', 's738677761'] | [14868.0, 13460.0] | [264.0, 209.0] | [471, 439] |
p02937 | u222668979 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['print(-1)', 'from bisect import bisect_left as bisect\nfrom collections import defaultdict\n\n\ns, t = input(), input()\nlens, sets = len(s), set(s)\n\nif not all(i in sets for i in t):\n print(-1)\n exit()\n\nalp = defaultdict(list)\nfor i, si in enumerate(s):\n alp[si].append(i)\n\nans, cnt = 1 - lens, 0\n... | ['Wrong Answer', 'Accepted'] | ['s745301107', 's209648082'] | [9068.0, 13724.0] | [32.0, 156.0] | [9, 479] |
p02937 | u237513745 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from collections import defaultdict\nimport bisect\ns = input()\nt = input()\nls = len(s)\ndbls = s*2\nidx = 0\nans = 0\ndic = defaultdict(list)\n\nfor i, c in enumerate(dbls):\n dic[c] += [i+1]\n\nprint(dbls)\n\nfor c in t:\n if not c in dic.keys():\n print(-1)\n exit()\n lst = dic[c]\n i =... | ['Wrong Answer', 'Accepted'] | ['s953327071', 's140214286'] | [12660.0, 12404.0] | [189.0, 199.0] | [474, 461] |
p02937 | u254871849 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["import sys\nfrom bisect import bisect_left as bi_l\nfrom collections import defaultdict\n\n\ndef main():\n s, t = sys.stdin.read().split()\n print(s, t)\n if set(t) - set(s):\n print(-1)\n sys.exit()\n\n n = len(s)\n s *= 2\n c = defaultdict(list)\n for i in range(n * 2):\n c... | ['Wrong Answer', 'Accepted'] | ['s051468768', 's185938747'] | [12524.0, 12652.0] | [108.0, 401.0] | [584, 627] |
p02937 | u296518383 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s=input() \nt=input() \nsa=list(s)\nta=list(t)\n#print(set(sa))\n#print(set(ta))\n\nif len(set(ta)-set(sa))>0:\n print(-1)\n\n', 's=input() \nt=input() \nsa=list(s)\nta=list(t)\nans2=0\nx=0\ny=0\nans= [[] for i in range(26)]\nfor i in range(len(s)):\n ans[ord(sa[i])-96-1].append(i)\nprint(ans)\nfor i in range... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s137238367', 's298177045', 's402221758', 's027286667'] | [4852.0, 12900.0, 4852.0, 7696.0] | [25.0, 2104.0, 22.0, 182.0] | [210, 816, 604, 494] |
p02937 | u297574184 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["from bisect import bisect_left, bisect_right\nimport sys\n\ndef solve():\n numChar = 26\n ordA = ord('a')\n\n Ss = input().rstrip()\n Ts = input().rstrip()\n\n lenS = len(Ss)\n Ss = [ord(S)-ordA for S in Ss]\n Ts = [ord(T)-ordA for T in Ts]\n\n setS, setT = set(Ss), set(Ts)\n for T in setT:... | ['Wrong Answer', 'Accepted'] | ['s829742604', 's955727007'] | [18328.0, 14700.0] | [141.0, 120.0] | [722, 662] |
p02937 | u311636831 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import bisect\ns = input()\nt = input()\nlens=len(s)\nlent=len(t)\nd = {}\n\nfor i in range(lens):\n if s[i] in d:\n d[s[i]].append(i)\n else:\n d[s[i]] = [i]\n\ntmp=0\nr=0\nsnum=0\nfor i in range(lent):\n if d.get(t[i],None)==None:\n print("-1")\n exit()\n else:\n lis=d... | ['Wrong Answer', 'Accepted'] | ['s731160324', 's193835980'] | [9588.0, 12148.0] | [2104.0, 207.0] | [495, 472] |
p02937 | u363315718 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["import sys\nfrom collections import defaultdict\nsys.setrecursionlimit(10**7)\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef II(): return int(sys.stdin.readline())\ndef LS(): return list(map(list, sys.stdin.readline().split()))\ndef S(): return sys.stdin.readlin... | ['Wrong Answer', 'Accepted'] | ['s773722401', 's807384315'] | [3316.0, 9300.0] | [20.0, 102.0] | [817, 845] |
p02937 | u367130284 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from bisect import*\ns=input()\nt=input()\nif set(t)<=set(s):\n d={}\n for k,j in enumerate(s*2):\n if j in d:\n d[j].append(k)\n else:\n d[j]=[k]\n print(d)\n now=-1\n ans=0\n for _,i in enumerate(t):\n nex=d[i][bisect_right(d[i],now)]\n ans+=nex-no... | ['Wrong Answer', 'Accepted'] | ['s651367978', 's029642432'] | [16428.0, 13232.0] | [202.0, 167.0] | [469, 400] |
p02937 | u375616706 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from collections import defaultdict\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nS = input()[:-1]\nT = input()[:-1]\n\n\nif any(t not in S for t in T):\n print(-1)\n exit()\n\n\nD = defaultdict(lambda: set())\nmin_D = defaultdict(lambda: len(S)+1)\nfor i, s in enumerate(S):\n D[s]... | ['Runtime Error', 'Accepted'] | ['s005097879', 's940253531'] | [3564.0, 8304.0] | [321.0, 427.0] | [637, 672] |
p02937 | u382907940 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from bisect import bisect\n\n\n\ns = input()\nt = input()\na = \'abcdefghijklmnopqrstuvwxyz\'\nd = {}\nfor ch in a:\n d[ch] = []\nfor ch,n in zip(s,range(len(s))):\n d[ch].append(n)\n\nrep = 0\np = -1\nfor ch in t:\n if len(d[ch])==0:\n print("-1")\n exit()\n else:\n i = bisect(d[ch],p)\n if i!=len(d[... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s767423515', 's920240728', 's130497265'] | [7540.0, 11204.0, 7540.0] | [138.0, 138.0, 139.0] | [528, 612, 450] |
p02937 | u413165887 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["def main():\n import sys\n s = str(input())\n t = str(input())\n s += s\n n = len(s)-1\n m = len(t)\n \n print(s)\n result = 0\n point = 0\n counter = 0\n i = t[0]\n c = 1\n while c <= m:\n print(point, i, result)\n if i in s[point:]:\n x = s[point:].... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s244289878', 's416822329', 's729128020', 's353199504'] | [6464.0, 3064.0, 4084.0, 3316.0] | [2104.0, 18.0, 2104.0, 363.0] | [689, 630, 588, 347] |
p02937 | u417365712 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s, t = [x.strip() for x in open(0).readlines()]\nif set(t) - set(s) != set():\n print(-1)\nelse:\n d = defaultdict(deque)\n n = len(s)\n for i, c in enumerate(s, 1):\n d[c].append(i)\n ans = 0\n for c in t:\n while True:\n i = d[c].popleft()\n d[c].append(i + n)\n... | ['Runtime Error', 'Accepted'] | ['s656060392', 's826838511'] | [3444.0, 8052.0] | [22.0, 141.0] | [389, 428] |
p02937 | u419877586 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['res=0\nif len(set(t)-set(s)) > 0:\n res=-1\nelse:\n dic={}\n for e_t in t:\n dic[e_t]=[]\n for i in range(len(s)):\n if s[i] in t:\n dic[s[i]].append(i+1)\n cur = 0\n for i in range(len(t)):\n nxt=cur\n for e in dic[t[i]]:\n if e > cur:\n ... | ['Runtime Error', 'Accepted'] | ['s917151659', 's064153202'] | [3064.0, 7668.0] | [18.0, 144.0] | [452, 477] |
p02937 | u434765267 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["s = input()\nt = input()\nn = len(s)\nnxt = [list() for x in range(n + 1)]\nnxt[n] = [n for x in range(26)]\nprint(*nxt[n])\nfor i in range (n - 1, -1, -1):\n for v in nxt[i + 1]:\n nxt[i].append(v)\n nxt[i][ord(s[i]) - ord('a')] = i;\nans = 0\ncur = 0\nfor i in range (len(t)):\n c = ord(t[i]) - ord('... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s543189449', 's752386519', 's398578375'] | [41668.0, 42432.0, 41540.0] | [570.0, 625.0, 550.0] | [489, 510, 474] |
p02937 | u503228842 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['\n\nimport bisect\ns = input()\nt = input()\n\nsd = {}\nfor i,ss in enumerate(s):\n if ss not in sd:\n sd[ss] = [i]\n else:\n sd[ss].append(i)\n\nans = 1\ns_idx = -1\nfor tt in t:\n if tt not in sd:\n print(-1)\n exit()\n while True:\n n_s_idx = bisect.bisect_left(sd[tt]... | ['Wrong Answer', 'Accepted'] | ['s125393808', 's883096185'] | [7668.0, 13760.0] | [135.0, 115.0] | [594, 415] |
p02937 | u525796732 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["import heapq\nimport bisect\nfrom collections import deque\nstdin=sys.stdin\n\nns=lambda:input().rstrip()\nni=lambda:int(input().rstrip())\nnm=lambda:map(int,input().split())\nnl=lambda:list(map(int,input().split()))\n\ns=list(ns())\nt=list(ns())\nd={'a':0,'b':1,'c':2,'d':3,'e':4,'f':5,'g':6,'h':7,'i':8,'j':9,'k':10,... | ['Runtime Error', 'Accepted'] | ['s121236544', 's687268138'] | [3316.0, 9308.0] | [23.0, 152.0] | [777, 790] |
p02937 | u526395606 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s=input()\nt=input()\n\nslist=list(s)\ntlist=list(t)\n\nslist.append("aa")\nscounter=0\n\nfor tchar in tlist:\n for schar in slist:\n \n if schar =="aa":\n scounter=-1\n break\n if tchar==schar:\n break\n scounter+=1\n \n if scounter==-1:\n break\n \nprint(scounter)\n\n\nwhile en... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s393854430', 's474889500', 's566771441', 's646210620', 's934127052', 's936952497', 's072891399'] | [2940.0, 5516.0, 22552.0, 5620.0, 4852.0, 17420.0, 3444.0] | [17.0, 540.0, 2104.0, 2104.0, 2104.0, 2104.0, 380.0] | [376, 427, 667, 870, 341, 422, 430] |
p02937 | u540761833 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\nlent = len(t)\ntcount = 0\nsnow = 0\ncount = 0\nflag = True\nwhile True:\n if tcount == lent:\n break\n if t[tcount] not in s:\n flag = False\n break\n snow = s.index(t[tcount])\n tcount += 1\n if t[tcount] in s[snow+1:]:\n snow = s[snow+1:].index(t... | ['Runtime Error', 'Accepted'] | ['s953777633', 's476835093'] | [3316.0, 7796.0] | [1352.0, 133.0] | [446, 489] |
p02937 | u593019570 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import sys\n\ns = list(input())\nt = list(input())\n\nfor i in range(len(t)):\n if t[i] not in s:\n print(-1)\n sys.exit()\n\ni = 0\nn = 0\nfor i in range(len(s)):\n if len(s) == i + n:\n break\n \n if s[i] not in t:\n s.pop(i)\n n += 1\n\ncount = 0\nfor j in range(10000... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s207021516', 's392502981', 's856701070', 's109632111'] | [4776.0, 137900.0, 4776.0, 3456.0] | [2104.0, 2104.0, 2104.0, 1876.0] | [562, 508, 560, 392] |
p02937 | u595289165 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from collections import defaultdict\ns = input()\nt = input()\nl_s = len(s) * 2\n\nch = defaultdict(list)\nfor i, v in enumerate(s*2):\n ch[v].append(i)\n\nprint(ch)\nnext_ch = defaultdict(list)\nfor j, k in ch.items():\n for i in k:\n next_ch[j] += [i] * (i+1)\n next_ch[j] += [k[-1]+l_s] * (l_s - len... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s140233598', 's747624967', 's312718571'] | [3964.0, 11116.0, 9044.0] | [2263.0, 152.0, 151.0] | [470, 466, 453] |
p02937 | u619458041 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["import sys\nfrom collections import defaultdict\n\ndef main():\n input = sys.stdin.readline\n S = str(input().strip())\n T = str(input().strip())\n\n if not set(T) <= set(S):\n return -1\n\n n = len(S)\n d = defaultdict(list)\n for i, s in enumerate(S, start=1):\n d[s].append(i)\n\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s153279122', 's926235318', 's284896139'] | [8176.0, 8052.0, 7924.0] | [42.0, 40.0, 379.0] | [805, 805, 808] |
p02937 | u625729943 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\n\npos = [0]*len(t)\nfor i, c in enumerate(t):\n ind = [ii for ii, v in enumerate(s) if v == c]\n if ind[0] == -1:\n print(-1)\n exit()\n pos[i] = ind\n\nprint(pos)\n\nlens = len(s)\nlast = pos[0][0]\nprint(last)\nres = last + 1\nfor vals in pos[1:]:\n for i, val in ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s788892424', 's976197646', 's858159155'] | [935824.0, 927488.0, 8052.0] | [2162.0, 2161.0, 122.0] | [560, 555, 511] |
p02937 | u647203471 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import sys\ninput = sys.stdin.readline\n\ns = str(input())\nt = str(input())\n\nif set(t).issubset(set(s)):\n p = -1\n r = 0\n \n for i in t:\n p = s.find(i, p+1)\n if p == -1:\n r += 1\n p = s.find(i)\n \n print(p + 1 + len(s)*r)\n \nelse:\n print(-1)',... | ['Wrong Answer', 'Accepted'] | ['s289004983', 's096391583'] | [3316.0, 3444.0] | [380.0, 434.0] | [297, 258] |
p02937 | u670180528 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from collections import defaultdict\nfrom bisect import bisect_left\n\ns = input()\nn = len(s)\ns = s + s\nt = input()\nif set(t) - set(s):\n\tprint(-1)\n\texit()\nd = defaultdict(list)\nfor i in range(2 * n):\n\td[s[i]] += [i]\ncur = tot = 0\nfor c in t:\n\tx = d[c][bisect_left(d[c], cur + 1)]\n\tif x < n:\n\t\tcur ... | ['Wrong Answer', 'Accepted'] | ['s741509314', 's641311638'] | [12200.0, 12072.0] | [158.0, 122.0] | [377, 425] |
p02937 | u674574659 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | [' print(cnt)import string\ns = input()\nt = input()\nl = []\nalp = string.ascii_lowercase\nG = dict([(alp[i],-1) for i in range(len(alp))])\nfor i in range(len(s)-1,-1,-1):\n l.append(G.copy())\n G[s[i]] = i\nl = l[::-1] \nstG = G.copy()\n\ncnt = 0\nind = 0\nwhile ind < len(t): \n if stG[t[ind]] == -1:\n cnt =... | ['Runtime Error', 'Accepted'] | ['s601196327', 's432888776'] | [3064.0, 169596.0] | [17.0, 282.0] | [588, 626] |
p02937 | u698176039 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["\nimport sys\ninput = sys.stdin.readline\n\nS = list(input())\nT = list(input())\n\nalpha2num = lambda c: ord(c) - ord('a') \n\nalpha = [[] for _ in range(26)]\nfor i,s in enumerate(S):\n alpha[alpha2num(s)].append(i)\n\nimport bisect\ntmp = 0\nN = len(S)\nbase = 0\nfor t in T:\n a = alpha2num(t)\n if len(al... | ['Runtime Error', 'Accepted'] | ['s652738170', 's213185208'] | [8928.0, 9056.0] | [65.0, 185.0] | [646, 622] |
p02937 | u711539583 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import bisect\ns = input()\nt = input()\nd = { c: [] for c in t }\nfor i, c in enumerate(s):\n if c in d:\n d[c].append(i)\nfor dc in d.values():\n dc.sort()\nn = 0\nans = 0\n\nfor j, c in enumerate(t):\n l = d[c]\n if l:\n i = bisect.bisect_right(l, n)\n if i == len(l):\n ans += i\n n = l[0]\n... | ['Wrong Answer', 'Accepted'] | ['s909913197', 's863906563'] | [7540.0, 7540.0] | [159.0, 155.0] | [416, 445] |
p02937 | u720483676 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import sys\n\n\ndef search_list_position(*list,last):\n for i in range(len(list)):\n if last<i:\n p=i\n elif i==len(list)-1:\n p=0\n return p\n\n\ns=input()\nt=input()\nfor i in t:\n if i not in s:\n print("-1")\n sys.exit()\n\ncount=[[] for i in range(26)]\n... | ['Wrong Answer', 'Accepted'] | ['s550018836', 's481278839'] | [10124.0, 7924.0] | [2104.0, 123.0] | [631, 379] |
p02937 | u731368968 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["s = input()\nn = len(s)\nl = [[]for i in range(26)]\n\nfor i, c in enumerate(s * 2):\n l[ord(c) - ord('a')].append(i)\n\n\nfrom bisect import *\n\nshukai = 0\nnow = 0\n\nt = input()\nfor c in t:\n x = ord(c) - ord('a')\n if len(l[x]) == 0:\n print(-1)\n exit()\n i = bisect(l[x], now)\n no... | ['Runtime Error', 'Accepted'] | ['s105522522', 's195919075'] | [11824.0, 11896.0] | [189.0, 204.0] | [394, 400] |
p02937 | u753803401 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import heapq\nal = {"a": 0, "b": 1, "c": 2, "d": 3, "e": 4, "f": 5,\n "g": 6, "h": 7, "i": 8, "j": 9, "k": 10, "l": 11,\n "m": 12, "n": 13, "o": 14, "p": 15, "q": 16, "r": 17,\n "s": 18, "t": 19, "u": 20, "v": 21, "w": 22, "x": 23,\n "y": 24, "z": 25}\nals = [[] for _ in range(26)]\nfor i in als:\... | ['Runtime Error', 'Accepted'] | ['s661624738', 's906270692'] | [142276.0, 9256.0] | [2104.0, 140.0] | [774, 492] |
p02937 | u760794812 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\ncounter = 0\nidx = -1\nif set(t) <= set(s):\n for i in range(len(t)):\n idx = s.find(t[i],idx+1)\n if idx == -1:\n counter += 1\n idx = s.find(t[i],idx+1)\n print(counter * len(s) +idx +1)\nelsse:\n print(-1)', 's = input()\nt = input()\ncounter = 0\nidx = -1\nif set(t) <=... | ['Runtime Error', 'Accepted'] | ['s910115642', 's143327780'] | [3064.0, 3316.0] | [17.0, 389.0] | [241, 240] |
p02937 | u798818115 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s=list(input())\nt=list(input())\n\nprint(s)\n\nTrigger=True\nOK=False\ncount=0\n\nwhile Trigger:\n Trigger=False\n for i in range(len(s)):\n if len(t)==0:\n OK=True\n break\n elif s[i]==t[0]:\n del t[0]\n Trigger=True\n count+=1 \n \nif O... | ['Wrong Answer', 'Accepted'] | ['s149245684', 's959606136'] | [6232.0, 9340.0] | [2104.0, 170.0] | [339, 597] |
p02937 | u858518613 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import bisect\n\ndef ctoi(char):\n return ord(char) - 97\n\nalphabets = [[] for _ in range(26)]\n\n\ningredients = input()\n\nrecipe = input()\n\n\nfor i in range(len(ingredients)):\n alpha_idx = ctoi(ingredients[i])\n alphabets[alpha_idx].append(i)\n\ningredients_counter = [0] * 26\nfor i in range(26):\n ingredi... | ['Runtime Error', 'Accepted'] | ['s244764623', 's539875633'] | [7540.0, 8572.0] | [59.0, 184.0] | [1575, 1619] |
p02937 | u866374539 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\n\nc=1\nj=0\nk=0\n\n#t\nfor i in range(0,len(t)):\n while True:\n if t[i:i+1]==s[j:j+1]:\n j=j+1\n k=0\n break\n else:\n if j==len(s):\n j=0\n else:\n if k+1==len(s):\n print("-1")\n exit()\n else:\n j=j+1\n ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s133318333', 's207126736', 's634645760', 's941522453', 's717237790'] | [3316.0, 3316.0, 14316.0, 3316.0, 3316.0] | [2104.0, 2103.0, 2104.0, 2104.0, 439.0] | [330, 383, 440, 372, 354] |
p02937 | u874885251 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import sys\n\ns = input()\nt = input()\ns_len = len(s)\nt_len = len(t)\nindex_list = [0]*t_len\nrt1 = 0\nrt2 = 0\ns = s + s\nfor m in range(t_len):\n\trt1 = s.find(t[m],rt1)\n\tif rt1 == -1:\n\t\tprint(rt1)\n\t\tsys.exit()\n\telse:\n\t\t#index_list[m] = rt1\n\t\trt1 += 1\n\t\tif rt1 < s_len:\n\t\t\tpass\n\t\telse:\n\... | ['Wrong Answer', 'Accepted'] | ['s491097832', 's594213599'] | [4340.0, 4340.0] | [64.0, 388.0] | [323, 367] |
p02937 | u888092736 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['N, *A = map(int, open(0).read().split())\n\nA = [0] + A\nB = [0] * (N + 1)\nsum_B = 0\nfor i in range(N, 0, -1):\n if sum(B[j] for j in range(i, N + 1, i)) % 2 != A[i]:\n B[i] = 1\n sum_B += 1\nprint(sum_B)\nprint(*[i for i, b in enumerate(B) if b])\n', 'from bisect import bisect_left\n\n\nS = input(... | ['Runtime Error', 'Accepted'] | ['s027416660', 's133318917'] | [9112.0, 13480.0] | [30.0, 191.0] | [257, 420] |
p02937 | u889344512 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['abc = ["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"]\ns = input()\nx = [0 for i in range(26)] for j in range(len(s))]\nfor k in range(2):\n for i in range(len(s)-1,-1,-1):\n if i == 0:\n ib = len(s)-1\n else:\n ib = i-1\... | ['Runtime Error', 'Accepted'] | ['s996349791', 's934921869'] | [2940.0, 7668.0] | [17.0, 160.0] | [699, 462] |
p02937 | u896741788 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s=input()\nt=input()\nif len(t)==1:\n try:\n print(s.index(t)+1)\n except ValueError:\n print(-1)\n exit()\n l=list()\n for _ in list(t):\n l.append([i for i,x in enumerate(list(s)) if x==_]) if [i for i,x in enumerate(list(s)) if x==_]!=[] else print(-1) and exit()\n ed=l[0][0]\n for i in range(len... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s098738764', 's140268925', 's895630048', 's596474493'] | [8640.0, 451552.0, 454396.0, 7916.0] | [46.0, 2133.0, 2137.0, 108.0] | [576, 614, 550, 539] |
p02937 | u899975427 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["import bisect\ns = input()*2\nlens = len(s)//2\nt = input()\nappear = {ch: [] for ch in 'abcdefghijklmnopqrstuvwxyz'}\ncnt = -1\nbis = bisect.bisect_right\nans = 0\n\nfor i, ch in enumerate(s):\n appear[ch].append(i)\n \nfor j in t:\n if appear[j]:\n idx = bis(appear[j],cnt)\n ans += appear[j][idx] - cnt\n ... | ['Wrong Answer', 'Accepted'] | ['s893544849', 's886582898'] | [12728.0, 11812.0] | [260.0, 153.0] | [388, 373] |
p02937 | u919463386 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['# -*- coding: utf-8 -*-\n\n\ndef main():\n s = input().splitlines()[0]\n t = input()\n\n Slen = len(s)\n\n LookupTable = [[] for i in range(26)]\n for i, c in enumerate(s):\n v = ord(c) - ord(\'a\')\n LookupTable[v].append(i)\n for i in range(26):\n LookupTable[i].append(Slen)\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s032078140', 's313190063', 's556148809'] | [42484.0, 42484.0, 42484.0] | [494.0, 505.0, 488.0] | [1059, 998, 1031] |
p02937 | u921773161 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["alpha2num = lambda c: ord(c) - ord('a') \n\ns = list(input())\nalpha = [[] for i in range(26)]\na = 'abcdefghijklmnopqrstuvwxyz'\n\nfor i in range(len(s)):\n alpha[alpha2num(s[i])].append(i)\n\nprint(alpha)\n\nt = list(input())\nl = [0] * 26\nans = 0\n\n\ns_unique = list(set(s))\nt_unique = list(set(t))\ncheck = 0... | ['Wrong Answer', 'Accepted'] | ['s603676693', 's235728456'] | [12512.0, 9056.0] | [334.0, 358.0] | [1101, 826] |
p02937 | u923712635 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['from collections import defaultdict\nimport bisect\ns = input()\nt = input()\n#%%\nls = len(s)-1\ncnt = 0\nnum = 0\ndi = defaultdict(list)\nfor ind,i in enumerate(s):\n di[i].append(ind)\n\nfor i in t:\n num = cnt%(ls+1)\n if(i not in di):\n print(-1)\n break\n if(max(di[i])<=num):\n ... | ['Wrong Answer', 'Accepted'] | ['s033010040', 's560596209'] | [10276.0, 7924.0] | [2104.0, 158.0] | [448, 517] |
p02937 | u944209426 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s=input()\nt=input()\n\nx=list(s)\ny=list(t)\nimport sys\nif len(set(y)-set(x))!=0:\n\tprint(-1)\n\tsys.exit()\n\na=[[] for _ in range(26)]\nfor i in range(len(s)):\n\ta[ord(x[i])-97].append(i)\n\n\n\nimport bisect\n\n\nrepeat=0\nlast=0\nfor i in range(len(t)):\n\ttemp=a[ord(y[i])-97]\n\tif last>=temp[-1]:\n\t\trepea... | ['Runtime Error', 'Accepted'] | ['s901691446', 's699011303'] | [141800.0, 9240.0] | [2104.0, 131.0] | [444, 406] |
p02937 | u950825280 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ["s = input()\nt = input()\nc = 0\npre = 0\nrep = 0\ndict = {word:[] for word in 'abcdefghijklmnopqrstuvwxyz'}\nfor i, w in enumerate(s):\n dict[w].append(i+1)\nfor n in t:\n if len(dict[n]) < 1:\n c = -1\n break\n if pre > dict[n][0]:\n rep += 1\n pre = dict[n][0]\n if len(dict[n]) ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s227690006', 's411279018', 's330201212'] | [140168.0, 3064.0, 7540.0] | [2104.0, 18.0, 104.0] | [546, 707, 697] |
p02937 | u958141542 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['s = input()\nt = input()\n\nstrings = s*len(t)\n\nfor str in t:\n if str not in s:\n print("-1")\n break\n strings.strip(str)\n\nn = strings.index(t)\nnum = len(s)*(n-1)+(s.index(t[-1]))+1\n\nprint(num)', 's = input()\nt = input()\n\nidx = -1\ncount = 0\nif set(t) <= set(s):\n for i in t:\n ... | ['Runtime Error', 'Accepted'] | ['s443221267', 's289366540'] | [3316.0, 3444.0] | [2104.0, 384.0] | [208, 256] |
p02937 | u982152304 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['import sys\nimport numpy as np\n\ns = input()\nt = input()\n\n\n\ncount = 0\ns_len = len(s)\ns_list = np.zeros(len(s))\nt_list = []*len(t)\n\nfor i,k in enumerate(t):\n\n indexes = [j for j, x in enumerate(s) if x == k]\n if len(indexes) == 0:\n print(-1)\n sys.exit(0)\n else:\n t_list.insert(i,indexes)\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s093206673', 's368840882', 's095394337'] | [891220.0, 12724.0, 19396.0] | [2166.0, 151.0, 834.0] | [661, 77, 731] |
p02937 | u984276646 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i cha... | ['print(-1)', 's = input()\nt = input()\nalpha = "abcdefghijklmnopqrstuvwxyz"\nn = len(s)\nm = len(t)\nD = {}\nE = {}\nfor i in range(n):\n if s[i] in D:\n D[s[i]][i] = i\n else:\n D[s[i]] = [-1 for _ in range(n)]\n D[s[i]][i] = i\n E[s[i]] = i\nfor i in D:\n p = E[i]\n for j in range(E[i], E[i] - n, -1):... | ['Wrong Answer', 'Accepted'] | ['s086009386', 's584997897'] | [2940.0, 31196.0] | [17.0, 1530.0] | [9, 658] |
p02938 | u104282757 | 2,000 | 1,048,576 | Given are integers L and R. Find the number, modulo 10^9 + 7, of pairs of integers (x, y) (L \leq x \leq y \leq R) such that the remainder when y is divided by x is equal to y \mbox{ XOR } x. What is \mbox{ XOR }? The XOR of integers A and B, A \mbox{ XOR } B, is defined as follows: * When A \mbox{ XOR } B is writ... | ['\nLARGE = 10 ** 9 + 7\n\n# flag_x : left < x\n\n\n\n\ndef f(pos, flag_x, flag_y, flag_z, memo, left, right):\n if pos == -1:\n return 1\n if memo[pos][flag_x][flag_y][flag_z] != -1:\n return memo[pos][flag_x][flag_y][flag_z]\n ret = 0\n \n if flag_x or left[pos] == \'0\':\n ret += ... | ['Runtime Error', 'Accepted'] | ['s896393658', 's555641004'] | [3192.0, 3188.0] | [20.0, 18.0] | [1265, 1322] |
p02938 | u389910364 | 2,000 | 1,048,576 | Given are integers L and R. Find the number, modulo 10^9 + 7, of pairs of integers (x, y) (L \leq x \leq y \leq R) such that the remainder when y is divided by x is equal to y \mbox{ XOR } x. What is \mbox{ XOR }? The XOR of integers A and B, A \mbox{ XOR } B, is defined as follows: * When A \mbox{ XOR } B is writ... | ['import bisect\nimport heapq\nimport itertools\nimport math\nimport operator\nimport os\nimport re\nimport string\nimport sys\nfrom collections import Counter, deque, defaultdict\nfrom copy import deepcopy\nfrom decimal import Decimal\nfrom fractions import gcd\nfrom functools import lru_cache, reduce\nfrom operator i... | ['Wrong Answer', 'Accepted'] | ['s942335417', 's661642220'] | [13680.0, 12664.0] | [201.0, 188.0] | [2358, 3557] |
p02938 | u514731354 | 2,000 | 1,048,576 | Given are integers L and R. Find the number, modulo 10^9 + 7, of pairs of integers (x, y) (L \leq x \leq y \leq R) such that the remainder when y is divided by x is equal to y \mbox{ XOR } x. What is \mbox{ XOR }? The XOR of integers A and B, A \mbox{ XOR } B, is defined as follows: * When A \mbox{ XOR } B is writ... | ['l, r = input().split()\nl = int(l)\nr = int(r)\n\ndp = [[[-1 for k in range(2)] for j in range(2)] for i in range(64)]\n\ndef bbin(num):\n res = []\n while num:\n res.append(num % 2)\n num //= 2\n\n return res\n\nnumr = bbin(r)\nnuml = bbin(l)\nwhile len(numl) < len(numr):\n numl.append(0)\n... | ['Runtime Error', 'Accepted'] | ['s930309790', 's227503921'] | [3064.0, 3192.0] | [17.0, 18.0] | [1608, 1605] |
p02939 | u002663801 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = list(input())\n\nsi = ""\nk1 = 1\nk2 = 1\nzure = 0\n\nfor i in range(len(s)-1):\n #si = s[i]\n #check = s[i+1]\n\n #for j in range(len(si)):\n \n print(s[i+zure],i+zure)\n if s[i + zure] == s[i+1+zure]:\n zure += 2\n # print(i)\n \n k1 += 1\n if i + zure >= len(s)-2:\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s082514882', 's091940926', 's470330418', 's646273339', 's713692228', 's844590509', 's284250182'] | [8196.0, 2940.0, 12836.0, 2940.0, 12836.0, 12836.0, 12836.0] | [624.0, 17.0, 104.0, 17.0, 101.0, 104.0, 114.0] | [561, 516, 292, 386, 237, 241, 292] |
p02939 | u020091453 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["s = ''\ncount = 0\nwhile S:\n if s == S[-1]:\n if len(S) >= 2:\n S.pop()\n S.pop()\n s = ''\n count+=1\n else:\n break \n else:\n s = S.pop()\n count+=1\n \nprint(count)", 'S = list(input())\n\ns = S.pop()\ncount = ... | ['Runtime Error', 'Accepted'] | ['s718467783', 's977924991'] | [2940.0, 4840.0] | [18.0, 92.0] | [257, 333] |
p02939 | u021019433 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['r = 0\np = None\nfor c in input():\n if p:\n p = None\n r += 1\n elif c == p:\n p = c\n else:\n r += 1\n p = c\nprint(r)\n', "r = 0\np = None\nfor c in input():\n if p:\n p = None\n r += 1\n elif c == p:\n p = '*'\n else:\n r += 1\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s329171845', 's860117049', 's550637850'] | [3500.0, 3500.0, 3500.0] | [60.0, 59.0, 62.0] | [154, 156, 159] |
p02939 | u021548497 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nans = 0\nkey = 0\nfor i in range(len(s)-1):\n\tif key == 1:\n\t\tkey = 0\n\telif s[i] == s[i+1]:\n\t\tans += 1\n\t\tkey = 1\n\telse:\n\t\tans += 1\nif key == 0:\n\tans += 1\nprint(ans)', 's = input()\nn = len(s)\n\nbef = s[0]\nkey = 0\nans = 1\nfor i in range(1, n):\n if key == i:\n continue\n if be... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s351230309', 's636614239', 's651891210', 's970585727'] | [3500.0, 3500.0, 2940.0, 3500.0] | [77.0, 83.0, 17.0, 89.0] | [172, 241, 155, 243] |
p02939 | u038819082 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S=input()\nc=len(S)\nk=0\ncnt=0\nt=''\nr=''\nfor i in S:\n t+=i\n if t==k:\n continue\n k==t\n t=''\n cnt+=1\nprint(cnt)", "S=input()\nc=len(S)\nk=0\ncnt=0\nt=''\nr=''\nfor i in S:\n t+=i\n if t==r:\n continue\n r=t\n t=''\n cnt+=1\nprint(cnt)"] | ['Wrong Answer', 'Accepted'] | ['s515650661', 's846247862'] | [3500.0, 3500.0] | [82.0, 71.0] | [129, 128] |
p02939 | u062691227 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = open(0).read().rstrip()\nn = len(s)\n\nans = [0] * n\nans[0] = 1\n\nfor i in range(1,n):\n if s[i] != s[i-1]:\n ans[i] = ans[i-1]+1\n else:\n ans[i] = ans[i-2]+1\n\nprint(ans[-1])', 's = open(0).read().rstrip()\nn = len(s)\n\nfrom collections import defaultdict\nans = defaultdict(int)\nans[-2]... | ['Wrong Answer', 'Accepted'] | ['s459676382', 's640306126'] | [16632.0, 35840.0] | [84.0, 106.0] | [191, 262] |
p02939 | u073549161 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['import math\nn = int(input())\na = math.ceil(n/9)\nb = n % 9 #\nprint(str(b) * a)', 's = input()\np = ""\nc = ""\nres = 0\nfor i in range(len(s)):\n c += s[i]\n if p != c:\n p = c\n c = ""\n res += 1\nprint(res)'] | ['Runtime Error', 'Accepted'] | ['s657530604', 's493803718'] | [3500.0, 3500.0] | [19.0, 81.0] | [77, 143] |
p02939 | u075303794 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['from collections import deque\ns = deque(x for x in input())\ns.append(0)\nk = 0\nl = [s[0]]\nwhile True:\n if s[0] == 0:\n break\n elif l[k] == s[0]:\n l.append(s.popleft()+s.popleft())\n else:\n l.append(s.popleft())\n k += 1\nprint(len(l))', 'from collections import deque\ns = deque(x for x in input()... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s412132683', 's559524292', 's265818442'] | [8728.0, 8728.0, 8736.0] | [107.0, 100.0, 106.0] | [242, 249, 303] |
p02939 | u083646648 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["def main():\n s = list(input())\n divide = [1]\n for i in range(len(s)):\n if s[i] == divide[-1] :\n s[i+1] = s[i] + s[i+1]\n else:\n divide.append(s[i])\n print(len(divide)-1)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n s = list(input())\n divide = []\n compare = 0\n for i in... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s203077628', 's275198912', 's574471712'] | [9404.0, 9636.0, 9636.0] | [62.0, 59.0, 71.0] | [227, 256, 333] |
p02939 | u084324798 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['string = input()\n\nbefore = ""\nans = 0\nwhile len(string) > 1:\n if before == string[0]:\n before = string[0:2]\n string = string[2:len(string)]\n else:\n before = string[0]\n string = string[1:len(string)]\n print(before)\n ans += 1\nif not before == string:\n ans += 1\np... | ['Wrong Answer', 'Accepted'] | ['s255112476', 's380031257'] | [4388.0, 3500.0] | [1484.0, 1279.0] | [312, 393] |
p02939 | u093041722 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = input()\ncount = 1\ni = 0\ninitial_length = len(S)-1\nl = S[0]\nS = S + '&' + '%'\nprint(S)\nwhile i < initial_length:\n if l == S[i+1]:\n if i == initial_length-1:\n break\n elif S[i+2] == S[i+3]:\n l = S[i+3]\n i += 3\n count += 1\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s932642539', 's768166552'] | [3620.0, 3500.0] | [97.0, 96.0] | [415, 406] |
p02939 | u102960641 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nnow = 0\nans = 1\nLEN = len(s)\nwhile now <= LEN-2:\n if s[now] == s[now+1]:\n now += 2\n if now >= LEN:\n break\n else:\n now += 1\n ans += 1\nprint(ans)', 's = input()\nnow = 0\nt = 0\nans = 1\nLEN = len(s)\nwhile now <= LEN-2:\n if s[now] == s[now+1] and t == 0:\n now += 2\n if... | ['Wrong Answer', 'Accepted'] | ['s712443858', 's579721895'] | [3500.0, 3500.0] | [81.0, 89.0] | [172, 209] |
p02939 | u115110170 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['n = int(input())\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\nst = 0\nans = 0\n\nfinished = [b[i] == a[i] for i in range(n)]\nfcount = sum(finished)\nwhile fcount<n and ans>=0:\n for i in range(st,n):\n if not finished[i] and (b[i-1] <= b[i] >= b[(i+1) % n]):\n ans += (b[i]-a[i])/... | ['Runtime Error', 'Accepted'] | ['s314990241', 's294937659'] | [3628.0, 3500.0] | [19.0, 86.0] | [623, 196] |
p02939 | u127499732 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['def main():\n import itertools\n s=itertools.groupby(str(input()))\n \n ans=0 \n for k,v in s:\n l=len(list(v))\n if l<=2:\n ans+=1\n else:\n ans+=l//2+1\n \n print(ans)\n \nif __name__=="__main__":\n main()', 'def main():\n s=str(input())\n before=""\n count=0\n for now in s:\n if ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s185593774', 's318349193', 's366510093', 's371650821', 's600939174'] | [4848.0, 3500.0, 3500.0, 3500.0, 3500.0] | [104.0, 34.0, 46.0, 50.0, 46.0] | [220, 203, 222, 241, 461] |
p02939 | u128908475 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\nans = 0\nSi = ""\nnow = ""\nfor s in S:\n now += s\n if Si != now:\n ans += 1\n Si = now\n now = ""', 'S = input()\nans = 0\nSi = ""\nnow = ""\nfor s in S:\n now += s\n if Si != now:\n ans += 1\n Si = now\n now = ""\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s655912618', 's014737432'] | [3500.0, 3500.0] | [70.0, 72.0] | [130, 141] |
p02939 | u130974043 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nmaximum = [(0, ())]\n\ns = tuple(s)\nfor i in range(1, len(s) + 1):\n j = i - 1\n while j >= 0:\n max_count, previous = maximum[j]\n if max_count < 0:\n j -= 1\n continue\n current = s[j:i]\n if current != previous:\n maximum.append((max_... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s035164587', 's133775054', 's189467163', 's478087948', 's756677485', 's564730134'] | [41988.0, 12040.0, 42196.0, 131240.0, 11884.0, 63708.0] | [217.0, 35.0, 201.0, 903.0, 2205.0, 689.0] | [424, 1161, 315, 2307, 1013, 702] |
p02939 | u133566678 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\na = S[0]\ncount = 1\nflag = 1\nif len(S) == 1:\n print(1)\nelse:\n for i in range(1, len(S)):\n if a != S[i] or flag == 0:\n count += 1\n flag = 1\n else:\n flag = 0\n a = S[i]\n print(count)', 'S = input()\na = S[0]\ncount = 1\nflag = 1\nif ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s256555973', 's591452052', 's073600931'] | [3500.0, 3500.0, 3500.0] | [80.0, 75.0, 82.0] | [253, 284, 402] |
p02939 | u134856634 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['# -*- coding: utf-8 -*-\nimport sys;\nimport string;\nsys.setrecursionlimit(20000) \n\nimport copy\nimport math\nimport itertools\n\nfrom functools import lru_cache\n#@lru_cache(maxsize = None)\n\nPPP = 1000000007\n\ns = input()\n\n\n#n = int(input())\n\n\n#n, x = input().split()\n\n\n#a, b = map(int, input().split()... | ['Wrong Answer', 'Accepted'] | ['s416329851', 's961269283'] | [5860.0, 6060.0] | [72.0, 910.0] | [1877, 2036] |
p02939 | u151785909 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["s=input()\nl=len(s)\ns+='?'\nans=0\nch = 0\nfor i in range(l):\n if s[i]!=s[i+1] or ch==1:\n ans+=1\n ch=0\n else:\n ch=1\nprint(ans)\n", "s=list(input())\na=0\nt='?'\nch=0\nl=len(s)\nfor i in range(l):\n if ch==1:\n ch=0\n continue\n if s[i]!=t:\n a+=1\n t... | ['Wrong Answer', 'Accepted'] | ['s226170925', 's462073223'] | [3500.0, 4840.0] | [73.0, 84.0] | [150, 244] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.