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
|
---|---|---|---|---|---|---|---|---|---|---|
p03289 | u959981943 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["S = input()\n\nif S[0] == 'A' and S[2:-1].count('C') == 1 \\\n and S[1] != 'C' and S[-1] != 'C' and S.replace('C', '').islower():\n print('AC')\nelse:\n print('WA')\n", "S = input()\n\nif S[0] == 'A' and S[2:-1].count('C') == 1 and sum([c.isupper for c in S]) == 2:\n print('AC')\nelse:\n print('WA')\n", "S = input()\n\nif S[0] == 'A' and S[2:-1].count('C') == 1 and sum([c.isupper() for c in S]) == 2:\n print('AC')\nelse:\n print('WA')\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s098377186', 's483956942', 's662486808'] | [2940.0, 2940.0, 2940.0] | [18.0, 19.0, 17.0] | [171, 132, 134] |
p03289 | u960171798 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ['S = list(input())\ncnt = 0\n\narray = S[3:-1]\nif array.count("C")==1:\n array.remove("C")\n S = S[:3]+array+S[-1]\nelse:\n cnt += 1\n\nif S[0]=="A":\n del S[0]\nelse:\n cnt += 1\n\ns = "".join(S)\nif s.islower == False:\n cnt += 1\nprint("AC" if cnt==0 else "WA")\n', 'S = list(input("Enter :"))\nans = 0\nC_location = 0\nfor i in range(2,len(S)-1):\n if S[i] == "C":\n ans += 1\n\tS[i].lower()\nif all(S[0]=="A" and ans==1):\n S.swapcase(S[0])\n if S.islower():\n\tprint("AC")\n else:\n print("WA")\nelse:\n print("WA")', 'S = list(input())\nans = 0\nfor i in range(2,len(S)-1):\n if S[i] == "C":\n ans += 1\n S[i] = S[i].lower()\nif S[0]=="A" and ans==1:\n S[0] = S[0].lower()\n s = ""\n for i in range(len(S)):\n s += S[i]\n if s.islower():\n print("AC")\n else:\n print("WA")\nelse:\n print("WA")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s511519007', 's669543898', 's776843650'] | [3060.0, 3188.0, 3064.0] | [17.0, 18.0, 17.0] | [253, 246, 282] |
p03289 | u962197874 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["S = int(input())\nprint('AC' if S[0] == 'A' and S[2:-1].count('C') == 1 and S[1:].replace('C','').islower() else 'WA')\n ", "S = input()\nprint('AC' if S[0] == 'A' and S[2:-1].count('C') == 1 and S[1] != 'C' and S[1:].replace('C','').islower() else 'WA')"] | ['Runtime Error', 'Accepted'] | ['s773550904', 's046418105'] | [2940.0, 2940.0] | [20.0, 18.0] | [120, 128] |
p03289 | u969850098 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["S = input()\nif S[0] == 'A' and S[2:-1].count('C') == 1:\n S2 = S[1] + S[2:-1].replace('C', '')\n if S2 == S.lower():\n print('AC')\n exit()\nprint('WA')", "S = input()\nif S[0] == 'A' and S[2:-1].count('C') == 1:\n S = S[1] + S[2:-1].replace('C', '') + S[-1]\n if S == S.lower():\n print('AC')\n exit()\nprint('WA')"] | ['Wrong Answer', 'Accepted'] | ['s855399044', 's095565413'] | [2940.0, 3060.0] | [17.0, 17.0] | [167, 173] |
p03289 | u970107703 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["import re\n\nS = input()\n\nif(S[0] == 'A'):\n regex = r'[a-z]*C[a-z]*[a-z]'\n ans = re.match(regex, S[3:len(S)])\n if(ans != None):\n if(ans.span() == (0, len(S[3:len(S)]))):\n print('AC')\n else:\n print('WA')\n else:\n print('WA')\n", "import re\n\nS = input()\n\nregex = r'A[a-z][a-z]*C[a-z]*[a-z]'\nans = re.match(regex, S)\nif(ans != None):\n if(ans.span() == (0, len(S))):\n print('AC')\n else:\n print('WA')\nelse:\n print('WA')\n"] | ['Wrong Answer', 'Accepted'] | ['s067454615', 's373678557'] | [3188.0, 3188.0] | [19.0, 19.0] | [276, 209] |
p03289 | u970899068 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["n=list(input())\ncount=0\nif n[0]=='A' and n[2:-1].count('C')==1:\n del n[0]\n n.remove('C')\n print(n)\n for i in range(len(n)):\n if n[i].islower()==1:\n count+=1\n if count==len(n):\n print('AC')\n else:\n print('WA')\n \nelse:\n print('WA')", "n=list(input())\ncount=0\nif n[0]=='A' and n[2:-1].count('C')==1:\n del n[0]\n n.remove('C')\n for i in range(len(n)):\n if n[i].islower()==1:\n count+=1\n if count==len(n):\n print('AC')\n else:\n print('WA')\n \nelse:\n print('WA')"] | ['Wrong Answer', 'Accepted'] | ['s584720800', 's213244132'] | [3064.0, 3060.0] | [17.0, 17.0] | [285, 272] |
p03289 | u977389981 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["S = input()\nans = 'WA'\nif S[0] == 'A':\n if S[2 : -1].count('C') == 1:\n if S[0].replace('A', 'a') + S[2 : -1].replace('C', 'c') + S[-1] == S.lower():\n ans = 'AC'\nprint(ans)", "S = input()\nmid = S[2:-1]\nS_lower = S.lower()\nS_replace = S.replace('C', 'c')\nC_count = 0\n\nif S[0] == 'A':\n for i in mid:\n if i == 'C':\n C_count += 1\n if C_count == 1:\n if S_lower == S_replace:\n print('AC')\n else:\n print('WA')\n else:\n print('WA')", "S = input()\nans = 'WA'\nif S[0] == 'A':\n if S[2 : -1].count('C') == 1:\n if S[0].replace('A', 'a') + S[1] + S[2 : -1].replace('C', 'c') + S[-1] == S.lower():\n ans = 'AC'\nprint(ans)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s022104946', 's207238004', 's772859383'] | [3060.0, 3060.0, 3060.0] | [18.0, 18.0, 17.0] | [192, 316, 199] |
p03289 | u977642052 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["def main(S):\n if not S[0] == 'A':\n return 'WA'\n if not S[2] == 'C':\n return 'WA'\n\n count_c = 0\n count_c += S.count('C')\n count_c += S.count('c')\n\n if not count_c == 1:\n return 'WA'\n\n for s in S[1:]:\n if s == 'C':\n continue\n elif not s.islower():\n return 'WA'\n\n return 'AC'\n\n\nif __name__ == '__main__':\n S = input()\n main(S)\n", "import string\n\n\ndef main(S):\n if not S[0] == 'A' or S[1] == 'C':\n return 'WA'\n if S.endswith('C'):\n return 'WA'\n\n count_upper = 0\n for upper in string.ascii_uppercase:\n count_upper += S.count(upper)\n\n if count_upper != 2:\n return 'WA'\n\n count_C = 0\n\n for s in S[2:]:\n if s == 'C':\n if count_C == 1:\n return 'WA'\n else:\n count_C += 1\n continue\n elif not s.islower():\n return 'WA'\n\n if count_C == 0:\n return 'WA'\n\n return 'AC'\n\n\nif __name__ == '__main__':\n S = input()\n print(main(S))\n"] | ['Wrong Answer', 'Accepted'] | ['s514550448', 's596420298'] | [2940.0, 3772.0] | [17.0, 24.0] | [411, 643] |
p03289 | u982594421 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["s = input().rstrip()\n \nans = 'WA'\nif s[0] == 'A' and s[2:len(s) - 1].count('C') == 1:\n i = s[2:len(s) - 1].find('C')\n if s[1:i+2].islower() and s[i + 2 + 1:].islower():\n ans = 'AC'\n", "s = input().rstrip()\n\nans = 'WA'\nif s[0] == 'A' and s[2:len(s) - 1].count('C') == 1:\n i = s[2:len(s) - 1].find('C')\n if s[1:i + 2].islower() and s[i + 2 + 1:].islower():\n ans = 'AC'\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s614325449', 's042400790'] | [2940.0, 3060.0] | [17.0, 17.0] | [186, 206] |
p03289 | u982762220 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["from collections import Counter\n\ndef is_lower_case(c):\n lower_case_alphabets = 'abcdefghijklmnopqrstuvwxyz'\n return c in lower_case_alphabets\n\nS = input()\ncnt = Counter(S[2:-1])\n\nflag = True\nif S[0] != 'A':\n flag = False\nif cnt['C'] != 1:\n flag = False\nfor c in S:\n if c != 'C' and not is_lower_case(c):\n flag = False\nprint('AC' if flag else 'WA')\n", "from collections import Counter\n\ndef is_lower_case(c):\n lower_case_alphabets = 'abcdefghijklmnopqrstuvwxyz'\n return c in lower_case_alphabets\n\nS = input()\ncnt = Counter(S[3:-1])\n\nflag = True\nif S[0] != 'A':\n flag = False\nif cnt['C'] != 1:\n flag = False\nfor c in S:\n if c != 'C' and not is_lower_case(c):\n flag = False\nprint('AC' if flag else 'WA')\n", "from collections import Counter\n\ndef is_lower_case(c):\n lower_case_alphabets = 'abcdefghijklmnopqrstuvwxyz'\n return c in lower_case_alphabets\n\nS = input()\ncnt = Counter(S)\n\nflag = True\nif S[0] != 'A':\n flag = False\nif cnt['C'] != 1:\n flag = False\nfor c in S:\n if c != 'C' and not is_lower_case(c):\n flag = False\nprint('AC' if flag else 'WA')\n\n ", "from collections import Counter\n\ndef is_lower_case(c):\n lower_case_alphabets = 'abcdefghijklmnopqrstuvwxyz'\n return c in lower_case_alphabets\n\nS = input()\ncnt = Counter(S[2:-1])\n\nflag = True\nif S[0] != 'A':\n flag = False\nif cnt['C'] != 1:\n flag = False\nfor c in S[1:]:\n if c != 'C' and not is_lower_case(c):\n flag = False\nprint('AC' if flag else 'WA')\n"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s222460941', 's271433162', 's662427945', 's781948408'] | [3316.0, 3444.0, 3316.0, 3316.0] | [21.0, 24.0, 21.0, 20.0] | [356, 356, 355, 360] |
p03289 | u990849962 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["S = input()\nm = re.match('^A[a-z]+C[a-z]+$', S)\nif m == None:\n print('WA')\nelse:\n print('AC')", "import re\n\nS = input()\nm = re.match('^A[a-z]+C[a-z]+$', S)\nif m == None:\n print('WA')\nelse:\n print('AC')"] | ['Runtime Error', 'Accepted'] | ['s163405694', 's748779007'] | [2940.0, 3188.0] | [17.0, 19.0] | [99, 110] |
p03289 | u991567869 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ['s = input()\nl = len(s)\n\nif s[0] == "A":\n if s[2:l - 1].count("C") == 1:\n if s.count("A") == 1:\n s.replace("A", "a")\n s.replace("C", "c")\n if s.islower == True:\n print("AC")\n exit()\nprint("WA")', 's = input()\nl = len(s)\n\nif s[0] == "A":\n if s[2:l - 1].count("C") == 1:\n s.replace("A", "a")\n s.replace("C", "c")\n if s.islower == True:\n print("AC")\n exit()\nprint("WA")', 's = input()\n\nif s[0] == "A":\n if s[2: -1].count("C") == 1:\n if s.count("C") == 1:\n s = s.replace("C", "c")\n if s[1:].islower() == True:\n print("AC")\n exit()\nprint("WA")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s137263320', 's151235212', 's682808035'] | [3060.0, 3060.0, 3068.0] | [18.0, 20.0, 18.0] | [265, 215, 230] |
p03289 | u993435350 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ['S = input()\n\nans = "WA"\n\nif S[0] != "A":\n print(ans)\n \nelse:\n if S[2:len(S) - 1].count("C") != 1:\n print(ans)\n else:\n s = S.index("C")\n SS = S[1:s] + S[s + 1:]\n print(SS)\n if SS.islower() == False:\n print(ans)\n else:\n print("AC")\n ', 'S = input()\n\nans = "WA"\n\nif S[0] != "A":\n print(ans)\n \nelse:\n if S[2:len(S) - 1].count("C") != 1:\n print(ans)\n else:\n s = S.index("C")\n SS = S[1:s] + S[s + 1:]\n if SS.islower() == False:\n print(ans)\n else:\n print("AC")\n '] | ['Wrong Answer', 'Accepted'] | ['s491654067', 's527235844'] | [3060.0, 2940.0] | [17.0, 17.0] | [268, 254] |
p03289 | u994064513 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["S = input()\nN = len(S)\n\ncond1 = True if S[0] == 'A' else False\ncond2 = True if S[3:-2].count('C') == 1 else False\ncond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False\n\nprint('AC') if cond1 and cond2 and cond3 else print('WA')", "S = input()\nN = len(S)\n \ncond1 = True if S[0] == 'A' else False\ncond2 = True if S[3:(N-2)].count('C') == 1 else False\ncond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False\n \nprint('AC') if cond1 and cond2 and cond3 else print('WA')", "S = input()\nN = len(S)\n \ncond1 = True if S[0] == 'A' else False\ncond2 = True if S[3:-2].count('C') == 1 else False\ncond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False\n \nprint('AC') if cond1 and cond2 and cond3 else print('WA')", "S = input()\nN = len(S)\n \ncond1 = True if S[0] == 'A' else False\ncond2 = True if S[2:-1].count('C') == 1 else False\ncond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False\n \nprint('AC') if cond1 and cond2 and cond3 else print('WA')"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s146601600', 's373174136', 's441281853', 's423448561'] | [3060.0, 3060.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0, 18.0] | [241, 246, 243, 243] |
p03289 | u994521204 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["w=input()\nflag=0\nif w[0]=='A' and w[2]=='C'and w[1].lower()==w[1]:\n flag+=0\nelse:\n flag=1 \nif w[3:].lower()==w[:3]:\n flag+=0\nelse:flag=1\nif flag:print('WA')\nelse:print('AC')", "w=input()\nflag=0\nif w[0]=='A' and w.count('C')==1 and w.count('A')==1 and w[1].lower()==w[1] and w[-1].lower()==w[-1]:\n flag+=0\nelse:\n flag=1 \nif w.replace('A','').replace('C','').lower()==w.replace('A','').replace('C',''):\n flag+=0\nelse:flag=1\nif flag:print('WA')\nelse:print('AC')"] | ['Wrong Answer', 'Accepted'] | ['s002864832', 's401217123'] | [3060.0, 3188.0] | [19.0, 19.0] | [185, 293] |
p03289 | u994988729 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ['s=list(input())\nprint(s[2:-1])\n\ndef check(S):\n if not S[0]=="A":\n return False\n if not S[2:-1].count("C")==1:\n return False\n NG=[0, S.index("C")]\n for i,s in enumerate(S):\n if i in NG:\n continue\n if s.isupper():\n return False\n return True\n\nprint("AC") if check(s) else print("WA")\n\n', 's=list(input())\n\ndef check(S):\n if not S[0]=="A":\n return False\n if not S[2:-1].count("C")==1:\n return False\n NG=[0, S.index("C")]\n for i,s in enumerate(S):\n if i in NG:\n continue\n if s.isupper():\n return False\n return True\n\nprint("AC") if check(s) else print("WA")\n\n'] | ['Wrong Answer', 'Accepted'] | ['s083747848', 's701027498'] | [2940.0, 2940.0] | [17.0, 17.0] | [347, 332] |
p03289 | u995062424 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ['s = input()\n\nif(s[0] == "A" and s.count("A") == 1):\n if(s[2:len(s)-1].count("C") == 1 and s.count("C") == 1):\n s.strip("C")\n s.strip("A")\n if(s.islower()):\n print("AC")\n else:\n print("WA")\n else: \n print("WA")\nelse:\n print("WA")', 's = input()\nflg = True\nif(s[0] != "A"):\n flg = False\nif(s[2:-1].count("C")!=1):\n flg = False\nfor i in range(1, len(s)):\n if(s[i] == "C" and i !=len(s)-1):\n continue\n if(s[i].isupper()):\n flg = False\n\nprint("AC" if Flg else "WA")', 's = input()\n\nif(s[0] == "A" and s.count("A") == 1):\n if(s[2:len(s)-1].count("C") == 1 and s.count("C") == 1):\n s = s.replace("C", "")\n s = s.replace("A", "")\n if(s.islower()):\n print("AC")\n else:\n print("WA")\n else: \n print("WA")\nelse:\n print("WA")'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s320829465', 's505246954', 's585295354'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [294, 254, 314] |
p03289 | u995102075 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ['S = input()\n\nans = "WA"\nif S[0] == "A":\n flag = "AC"\n S = S.replace("A", "a", 1)\n\ncount = 0\nfor i in range(2, len(S) - 1):\n if S[i] == "C":\n count += 1\n S = S.replace("C", "c", 1)\nif count != 1:\n ans = "WA"\n\nif not S.islower():\n ans = "WA"\n\nprint(ans)\n', 'S = input()\n\nans = "WA"\nif S[0] == "A":\n ans = "AC"\n S = S.replace("A", "a", 1)\n\ncount = 0\nfor i in range(2, len(S) - 1):\n if S[i] == "C":\n count += 1\n S = S.replace("C", "c", 1)\nif count != 1:\n ans = "WA"\n\nif not S.islower():\n ans = "WA"\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s464327907', 's514931909'] | [3060.0, 3060.0] | [17.0, 17.0] | [281, 280] |
p03289 | u996564551 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ["S = input()\nCS = S[2:-1]\nprint(CS)\nif S[0] == 'A':\n S = S.lstrip('A')\n if CS.count('C') == 1:\n S = S.replace('C', '')\n if S.islower() == True:\n print('AC')\n else:\n print('WA')\n else:\n print('WA')\nelse:\n print('WA')", "S = input()\nCS = S[2:-1]\nif S[0] == 'A':\n S = S.lstrip('A')\n if CS.count('C') == 1:\n S = S.replace('C', '')\n if S.islower() == True:\n print('AC')\n else:\n print('WA')\n else:\n print('WA')\nelse:\n print('WA')"] | ['Wrong Answer', 'Accepted'] | ['s449608261', 's333417401'] | [9036.0, 9024.0] | [30.0, 29.0] | [240, 230] |
p03289 | u999893056 | 2,000 | 1,048,576 | You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive). * All letters except the `A` and `C` mentioned above are lowercase. | ['import sys\n\ns = input()\nif s[0] == "A" and s.count("C") == 1 and "C" in s[2:-1]:\n ss = set(s)\n ss.remove("A")\n ss.remove("C")\n SS = [i.upper() for i in ss]\n if len(ss & SS) == 0:\n print("AC")\n sys.exit()\n\nprint("WA")', 's = input()\n\nprint("AC" if s[0] == "A" and "C" in s[2:-1] and s[1:].replace("C","",1).islower() else "WA")\n'] | ['Runtime Error', 'Accepted'] | ['s100925347', 's293147317'] | [3060.0, 2940.0] | [17.0, 17.0] | [245, 107] |
p03290 | u002459665 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['from itertools import combinations\n\nD, G = map(int, input().split())\nPC = []\nfor i in range(D):\n p, c = map(int, input().split())\n total = ((i + 1) * 100) * p + c\n PC.append([p, c, total])\n\nA = []\nB = {i for i in range(D)}\nfor i in range(D+1):\n A += list(combinations(B, i))\n\nprint(A)\n\nans = []\nfor ai in A:\n p = 0 \n c = 0 \n for aii in ai:\n p += PC[aii][2]\n c += PC[aii][0]\n if p < G:\n x = B.difference(ai)\n max_x = max(x)\n cnt = 0\n while p < G and cnt < PC[max_x][0]:\n p += (max_x + 1) * 100\n cnt += 1\n c += 1\n if p >= G:\n # ans.append([p, c])\n ans.append(c)\n else:\n # ans.append([p, c])\n ans.append(c)\n\nprint(min(ans))', "D, G = map(int, input().split())\nPC = []\nfor i in range(D):\n p, c = list(map(int, input().split()))\n s = (i+1) * 100\n PC.append([p, c, s])\n\nP = []\nfor i in range(2 ** D):\n b = format(i, 'b').zfill(D)\n P.append(b)\n\ndef get_high_score_q(p):\n if p.count('0') == 0:\n return None\n else:\n pos = []\n for i, pi in enumerate(p):\n if pi == '0':\n pos.append(i)\n return pos[-1]\n\nans = 10 ** 10\n# P: ['00', '01', '10', '11']\nfor pi in P:\n # print('pi', pi)\n scores = 0\n probs = 0\n for i, b in enumerate(pi):\n if b == '0':\n pass\n elif b == '1':\n pc = PC[i]\n scores += pc[0] * pc[2] + pc[1]\n probs += pc[0]\n else:\n raise Exception()\n\n \n if scores < G:\n q = get_high_score_q(pi)\n pc = PC[q]\n for i in range(pc[0]):\n scores += pc[2]\n probs += 1\n if scores >= G:\n break\n \n if scores >= G:\n ans = min(ans, probs)\n\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s035270968', 's748339595'] | [3188.0, 3064.0] | [61.0, 44.0] | [792, 1100] |
p03290 | u013408661 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import sys\nd,g=map(int,input().split())\nl=[[int(i) for i in l.split()] for l in sys.stdin]\ndef dfs(x,num,cost):\n if x==len(l):\n return 10**18\n num1+=l[x][0]*100*(x+1)+l[x][1]\n cost1+=l[x][0]\n cost3=dfs(x+1,num1,cost1)\n num2=num\n cost2=cost\n cost4=dfs(x+1,num2,cost2)\n for i in range(len(n),0,-1):\n if (g-num1+i*100-1)//(i*100)<=l[x][0]:\n cost1+=(g-num1+i*100-1)//(i*100)\n break\n for i in range(len(n),0,-1):\n if (g-num2+i*100-1)//(i*100)<=l[x][0]:\n cost2+=(g-num+i*100-1)//(i*100)\n break\n cost=min(cost1,cost2,cost3,cost4)\n return cost\nprint(0,0,0)', 'import sys\nd,g=map(int,input().split())\nl=[[int(i) for i in l.split()] for l in sys.stdin]\ndef dfs(x,num,cost,flag):\n if x==len(l):\n return 10**18\n num1=num+l[x][0]*100*(x+1)+l[x][1]\n cost1=cost+l[x][0]\n flag1=flag|(2**x)\n cost3=dfs(x+1,num1,cost1,flag1)\n num2=num\n cost2=cost\n flag2=flag\n cost4=dfs(x+1,num2,cost2,flag2)\n for i in range(len(l),0,-1):\n if 2**(i-1)&flag1>0:\n continue\n if num1>=g:\n break\n if (g-num1+i*100-1)//(i*100)<l[i-1][0]:\n cost1+=(g-num1+i*100-1)//(i*100)\n num1+=((g-num1+i*100-1)//(i*100))*100*i\n break\n else:\n num1+=l[i-1][0]*100*i+l[i-1][1]\n cost1+=l[i-1][0]\n for i in range(len(l),0,-1):\n if 2**(i-1)&flag2>0:\n continue\n if num2>=g:\n break\n if (g-num2+(i*100)-1)//(i*100)<l[i-1][0]:\n cost2+=(g-num2+(i*100)-1)//(i*100)\n num2+=((g-num2+(i*100)-1)//(i*100))*100*i\n break\n else:\n num2+=l[i-1][0]*100*i+l[i-1][1]\n cost2+=l[i-1][0]\n if num1<g:\n cost1=10**18\n if num2<g:\n cost2=10**18\n cost=min(cost1,cost2,cost3,cost4)\n return cost\nprint(dfs(0,0,0,0))'] | ['Wrong Answer', 'Accepted'] | ['s881713567', 's736142718'] | [3064.0, 3188.0] | [18.0, 35.0] | [588, 1091] |
p03290 | u016881126 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import sys\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nread = sys.stdin.buffer.read\nsys.setrecursionlimit(10 ** 7)\n\nD, G = map(int, readline().split())\nproblems = []\nfor i in range(1, D+1):\n p, c = map(int, readline().split())\n score = 100 * i\n problems.append({\n "score": score,\n "number": p,\n "bonus": c,\n "sum": score * p + c\n })\n\nketa = len(problems)\nanswer = float("inf")\nfor i in range(0, 2 ** D):\n bits = list(str(format(i, "0{}b".format(keta))))\n sum_number = 0\n sum_score = 0\n half_index = None\n for j, is_full in enumerate(bits):\n if is_full == "1":\n sum_number += problems[j]["number"]\n sum_score += problems[j]["sum"]\n else:\n half_index = j\n if half_index is None:\n continue\n for _ in range(problems[half_index]["number"]):\n if sum_score >= G:\n break\n sum_score += problems[half_index]["score"]\n sum_number += 1\n if sum_score >= G:\n answer = min(answer, sum_number)\n break\n\nprint(answer)', 'import sys\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nread = sys.stdin.buffer.read\nsys.setrecursionlimit(10 ** 7)\n\nD, G = map(int, readline().split())\nproblems = []\nfor i in range(1, D+1):\n p, c = map(int, readline().split())\n score = 100 * i\n problems.append({\n "score": score,\n "number": p,\n "bonus": c,\n "sum": score * p + c\n })\n\nketa = len(problems)\nanswer = float("inf")\nfor i in range(0, 2 ** D):\n bits = list(str(format(i, "0{}b".format(keta))))\n sum_number = 0\n sum_score = 0\n half_index = None\n for j, is_full in enumerate(bits):\n if is_full == "1":\n sum_number += problems[j]["number"]\n sum_score += problems[j]["sum"]\n else:\n half_index = j\n if half_index is None:\n if sum_score >= G:\n answer = min(answer, sum_number)\n continue\n for _ in range(problems[half_index]["number"]):\n if sum_score >= G:\n break\n sum_score += problems[half_index]["score"]\n sum_number += 1\n if sum_score >= G:\n answer = min(answer, sum_number)\n\nprint(answer)'] | ['Wrong Answer', 'Accepted'] | ['s023204873', 's755023612'] | [3188.0, 3064.0] | [52.0, 49.0] | [1095, 1153] |
p03290 | u026155812 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import itertools\nimport math\n\nD, G = map(int, input().split())\np, c = [0]*D, [0]*D\nfor i in range(D):\n p[i], c[i] = map(int, input().split())\n\nls = []\nfor i in itertools.product([0, 1], repeat=D):\n sum = 0\n ans = 0\n for j, x in enumerate(i):\n if x == 1:\n sum += c[j] + (100*(j+1))*p[j]\n ans += p[j]\n if sum >= G:\n ls.append(ans)\n else:\n for j, x in enumerate(i[::-1]):\n if x != 1:\n if math.ceil((G-sum)/(100*(D-j))) <= p[D-1-j] - 1:\n ans += math.ceil((G-sum)/(100*(D-j)))\n ls.append(ans)\n break\n else:\n sum += (100*(D-j))*(p[D-1-j] - 1)\n ans += p[D-1-j] - 1\nprint(ls)\n', 'import itertools\nimport math\n\nD, G = map(int, input().split())\np, c = [0]*D, [0]*D\nfor i in range(D):\n p[i], c[i] = map(int, input().split())\n\nls = []\nfor i in itertools.product([0, 1], repeat=D):\n sum = 0\n ans = 0\n for j, x in enumerate(i):\n if x == 1:\n sum += c[j] + (100*(j+1))*p[j]\n ans += p[j]\n if sum >= G:\n ls.append(ans)\n else:\n for j, x in enumerate(i[::-1]):\n if x != 1:\n if math.ceil((G-sum)/(100*(D-j))) <= p[D-1-j] - 1:\n ans += math.ceil((G-sum)/(100*(D-j)))\n ls.append(ans)\n break\n else:\n sum += (100*(D-j))*(p[D-1-j] - 1)\n ans += p[D-1-j] - 1\nprint(min(ls))\n'] | ['Wrong Answer', 'Accepted'] | ['s679074140', 's145336511'] | [3064.0, 3064.0] | [29.0, 29.0] | [765, 770] |
p03290 | u030527617 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['_lst = input().split()\nd = int(_lst[0])\ng = int(_lst[1])\n\npc = list()\n\nfor i in range(d):\n _lst = input().split()\n pc.append((int(_lst[0]), int(_lst[1])))\n\nscore = 0\nresult_count = 0\ntmp = 0\n\n\nfor i in range(2 ** d):\n count = 0\n score = 0\n\n \n for j in range(d):\n print(i >> j, i >> j & 1)\n if i >> j & 1:\n score += 100 * (j + 1) * pc[j][0] + pc[j][1]\n count += pc[j][0]\n\n \n if score > g:\n if result_count >= count or result_count == 0:\n result_count = count\n continue\n\n not_reach = True\n for j in range(d-1, -1, -1):\n if not (i >> j & 1): \n if (g - score) // ((j + 1) * 100) < pc[j][0]: \n count -= (score - g) // ((j + 1) * 100) \n not_reach = False\n\n \n if not_reach or count == 0:\n continue\n\n if result_count >= count or result_count == 0:\n result_count = count\n\nprint(result_count)\n', '_lst = input().split()\nd = int(_lst[0])\ng = int(_lst[1])\n\npc = list()\n\nfor i in range(d):\n _lst = input().split()\n pc.append((int(_lst[0]), int(_lst[1])))\n\nscore = 0\nresult_count = -1\n\n\nfor i in range(2 ** d):\n count = 0\n score = 0\n\n \n for j in range(d):\n if i >> j & 1:\n score += 100 * (j + 1) * pc[j][0] + pc[j][1]\n count += pc[j][0]\n\n \n if score >= g:\n if result_count >= count or result_count == -1:\n result_count = count\n continue\n\n not_reach = True\n for j in range(d-1, -1, -1):\n if not (i >> j & 1): \n if -((score - g) // ((j + 1) * 100)) < pc[j][0]: \n count -= (score - g) // ((j + 1) * 100) \n not_reach = False\n break\n\n \n if not_reach:\n continue\n\n if result_count >= count or result_count == -1:\n result_count = count\n\nprint(result_count)\n'] | ['Wrong Answer', 'Accepted'] | ['s763750904', 's102148307'] | [3828.0, 3064.0] | [39.0, 25.0] | [1366, 1339] |
p03290 | u033606236 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['d,g = map(int,input().split())\nary = [list(map(int,input().split())) for _ in range(d)]\ns = set(i for i in range(d))\nans = float("Inf")\nfor i in range(2**d):\n a = []\n total,count = 0,0\n for j in range(d):\n if i >> j & 1:\n a.append(j)\n for x in a:\n total += 100*(x+1)*ary[x][0]+ary[x][1]\n count += ary[x][0]\n for y in sorted(s - set(a),reverse=True):\n if total + 100*(y+1)*(ary[y][0]-1) >= g:\n count += -(-(g-total) // (100*(y+1)))\n ans = min(ans,count)\n break\n total += 100*(y+1)*(ary[y][0]-1)\n count += ary[y][0]-1\n if total >= g:\n ans = min(ans,count)\nprint(ans)', 'd,g = map(int,input().split())\nary = [list(map(int,input().split())) for _ in range(d)]\ns = set(i for i in range(d))\nans = float("Inf")\nfor i in range(2**d):\n a = []\n total,count = 0,0\n for j in range(d):\n if i >> j & 1:\n a.append(j)\n for x in a:\n total += 100*(x+1)*ary[x][0]+ary[x][1]\n count += ary[x][0]\n if total >= g:\n ans = min(ans,count)\n continue\n for y in sorted(s - set(a),reverse=True):\n if total + 100*(y+1)*(ary[y][0]-1) >= g:\n count += -(-(g-total) // (100*(y+1)))\n ans = min(ans,count)\n break\n total += 100*(y+1)*(ary[y][0]-1)\n count += ary[y][0]-1\n if total >= g:\n ans = min(ans,count)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s800507589', 's738073203'] | [3064.0, 3064.0] | [29.0, 29.0] | [675, 740] |
p03290 | u044964932 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['def main():\n d, g = map(int, input().split())\n pc = [list(map(int, input().split())) for _ in range(d)]\n\n n = len(pc)\n ans = float("inf")\n\n for i in range(2**n):\n point, cnt = 0, 0\n for j in range(n):\n if (i>>j) & 1:\n point += (j+1)*100*pc[j][0] + pc[j][1]\n cnt += pc[j][0]\n if point >= g:\n ans = min(ans, cnt)\n # print(cnt, point)\n else:\n for j in range(n+1, -1, -1):\n if (i >> j) & 1:\n continue\n else:\n for k in range(pc[j][0]):\n if point >= g:\n ans = min(ans, cnt)\n break\n point += (j+1)*100\n cnt += 1\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'def main():\n d, g = map(int, input().split())\n pc = [list(map(int, input().split())) for _ in range(d)]\n\n n = len(pc)\n ans = float("inf")\n\n for i in range(2**n):\n point, cnt = 0, 0\n for j in range(n):\n if (i>>j) & 1:\n point += (j+1)*100*pc[j][0] + pc[j][1]\n cnt += pc[j][0]\n if point >= g:\n ans = min(ans, cnt)\n # print(cnt, point)\n else:\n for j in range(n-1, -1, -1):\n if (i >> j) & 1:\n continue\n else:\n for k in range(pc[j][0]):\n if point >= g:\n ans = min(ans, cnt)\n break\n point += (j+1)*100\n cnt += 1\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s061199990', 's712575481'] | [3064.0, 3188.0] | [18.0, 96.0] | [864, 864] |
p03290 | u057109575 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\nX = [list(map(int, input().split())) for _ in range(D)]\n\ndef func(i, t):\n if i == 0 or i > D:\n return 10 ** 9\n \n # Solve all problems, or part of them\n k = min(t // (100 * i), X[i][0])\n s = 100 * i * k\n \n # If all problems are solved, add bonus\n if k == X[i][0]:\n s += X[i][1]\n \n \n if s < t:\n k += func(i - 1, t - s)\n \n # Select minimum number of solved problems\n # k: solve i-th line\n \n return min(k, func(i - 1, t))\n\n# Solve backward\nprint(func(D, G))', 'D, G = map(int, input().split())\nX = [0] + [list(map(int, input().split())) for _ in range(D)]\n\ndef func(i, t):\n if i == 0:\n return 10 ** 9\n \n # Solve all problems, or part of them\n k = min(t // (100 * i), X[i][0])\n s = 100 * i * k\n \n # If all problems are solved, add bonus\n if k == X[i][0]:\n s += X[i][1]\n \n \n if s < t:\n k += func(i - 1, t - s)\n \n # Select minimum number of solved problems\n # k: solve i-th line\n \n return min(k, func(i - 1, t))\n\n# Solve backward\nprint(func(D, G))\n'] | ['Runtime Error', 'Accepted'] | ['s689742192', 's454518935'] | [3064.0, 3064.0] | [18.0, 18.0] | [628, 626] |
p03290 | u062459048 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append([c,int(i),t-G])\n \nct = 0\nl2 = []\nb = min(l)\nfor j in range(D):\n ct = 0\n if ((b[1] >> j) & 1):\n if b[2] <= PC[j][1]+(j+1)*100:\n b[2] -= PC[j][1]+(j+1)*100\n ct += 1\n while b[2] > (j+1)*100:\n b[2] -= (j+1)*100\n ct += 1\n l2.append(ct)\n \nprint(b[0]-max(l2))\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append(c)\n else:\n ck = []\n for j in range(D):\n if ((i >> j) & 0):\n ck.append(j)\n while t < G:\n t += (max(ck)+1)*100\n c += 1\n l.append(c)\n \nprint(c)\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append(c)\n else:\n ck = []\n for j in range(D):\n if ((i >> j) & 0):\n ck.append(j)\n for k in range(PC[j][0]):\n t += (max(ck)+1)*100\n c += 1\n if t >= G:\n l.append(c)\n \nprint(min(l))\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append([c,i,t-G])\n \nb = min(l)\np = 0\nfor j in range(D):\n if ((b[1] >> j) & 1):\n if b[2] < PC[j][1]+(j+1)*100:\n b[2] -= PC[j][1]+(j+1)*100\n ct = 1\n while b[2] > [j +1]:\n b[2] -= (j+1)*100\n ct += 1\n \nprint(b[0]-ct)\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nPC1 = [[0,0,0,0]]*D\nfor i in range(D):\n PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]\n \nPC1.sort(reverse=True)\naccum = 0\nans = 0\nfor i in range(D):\n dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))\n if G - accum < (PC1[dm][1]-1) * PC1[dm][2]:\n for j in range(PC1[dm][1]):\n accum += PC1[dm][2]\n ans += 1\n if accum >= G:\n print(ans)\n exit()\n else:\n for j in range(PC1[i][1]):\n accum += PC1[i][2]\n ans += 1\n if j == PC1[i][1]-1:\n accum += PC1[i][3]\n if accum >= G:\n print(ans)\n exit()\nprint(ans)\n ', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nPC1 = [[0,0,0,0]]*D\nfor i in range(D):\n PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]\n\ncount = 0\nfor j in range(D):\n count += PC[j][0]\n \nPC1.sort()\naccum = 0\nans = 0\nfor i in range(count):\n if G - accum < D * (PC[D-1][0]-1)\n for j in range(PC[D-1][0]-1)\n accum += D*100\n ans += 1\n if accum >= F:\n print(ans)\n exit()\n else:\n for j in range(PC1[i][1]):\n accum += PC1[i][2]\n ans += 1\n if j == PC1[i][1]-1:\n accum += PC1[i][3]\n if accum >= G:\n print(ans)\n exit()\nprint(ans)\n \n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append(c)\n else:\n ck = []\n for j in range(D):\n if ((i >> j) & 0):\n ck.append(j)\n while t < G:\n t += (max(ck)+1)*100\n c += 1\n l.append(c)\n \nprint(min(l))\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nPC1 = [[0,0,0,0]]*D\nfor i in range(D):\n PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]\n \nPC1.sort()\naccum = 0\nans = 0\nfor i in range(D):\n dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))\n if G - accum < (PC1[dm][1]-1) * PC1[dm][2]:\n for j in range(PC1[dm][1]):\n accum += PC1[dm][2]\n ans += 1\n if accum >= G:\n print(ans)\n exit()\n else:\n for j in range(PC1[i][1]):\n accum += PC1[i][2]\n ans += 1\n if j == PC1[i][1]-1:\n accum += PC1[i][3]\n if accum >= G:\n print(ans)\n exit()\nprint(ans)\n \n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nPC1 = [[0,0,0,0]]*D\nfor i in range(D):\n PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]\n\ncount = 0\nfor j in range(D):\n count += PC[j][0]\n \nPC1.sort()\naccum = 0\nans = 0\nfor i in range(count):\n if G - accum < D * (PC[D-1][0]-1)\n for j in range(PC[D-1][0]-1):\n accum += D*100\n ans += 1\n if accum >= F:\n print(ans)\n exit()\n else:\n for j in range(PC1[i][1]):\n accum += PC1[i][2]\n ans += 1\n if j == PC1[i][1]-1:\n accum += PC1[i][3]\n if accum >= G:\n print(ans)\n exit()\nprint(ans)\n \n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append([c,int(i),t-G])\n \nct = 0\nb = min(l)\nfor j in range(D):\n if ((b[1] >> j) & 1):\n if b[2] <= PC[j][1]+(j+1)*100:\n b[2] -= PC[j][1]+(j+1)*100\n ct += 1\n while b[2] > (j+1)*100:\n b[2] -= (j+1)*100\n ct += 1\n \nprint(b[0]-ct)\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append(c)\n else:\n ck = []\n for j in range(D):\n if ((i >> j) & 0):\n ck.append(j)\n for k in range(PC[j][0]):\n t += (max(ck)+1)*100\n c += 1\n if t >= G:\n l.append(c)\n \nprint(min(l))\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append(c)\n else:\n ck = []\n for j in range(D):\n if ((i >> j) & 0):\n ck.append(j)\n ckm = max(ck)\n for k in range(PC[ckm][0]):\n t += (ckm+1)*100\n c += 1\n if t >= G:\n l.append(c)\n break\n \nprint(min(l))\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nPC1 = [[0,0,0,0]]*D\nfor i in range(D):\n PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]\n \nPC1.sort()\naccum = 0\nans = 0\nfor i in range(D):\n dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))\n if G - accum < PC1[dm][1] * PC1[dm][0]:\n for j in range(PC1[dm][1]):\n accum += PC1[dm][2]\n ans += 1\n if accum >= G:\n print(ans)\n exit()\n else:\n for j in range(PC1[i][1]):\n accum += PC1[i][2]\n ans += 1\n if j == PC1[i][1]-1:\n accum += PC1[i][3]\n if accum >= G:\n print(ans)\n exit()\nprint(ans)\n \n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nPC1 = [[0,0,0,0]]*D\nfor i in range(D):\n PC1[i] = list(((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1])\n\ncount = 0\nfor j in range(D):\n count += PC[j][0]\n \nPC1.sort()\naccum = 0\nans = 0\nfor i in range(count):\n for j in range(PC1[i][1]):\n accum += PC1[i][2]\n ans += 1\n if j = PC1[i][1]-1:\n accum += PC1[i][3]\n if accum >= G:\n print(ans)\n exit()\nprint(ans)\n \n \n \n \n\n \n\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append(c)\n\nprint(min(c))\n', 'D, G = map(int, input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\nl = []\nfor i in range(2 ** D):\n t = 0\n c = 0\n for j in range(D):\n if ((i >> j) & 1):\n t += (j+1)*100*PC[j][0]+PC[j][1]\n c += PC[j][0]\n if t >= G:\n l.append(c)\n else:\n ck = []\n for j in range(D):\n if ((i >> j) & 1):\n continue\n else:\n ck.append(j)\n if ck == []:\n continue\n ckm = max(ck)\n for k in range(PC[ckm][0]):\n t += (ckm+1)*100\n c += 1\n if t >= G:\n l.append(c)\n break\n \nprint(min(l))\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s025367385', 's103657707', 's159197410', 's174102276', 's227841787', 's279295755', 's446608270', 's540928232', 's627384071', 's635984648', 's701382639', 's732372581', 's804850220', 's878314114', 's951268194', 's824449296'] | [3188.0, 3064.0, 3064.0, 3192.0, 3064.0, 3188.0, 3064.0, 3064.0, 3064.0, 3188.0, 3064.0, 3064.0, 3192.0, 3064.0, 3064.0, 3064.0] | [22.0, 18.0, 17.0, 22.0, 18.0, 18.0, 18.0, 18.0, 17.0, 22.0, 17.0, 22.0, 18.0, 17.0, 21.0, 49.0] | [562, 447, 496, 511, 719, 677, 452, 708, 688, 522, 486, 516, 704, 523, 284, 577] |
p03290 | u094999522 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['(d, g), *s = [list(map(int, i.split())) for i in open(0)]\ns = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]\na = 10**9\nfor b in range(1 << d):\n su = sum(s[i] * (b >> i & 1) for i in range(d))\n n = sum(s[i][1] * (b >> i & 1) for i in range(d))\n if su <= g:\n m = d-bin(b)[2:].zfill(d).find("0")\n e =-~(g-su)//(m*100)\n if e < s[m-1][1]:\n a = min(a,n + e)\n if su > g:\n a = min(a,n)\nprint(a)', '(d, g), *s = [list(map(int, i.split())) for i in open(0)]\ns = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]\na = 10**3\nfor b in range(1 << d):\n su = sum(s[i][0] * (b >> i & 1) for i in range(d))\n n = sum(s[i][1] * (b >> i & 1) for i in range(d))\n if su < g:\n m = d-bin(b)[2:].zfill(d).find("0")\n e = (su-g)//(m*100)\n if -e < s[m-1][1]:\n a = min(a,n - e)\n if su >= g:\n a = min(a,n)\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s831197098', 's423592465'] | [3064.0, 3064.0] | [17.0, 25.0] | [449, 452] |
p03290 | u100800700 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["\nd,g=map(int,input().split())\npc=[list(map(int,input()).split()) for i in range(d)]\ndef dfs(i,s,count,r):\n global ans\n if i==d:\n if s<g:\n e=max(r)\n n=min(pc[e-1][0],-(-(g-s)//(n*100)))\n count+=n\n s+=n*e*100\n if s>=g:\n ans=min(ans,count)\n else:\n dfs(i+1,s,r)\n dfs(i+1,s+(i+1)*100*pc[i][0]+pc[i][1],pc[i][0],r-{i+1})\nans=float('inf')\ndfs(0,0,0,set(range(1,d+1)))\nprint(ans)", "d,g=map(int,input().split())\npc=[list(map(int,input().split()) for i in range(d)]\ndef dfs(i,s,count,r):\n global ans\n if i==d:\n if s<g:\n e=max(r)\n n=min(pc[e-1][0],-(-(g-s)//(n*100)))\n count+=n\n s+=n*e*100\n if s>=g:\n ans=min(ans,count)\n else:\n dfs(i+1,s,r)\n dfs(i+1,s+(i+1)*100*pc[i][0]+pc[i][1],pc[i][0],r-{i+1})\nans=float('inf')\ndfs(0,0,0,set(range(1,d+1)))\nprint(ans)", "d,g=map(int,input().split())\na=[list(map(int,input().split()) for i in range(d))]\n\ndef f(i,s,count,nokori):\n global ans\n if s<g:\n b=max(nokori)\n n=min(pc[use-1],-(-(g-s)//(b*100)))\n count+=n\n s+=n*b*100\n if s>=g:\n ans=min(ans,count)\n else:\n f(i+1,s,count,nokori)\n f(i+1,s+a[i][0]*100*(i+1)+a[i][0],count+a[i][0],nokori-{i+1})\n \nans=float('inf')\nf(0,0,0,set(range(1,d+1)))\nprint(ans)", 'def dfs(i, sum, count, nokori):\n global ans\n if i == d:\n \n if sum < g:\n use = max(nokori)\n \n n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))\n count += n\n sum += n * use * 100\n\n if sum >= g:\n ans = min(ans, count)\n else:\n \n dfs(i + 1, sum, count, nokori)\n dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})\n\n\nd, g = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(d)]\n\nans = float("inf")\n\ndfs(0, 0, 0, set(range(1, d + 1)))\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s807895944', 's815643248', 's907183514', 's434969289'] | [3064.0, 2940.0, 3064.0, 3064.0] | [18.0, 17.0, 18.0, 19.0] | [480, 461, 450, 834] |
p03290 | u101350975 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['def dfs(i, sum, count, nokori):\n global ans\n if i == d:\n \n if sum < g:\n use = max(nokori)\n \n n = min(-(-(g - sum) // (use * 100)))\n count += n\n sum += n * use * 100\n\n if sum >= g:\n ans = min(ans, count) \n else:\n \n dfs(i + 1, sum, count, nokori)\n dfs(i + 1, sum + pc[i][0] * (i + 1) * 100\\\n + pc[i][1], count + pc[i][0], nokori - {i + 1})\n\n\nd, g = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(d)]\n\nans = float("inf")\n\ndfs(0, 0, 0, set(range(1, d + 1)))\nprint(ans)', '\ndef dfs(i, sum, count, nokori):\n global ans\n if i == d:\n \n if sum < g:\n use = max(nokori)\n \n n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))\n count += n\n sum += n * use * 100\n\n if sum >= g:\n ans = count\n else:\n \n dfs(i + 1, sum, count, nokori)\n dfs(i + 1, sum + pc[i][0] * (i + 1) * 100\\\n + pc[i][1], count + pc[i][0], nokori - {i + 1})\n\n\nd, g = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(d)]\n\nans = 0\n\ndfs(0, 0, 0, set(range(1, d + 1)))\nprint(ans)', '\ndef dfs(i, sum, count, nokori):\n global ans\n if i == d:\n \n if sum < g:\n use = max(nokori)\n \n n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))\n count += n\n sum += n * use * 100\n\n if sum >= g:\n ans = min(ans, count)\n else:\n \n dfs(i + 1, sum, count, nokori)\n dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})\n\n\nd, g = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(d)]\n\nans = float("inf")\n\ndfs(0, 0, 0, set(range(1, d + 1)))\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s507993404', 's926480290', 's873833339'] | [3064.0, 3064.0, 3064.0] | [18.0, 20.0, 20.0] | [828, 879, 890] |
p03290 | u101851939 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['d, g = map(int, input().split())\np_and_c = [list(map(int, input().split())) for _ in range(d)]\nmin_number = 1000\nfor i in range(2**d):\n score = 0\n number = 0\n p_and_c_copy = p_and_c.copy()\n rest_num = set(range(1, d+1))\n for j in range(d):\n if i & (1 << j):\n number += p_and_c_copy[j-d][0]\n score += p_and_c_copy[j-d][1] + 100 * (j+1) * p_and_c_copy.pop(j-d)[0]\n rest_num.discard(j+1)\n print(score)\n if p_and_c_copy:\n for k in range(p_and_c_copy[-1][0]):\n if score >= g:\n break\n score += 100 * max(rest_num)\n number += 1\n else:\n continue\n min_number = min(min_number, number)\nprint(min_number)', 'd, g = map(int, input().split())\np_and_c = [list(map(int, input().split())) for _ in range(d)]\nmin_number = 1000\nfor i in range(2**d):\n score = 0\n number = 0\n p_and_c_copy = p_and_c.copy()\n rest_num = set(range(1, d+1))\n for j in range(d):\n if i & (1 << j):\n number += p_and_c_copy[j-d][0]\n score += p_and_c_copy[j-d][1] + 100 * (j+1) * p_and_c_copy.pop(j-d)[0]\n rest_num.discard(j+1)\n if p_and_c_copy:\n for k in range(p_and_c_copy[-1][0]):\n if score >= g:\n break\n score += 100 * max(rest_num)\n number += 1\n else:\n continue\n min_number = min(min_number, number)\nprint(min_number)'] | ['Wrong Answer', 'Accepted'] | ['s971563237', 's576815566'] | [3188.0, 3064.0] | [77.0, 77.0] | [730, 713] |
p03290 | u102126195 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\np = []\nc = []\nfor i in range(D):\n P, C = map(int, input().split())\n p.append(P)\n c.append(C)\n\ngetPoint = [[] for i in range(max(p))]\n\n#print(c)\nfor i in range(max(p)):\n for j in range(D):\n if p[j] - 1> i:\n getPoint[i].append((i + 1) * 100 * (j + 1))\n else:\n getPoint[i].append(p[j] * (j + 1) * 100 + c[j])\n\n#print(getPoint)\n\ndef sarch(G, keypoint):\n i = 0\n print(G, keypoint, 1111)\n if max(getPoint[-1]) >= G:\n i = 0\n while True:\n if max(getPoint[i]) >= G:\n print(keypoint + i + 1)\n break\n i += 1\n else:\n G -= max(getPoint[-1])\n keypoint += max(p)\n for i in range(len(getPoint[-1])):\n if getPoint[-1][i] == max(getPoint[-1]):\n key = i\n del p[i]\n del getPoint[max(p) + 1:]\n for i in range(len(getPoint)):\n del getPoint[i][key]\n sarch(G, keypoint)\n\ndef sarch2(G, keypoint):\n if G < 0:\n return print(keypoint)\n num = sorted(getPoint[0])[-1]\n for i in range(len(getPoint[0])):\n if getPoint[0][i] == max(getPoint[0]):\n num = i\n i = 0\n while True:\n if getPoint[i][num] < max(getPoint[i]):\n G -= getPoint[i][num]\n keypoint = keypoint + i + 1\n for j in range(len(getPoint)):\n if j < i:\n #print(j, i)\n getPoint[j][num] = getPoint[j + i + 1][num]\n else:\n getPoint[j][num] = getPoint[-1][num]\n sarch2(G, keypoint)\n break\n i += 1\n if i >= len(getPoint):\n break\ni = 0\n#sarch(G, 0)\nsarch2(G, 0)', 'D, G = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(D)]\n\nans_cnt = 10 ** 20\nfor i in range(2 ** (D)):\n def make_p(i):\n p = bin(i)[2::]\n while len(p) != D:\n p = "0" + p\n key = D\n for j in range(D - 1, -1, -1):\n if int(p[j]) == 0:\n key = j\n break\n return p, key\n \n p_and_key = make_p(i)\n p = p_and_key[0]\n key = p_and_key[1]\n cnt = 0\n ansP = 0\n for j in range(len(p)):\n if p[j] == "1":\n ansP += pc[j][0] * 100 * (j + 1) + pc[j][1]\n cnt += pc[j][0]\n j = 0\n if int(key) != int(D):\n key = int(key)\n while ansP < G:\n j = int(j)\n if pc[key][0] <= j:\n break\n ansP += 100 * (key + 1)\n cnt += 1\n j += 1\n if ansP >= G:\n ans_cnt = min(ans_cnt, cnt)\n\nprint(ans_cnt)\n'] | ['Runtime Error', 'Accepted'] | ['s156339194', 's890396876'] | [3316.0, 3064.0] | [41.0, 90.0] | [1777, 927] |
p03290 | u107915058 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['ans = float("inf")\nfor i in range(1<<d):\n count = 0\n sum = 0\n nokori = set(range(1, d+1))\n \n \n for j in range(d):\n if j & 1<<i:\n sum += pc[i][0]*(i+1)*100+pc[i][1]\n count += pc[i][0]\n nokori.discard(i+1)\n \n \n if sum < g:\n use = max(nokori)\n n = min(pc[use-1][0], (g-sum)//(use*100))\n count += n\n sum += n*use*100\n \n \n if sum >= g:\n ans = min(ans, count)\nprint(ans)', 'd,g = map(int,input().split())\npc = list(list(map(int, input().split())) for _ in range(d))\nans = float("inf")\n\nfor i in range(1<<d):\n score = 0\n cnt = 0\n nokori = set(range(1, d+1))\n \n for j in range(d):\n if i>>j &1:\n score += (j+1)*pc[j][0]*100+pc[j][1]\n cnt += pc[j][0]\n nokori.discard(j+1)\n \n if score < g:\n use = max(nokori)\n n = min(pc[use-1][0], -(-(g-score)//(use*100))) \n cnt += n\n score += n*use*100\n if score >= g:\n ans = min(ans, cnt)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s728990804', 's756668449'] | [9148.0, 9248.0] | [27.0, 36.0] | [624, 588] |
p03290 | u113971909 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import sys\nD,G=map(int,input().split())\nDat=[]\nfor i in range(1,D+1):\n pi,ci=map(int,input().split())\n Dat.append([i,pi,ci])\nGT = 0\nCnt = 0\nfor i in range(D,0,-1):\n for j in range(1,Dat[i-1][1]):\n Cnt += 1\n GT += 100*i\n# print(Cnt,GT)\n if GT>= G:\n print(Cnt)\n sys.exit()\n Cnt += 1\n GT += 100*i +Dat[i-1][2]\n if GT>= G:\n print(Cnt)\n sys.exit()\n', "#!/usr/bin python3\n# -*- coding: utf-8 -*-\n\ndef main():\n D, G = map(int, input().split())\n P = [0] * D\n C = [0] * D\n for i in range(D):\n p, c = map(int,input().split())\n P[i] = p\n C[i] = p * 100 * (i+1) + c\n\n ret = 1000\n for i in range(2 ** D):\n pt = 0\n ct = 0\n for j in range(D):\n if i >> j & 1:\n pt += C[j]\n ct += P[j]\n else:\n mxi = j\n for j in range(P[mxi]):\n if pt>=G:\n break\n else:\n pt += 100*(mxi+1)\n ct += 1\n if pt>=G:\n ret = min(ret, ct)\n print(ret)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s109365017', 's625518929'] | [3064.0, 3064.0] | [18.0, 33.0] | [377, 718] |
p03290 | u118642796 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import math\n\nD,G = map(int,input().split())\nPC = [0] + [[int(i) for i in input().split()] for _ in range(D)]\n\nans = 1e9\nfor i in range(2**D - 1):\n inSolve = -1\n score_tmp = 0\n solved = 0\n for j in range(D):\n if (i>>j)%2 == 1:\n score_tmp += (j+1)*100*PC[j][0]+PC[j][1]\n solved += PC[j][0]\n else:\n inSolve = max(j,inSolve)\n if score_tmp < G and inSolve != -1:\n if math.ceil((G-score_tmp)/((inSolve+1)*100)) <= PC[inSolve][0]:\n ans = min(ans,solved + math.ceil((G-score_tmp)/((inSolve+1)*100)))\n elif score_tmp >= G:\n ans = min(ans,solved)\nprint(ans)', 'import math\n\nD,G = map(int,input().split())\nP = []\nC = []\nfor _ in range(D):\n p,c = map(int,input().split())\n P.append(p)\n C.append(c)\n\nans = sum(P)\nfor i in range(2**D - 1):\n inSolve = -1\n score_tmp = 0\n solved = 0\n for j in range(D):\n if (i>>j)%2 == 1:\n score_tmp += (j+1)*100*P[j]+C[j]\n solved += P[j]\n else:\n inSolve = max(j,inSolve)\n if score_tmp < G and inSolve != -1:\n if math.ceil((G-score_tmp)/((inSolve+1)*100)) <= P[inSolve]:\n ans = min(ans,solved + math.ceil((G-score_tmp)/((inSolve+1)*100)))\n elif score_tmp >= G:\n ans = min(ans,solved)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s461122007', 's408119968'] | [3064.0, 3064.0] | [17.0, 23.0] | [637, 659] |
p03290 | u119148115 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import math\n\nD,G = map(int,input().split())\nd = [list(map(int,input().split())) for i in range(D)]\n\nA = []\nfor i in range(D):\n A.append(100*(i+1)*d[i][0] + d[i][1])\n\nans = 0\nfor i in range(D):\n ans += d[i][0]\n\nfor i in range(2**D):\n a = 0\n g = 0\n B = []\n for j in range(D):\n if (i >> j) & 1:\n a += A[j]\n g += d[j][0]\n else:\n B.append(j)\n b = 0\n for j in B:\n b = max(b,A[j])\n\n if G-b < a <= G:\n c = max(B)\n e = math.ceil((G-a)/(100*(c+1)))\n if e > d[c][0]:\n continue\n else:\n ans = min(ans,g+e)\n\nprint(ans)', 'import math\n\nD,G = map(int,input().split())\nd = [list(map(int,input().split())) for i in range(D)]\n\nA = []\nfor i in range(D):\n A.append(100*(i+1)*d[i][0] + d[i][1])\n\nans = 0\nfor i in range(D):\n ans += d[i][0]\n\nfor i in range(2**D):\n a = 0\n g = 0\n B = []\n for j in range(D):\n if (i >> j) & 1:\n a += A[j]\n g += d[j][0]\n else:\n B.append(j)\n b = 0\n for j in B:\n b = max(b,A[j])\n\n if G-b < a < G+b:\n c = max(B)\n e = math.ceil((G-a)/(100*(c+1)))\n if e <= 0:\n ans = min(ans,g)\n elif e > d[c][0]:\n continue\n else:\n ans = min(ans,g+e)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s882509735', 's412555838'] | [3064.0, 3064.0] | [23.0, 24.0] | [635, 686] |
p03290 | u122132511 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(D)]\n\nans = float("inf")\n\nfor bit in range(1 << D):\n count = 0\n sum = 0\n rest = list(range(1, D+1))\n\n for i in range(D):\n if bit & (1 << i):\n sum += 100 * i * pc[i][0] + pc[i][1]\n count += pc[i][0]\n rest.remove(i+1)\n if sum < G:\n max_num = max(rest)\n n = min(pc[max_num - 1][0], (G - sum) // (max_num * 100))\n count += n\n sum += n*max_num * 100\n if sum >= G:\n ans = min(ans, count)\n\nprint(ans)\n', 'import math\n\nD, G = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(D)]\n\nans = float("inf")\n\nfor bit in range(1 << D):\n count = 0\n sum = 0\n rest = list(range(1, D+1))\n\n for i in range(D):\n if bit & (1 << i):\n sum += (i + 1) * pc[i][0] * 100 + pc[i][1]\n count += pc[i][0]\n rest.remove(i + 1)\n\n if sum < G:\n max_num = max(rest)\n n = min(pc[max_num - 1][0], math.ceil((G - sum) / (max_num * 100)))\n count += n\n sum += n * max_num * 100\n\n if sum >= G:\n ans = min(ans, count)\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s531532471', 's987021596'] | [9140.0, 9236.0] | [34.0, 37.0] | [572, 607] |
p03290 | u127499732 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["def main():\n from itertools import combinations_with_replacement\n from fractions import ceil\n d, g, *pc = map(int, open(0).read().split())\n p, c = pc[::2], pc[1::2]\n ans = 0\n l = range(d)\n for x in combinations_with_replacement(l, d):\n y = list(set(x))\n tmp = g\n count = 0\n for i in y:\n tmp -= (i + 1) * 100 * p[i] + c[i]\n count += p[i]\n if tmp >= g:\n ans = min(ans, count)\n else:\n j = max(y)\n if j == d - 1:\n j -= 1\n else:\n j += 1\n k = ceil(tmp / (100 * (j + 1)))\n if k < p[j]:\n count += k\n ans = min(ans, count)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n from itertools import combinations_with_replacement\n from math import ceil\n\n d, g, *pc = map(int, open(0).read().split())\n p, c = pc[::2], pc[1::2]\n\n q = ceil(g / (d * 100))\n if q < p[-1]:\n print(int(q))\n exit()\n \n ans = sum(p)\n l = range(d)\n for x in combinations_with_replacement(l, d):\n y = list(set(x))\n tmp = g\n count = 0\n for i in y:\n tmp -= ((i + 1) * 100 * p[i] + c[i])\n count += p[i]\n if tmp <= 0:\n ans = min(ans, count)\n else:\n j = max(set(l) - set(x))\n k = ceil(tmp / (100 * (j + 1)))\n if k < p[j]:\n count += k\n ans = min(ans, count)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n from itertools import combinations_with_replacement\n from math import ceil\n d, g, *pc = map(int, open(0).read().split())\n p, c = pc[::2], pc[1::2]\n ans = 0\n l = range(d)\n for x in combinations_with_replacement(l, d):\n y = list(set(x))\n tmp = g\n count = 0\n for i in y:\n tmp -= (i + 1) * 100 * p[i] + c[i]\n count += p[i]\n if tmp >= g:\n ans = min(ans, count)\n else:\n j = max(y)\n if j == d - 1:\n j -= 1\n else:\n j += 1\n k = ceil(tmp / (100 * (j + 1)))\n if k < p[j]:\n count += k\n ans = min(ans, count)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n from itertools import combinations_with_replacement\n from math import ceil\n\n d, g, *pc = map(int, open(0).read().split())\n p, c = pc[::2], pc[1::2]\n ans = sum(p)\n \n q = ceil(g / (d * 100))\n if q < p[-1]:\n ans = q\n \n l = range(d)\n for x in combinations_with_replacement(l, d):\n y = list(set(x))\n tmp = g\n count = 0\n for i in y:\n tmp -= ((i + 1) * 100 * p[i] + c[i])\n count += p[i]\n if tmp <= 0:\n ans = min(ans, count)\n else:\n j = max(set(l) - set(x))\n k = ceil(tmp / (100 * (j + 1)))\n if k < p[j]:\n count += k\n ans = min(ans, count)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s364219838', 's938487141', 's942930939', 's713695259'] | [5048.0, 3064.0, 3064.0, 3188.0] | [38.0, 459.0, 377.0, 470.0] | [781, 800, 776, 783] |
p03290 | u146597538 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["d,g = map(int, input().split())\n\npc = [list(map(int, input().split())) for _ in range(d)]\n\nans=float('inf')\nfor bit in range(2**d):\n b = 0\n score = 0\n num = 0\n \n \n for i in range(d):\n if (bit >> i) & 1:\n \n score += pc[0][i] * (i+1) * 100 + pc[1][i]\n \n num += pc[0][i]\n else:\n \n \n b = i\n\n \n for j in range(pc[b][0]):\n if score>=g and num<ans:\n ans=num\n score+=(b+1)*100\n num+=1\n\nprint(ans)", "d,g = map(int, input().split())\n\npc = [list(map(int, input().split())) for _ in range(d)]\n\nans=float('inf')\nfor bit in range(2**d):\n b = 0\n score = 0\n num = 0\n \n \n for i in range(d):\n if (bit >> i) & 1:\n \n score += pc[i][0] * (i+1) * 100 + pc[i][1]\n \n num += pc[i][0]\n else:\n \n \n b = i\n\n \n for j in range(pc[b][0]):\n if score>=g and num<ans:\n ans=num\n score+=(b+1)*100\n num+=1\n\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s727334994', 's017572083'] | [3064.0, 3064.0] | [18.0, 55.0] | [1002, 1002] |
p03290 | u160244242 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["import math\n\nd, g = map(int, input().split())\nlst = [list(map(int, input().split())) for _ in range(d)]\n\nfor k,i in enumerate(lst):\n i.append((k+1)*100)\n i.append(i[2]*i[0]+i[1])\n\ndef calcurate(pt, count, g, lst):\n lst1 = list()\n for i in lst:\n if i[3] > g - pt:\n lst1.append(i + [i[2]])\n else:\n lst1.append(i + [i[3]/i[0]])\n lst1 = sorted(lst1, key = lambda x: -x[-1])\n ps = lst1[0]\n if ps[3] > g - pt:\n count += math.ceil((g - pt) / ps[2])\n return print(count)\n elif ps[3] == g - pt:\n return print(count + ps[0])\n else:\n print('point :', pt+ps[3], '\\ncount :', count+ps[0], '\\nremainlst :', lst1[1:])\n calcurate(pt+ps[3], count+ps[0], g, lst1[1:])\n\ncalcurate(0,0,g,lst)", 'import math\n\nd, g = map(int, input().split())\nlst = [list(map(int, input().split())) for _ in range(d)]\n\nfor k,i in enumerate(lst):\n i.append((k+1)*100)\n i.append(i[2]*i[0]+i[1])\n\ndef calcurate(pt, count, g, lst):\n lst1 = list()\n for i in lst:\n if i[3] > g - pt:\n lst1.append(i + [i[2]])\n else:\n lst1.append(i + [i[3]/i[0]])\n lst1 = sorted(lst1, key = lambda x: -x[-1])\n ps = lst1[0]\n if ps[3] > g - pt:\n count += math.ceil((g - pt) / ps[2])\n return print(count)\n elif ps[3] == g - pt:\n return print(count + ps[0])\n else:\n calcurate(pt+ps[3], count+ps[0], g, lst1[1:])\n\ncalcurate(0,0,g,lst)', "d, g = map(int, input().split())\nlst = [list(map(int, input().split())) for _ in range(d)]\n\nlst1 = list()\nfor k, pair in enumerate(lst):\n lst1.append([pair[0], pair[1], (k+1)*100, (k+1)*100*pair[0]+pair[1]])\nlst = lst1\n\nstring = '0' + str(d) + 'b'\nstr_lst = []\nfor i in range(0, 2**d):\n str_lst.append(format(i, string))\n \nmin_count = 10 ** 100\nfor str1 in str_lst:\n count = 0\n pt = 0\n remain = list()\n for k, qua in enumerate(lst):\n if str1[k] == '1':\n count += qua[0]\n pt += qua[3]\n else:\n remain.append(qua)\n if pt < g:\n qua = remain[-1]\n for i in range(qua[0]-1):\n count += 1\n pt += qua[2]\n if pt >= g:\n break\n if pt >= g:\n if min_count > count:\n min_count = count\n \nprint(min_count)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s360418449', 's840659963', 's684963925'] | [3064.0, 3064.0, 3064.0] | [19.0, 18.0, 42.0] | [769, 681, 852] |
p03290 | u163320134 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["import math\n\nn,g=map(int,input().split())\narr=[list(map(int,input().split())) for _ in range(n)]\ncomp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]\nans=10**10\nfor i in range(2**n):\n flag=format(i,'b')\n if len(flag)<n:\n flag='0'*(n-len(flag))+flag\n tsum=0\n tans=0\n for i in range(n):\n if flag[i]=='1':\n tsum+=comp[i]\n tans+=arr[i][0]\n if tsum>=g:\n ans=min(ans,tans)\n else:\n pos=flag[::-1].index('0')\n tq=math.ceil(g-tsum)/(100*(n-pos)))\n if tq<=arr[n-pos-1][0]:\n ans=min(ans,tans+tq)\nprint(ans)", "import math\n\nn,g=map(int,input().split())\narr=[list(map(int,input().split())) for _ in range(n)]\ncomp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]\nans=10**10\nfor i in range(2**n):\n flag=format(i,'b')\n if len(flag)<n:\n flag='0'*(n-len(flag))+flag\n tsum=0\n tans=0\n for i in range(n):\n if flag[i]=='1':\n tsum+=comp[i]\n tans+=arr[i][0]\n if tsum>=g:\n ans=min(ans,tans)\n else:\n pos=flag[::-1].index('0')\n tq=math.ceil((g-tsum)/(100*(n-pos)))\n if tq<=arr[n-pos-1][0]:\n ans=min(ans,tans+tq)\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s476336532', 's766907194'] | [3064.0, 3064.0] | [17.0, 22.0] | [539, 540] |
p03290 | u164471280 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import itertools\nn, g = map(int, input().split())\nL = []\nfor i in range(n):\n t = list(map(int, input().split()))\n \n t.append((i+1)*100)\n L.append(t)\nprint(n, g, L)\n\nans = 100 * n\nfor v in itertools.permutations(L):\n print(v)\n score = 0\n count = 0\n k = 0\n p = v[k][0]\n while score < g:\n score += v[k][2]\n p -= 1 # v[k][0] -= 1\n count += 1\n if p == 0: # v[k][0] == 0:\n score += v[k][1]\n k += 1\n if k < n:\n p = v[k][0]\n print(v,count,score,k,p)\n ans = min(ans, count)\nprint(ans)\n\n\n# P = []\n# G = []\n\n# s, t = map(int, input().split())\n# P.insert(0, s)\n# G.insert(0, t//100)\n# score = 0\n\n# count = 0\n# while score < g:\n# count += 1\n# if 1 in P:\n# j = P.index(1)\n# score += n-j + G[j]\n# P[j] = 0\n# if j == k:\n\n# else:\n# score += n-k\n# P[k] -= 1\n# print(P,G,score,count,k)\n# print(count)', 'import itertools\nn, g = map(int, input().split())\nL = []\nfor i in range(n):\n t = list(map(int, input().split()))\n \n t.append((i+1)*100)\n \n t.append((i+1)*100*t[0]+t[1])\n L.append(t)\nprint(L)\n\n\n\n\n# ans = 100 * n\n# for v in itertools.permutations(L):\n# score = 0\n# count = 0\n\n# p = v[k][0]\n# while score < g:\n# score += v[k][2]\n# p -= 1\n# count += 1\n# if p == 0:\n# score += v[k][1]\n\n\n# p = v[k][0]\n# ans = min(ans, count)\n# print(ans)\n\n\n# P = []\n# G = []\n\n# s, t = map(int, input().split())\n# P.insert(0, s)\n# G.insert(0, t//100)\n# score = 0\n\n# count = 0\n# while score < g:\n# count += 1\n# if 1 in P:\n# j = P.index(1)\n# score += n-j + G[j]\n# P[j] = 0\n# if j == k:\n\n# else:\n# score += n-k\n# P[k] -= 1\n# print(P,G,score,count,k)\n# print(count)', 'import itertools\nn, g = map(int, input().split())\nL = []\nfor i in range(n):\n t = list(map(int, input().split()))\n \n t.append((i+1)*100)\n \n t.append((i+1)*100*t[0]+t[1])\n L.append(t)\n# print(L)\n\nans = g//100\n\nfor i in range(2**n):\n count = 0\n score = 0\n m = 0\n for j in range(n):\n if (i >> j) & 1:\n score += L[j][3]\n count += L[j][0]\n else:\n m = j\n # print(bin(i), m, score, count)\n if score >= g:\n ans = min(ans, count)\n else: \n if (g - score)/L[m][2] <= L[m][0] and (g - score)%L[m][2] == 0:\n count += (g - score)//L[m][2]\n elif (g - score)/L[m][2] + 1 <= L[m][0]:\n count += ((g - score)//L[m][2])+1\n else:\n count = g//100\n ans = min(ans, count)\n # print(bin(i), m, L[m], score, count)\nprint(ans)\n\n\n# ans = 100 * n\n# for v in itertools.permutations(L):\n# score = 0\n# count = 0\n\n# p = v[k][0]\n# while score < g:\n# score += v[k][2]\n# p -= 1\n# count += 1\n# if p == 0:\n# score += v[k][1]\n\n\n# p = v[k][0]\n# ans = min(ans, count)\n# print(ans)\n\n\n# P = []\n# G = []\n\n# s, t = map(int, input().split())\n# P.insert(0, s)\n# G.insert(0, t//100)\n# score = 0\n\n# count = 0\n# while score < g:\n# count += 1\n# if 1 in P:\n# j = P.index(1)\n# score += n-j + G[j]\n# P[j] = 0\n# if j == k:\n\n# else:\n# score += n-k\n# P[k] -= 1\n# print(P,G,score,count,k)\n# print(count)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s477378451', 's583933659', 's014531941'] | [65268.0, 3064.0, 3064.0] | [2103.0, 17.0, 22.0] | [1054, 1225, 1922] |
p03290 | u168333670 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\n\nquestion_list = []\n\nfor i in range(D):\n p, c = map(int, input().split())\n question_list.append([p, c])\n\n\nans = 10 ** 5\n\nfor i in range(D): \n others = D - 1\n\n for j in range(2 ** others): \n bit = format(j, "0" + str(D) + "b")\n total = 0\n num_q = 0\n for k in range(D):\n if k == i:\n continue\n if bit[k] == "1":\n total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]\n num_q += question_list[k][0]\n \n res = max(0, G - total)\n if res > 0: \n res_q = res // (100 * (i + 1)) + (1 if res % (100 * (i+1)) != 0 else 0)\n if res_q > question_list[i][0]: \n continue\n num_q += res_q\n \n ans = min(ans, num_q)\n\nprint(ans)', 'D, G = map(int, input().split())\n\nquestion_list = []\n\nfor i in range(D):\n p, c = map(int, input().split())\n question_list.append([p, c])\n\n\nans = 10 ** 5\n\nfor i in range(D): \n others = D - 1\n\n for j in range(2 ** others): \n bit = format(j, "0" + str(D) + "b")\n total = 0\n num_q = 0\n for k in range(D):\n if k == i:\n continue\n if bit[k] == "1":\n total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]\n num_q += question_list[k][0]\n \n res = max(0, G - total)\n if res > 0: \n res_q = int(res / (100 * (i + 1)) + 0.5)\n if res_q > question_list[i][0]: \n continue\n num_q += res_q\n \n ans = min(ans, num_q)\n\nprint(ans)', 'D, G = map(int, input().split())\n\nquestion_list = []\n\nfor i in range(D):\n p, c = map(int, input().split())\n question_list.append([p, c])\n\n\nans = 10 ** 5\n\nfor i in range(D): \n others = D - 1\n\n for j in range(2 ** others): \n bit = format(j, "0" + str(D) + "b")\n total = 0\n num_q = 0\n for k in range(D):\n if k == i:\n continue\n if bit[k] == "1":\n total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]\n num_q += question_list[k][0]\n \n res = max(0, G - total)\n res_q = 0\n if res > 0: \n res_q = res // (100 * (i + 1)) + (1 if res % (100 * (i + 1)) > 0 else 0)\n if res_q > question_list[i][0]: \n continue\n num_q += res_q\n \n ans = min(ans, num_q)', 'D, G = map(int, input().split())\n\nquestion_list = []\n\nfor i in range(D):\n p, c = map(int, input().split())\n question_list.append([p, c])\n\n\nans = 10 ** 5\n\nfor i in range(2 ** D):\n bit = format(i, "0" + str(D) + "b") \n\n total = 0\n num_q = 0\n for j in range(len(bit)):\n if bit[j] == "1":\n total += question_list[j][0] * 100 * (j + 1) + question_list[j][1]\n num_q += question_list[j][0]\n \n res = max(0, G - total)\n\n if res > 0:\n ind = bit.rfind("0")\n res_q = res // (100 * (ind + 1)) + (1 if (res % (100 * (ind + 1)) != 0) else 0)\n if res_q > question_list[ind][0]:\n continue\n num_q += res_q\n \n ans = min(ans, num_q)\n\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s347167485', 's659135081', 's704181860', 's117010751'] | [3064.0, 3064.0, 3064.0, 3064.0] | [47.0, 48.0, 47.0, 24.0] | [1045, 1014, 1052, 772] |
p03290 | u171366497 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['#2-1-1 #ABC104C\nd,g = map(int,input().split())\nq={}\ncomp={}\np={}\nminsolve=0\nfor i in range(d):\n a,b=map(int,input().split())\n q[i]=a\n p[i]=100*(i+1)\n comp[i]=100*(i+1)*a+b\n minsolve+=a\n \nsolve=[0 for _ in range(d)]\ndef roop(s,check,point,solved,minsolve):\n solve=s.copy()\n solve2=s.copy()\n if check==d:\n if 0 in solve:\n solverev=solve.copy()\n solverev.reverse()\n idx=d-solverev.index(0)-1\n shold=min(0,1+(g-point-1)//p[idx])\n if q[idx]>shold and shold>=0:\n solved+=shold\n minsolve=min(minsolve,solved)\n return minsolve\n\n minsolve=roop(solve,check+1,point,solved,minsolve)\n solve2[check]+=1\n minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)\n return minsolve\n\nprint(roop(solve,0,0,0,minsolve))', '#2-1-1 #ABC104C\nd,g = map(int,input().split())\nq={}\ncomp={}\np={}\nminsolve=0\nfor i in range(d):\n a,b=map(int,input().split())\n q[i]=a\n p[i]=100*(i+1)\n comp[i]=100*(i+1)*a+b\n minsolve+=a\n \nsolve=[0 for _ in range(d)]\ndef roop(s,check,point,solved,minsolve):\n solve=s.copy()\n solve2=s.copy()\n if check==d:\n if 0 in solve:\n solverev=solve.copy()\n solverev.reverse()\n idx=d-solverev.index(0)-1\n shold=max(0,1+(g-point-1)//p[idx])\n if q[idx]>shold and shold>=0:\n solved+=shold\n minsolve=min(minsolve,solved)\n return minsolve\n\n minsolve=roop(solve,check+1,point,solved,minsolve)\n solve2[check]+=1\n minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)\n return minsolve\n\nprint(roop(solve,0,0,0,minsolve))'] | ['Wrong Answer', 'Accepted'] | ['s673073615', 's164951330'] | [3064.0, 3064.0] | [20.0, 22.0] | [853, 853] |
p03290 | u172035535 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["def func(i,g,cnt):\n\tif not g:\n\t\treturn cnt\n\telif i < 0:\n\t\treturn float('inf')\n\n\tcur_cnt = g//((i+1)*100)\n\tif g % (i+1)*100:\n\t\tcur_cnt += 1\n\tcur_cnt = min(cur_cnt,PC[i][0])\n\tg -= (i+1)*100*cur_cnt\n\tif cur_cnt == PC[i][0]:\n\t\t\n\t\tg -= PC[i][1]\n\t# print(g,cnt+cur_cnt)\n\tcnt = func(i-1,g,cnt+cur_cnt)\n\treturn cnt\n\n\nD,G = map(int,input().split())\nPC= [list(map(int,input().split())) for _ in range(D)]\n\nans = [func(i,G,0) for i in range(D)]\nprint(min(ans))", 'D,G = map(int,input().split())\nPC = [list(map(int,input().split())) for i in range(D)]\n\ndef up_f(i,score):\n\tif i == D+1:\n\t\treturn 10**9\n\tn = min(score//(i*100),PC[i-1][0])\n\ts = n*100*i\n\ts += PC[i-1][1] if n == PC[i-1][0] else 0\n\tif s < score:\n\t\tn += up_f(i+1,score-s)\n\treturn min(n,up_f(i+1,score))\n\ndef down_f(i,score):\n\tif i == 0:\n\t\treturn 10**9\n\tn = min(score//(i*100),PC[i-1][0])\n\ts = n*100*i\n\ts += PC[i-1][1] if n == PC[i-1][0] else 0\n\tif s < score:\n\t\tn += down_f(i-1,score-s)\n\treturn min(n,down_f(i-1,score))\n\nprint(min(up_f(1,G),down_f(D,G)))'] | ['Wrong Answer', 'Accepted'] | ['s697267221', 's455283270'] | [3064.0, 3188.0] | [18.0, 20.0] | [492, 549] |
p03290 | u173243396 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["D,G=map(int, input().split())\nscoremap=[list(map(int, input().split())) for d in range(D)]\nanswer=float('inf')\n\nfor i in range(2**D):\n yet=[]\n score=count=0\n for j in range(D):\n if i>>j&1==0:\n yet.append(j)\n continue\n score+=scoremap[j][1]+(j+1)*100*scoremap[j][0]\n count+=scoremap[j][0]\n if score>=G:\n answer=min(count,answer)\n continue\n print(yet)\n for y in reversed(yet):\n temp=0\n while score<G:\n temp+=1\n if temp==scoremap[y][0]:\n break\n score+=(y+1)*100\n count+=1\n else:\n answer=min(count,answer)\n break\n\nprint(answer)\n ", "D,G=map(int, input().split())\nscoremap=[list(map(int, input().split())) for d in range(D)]\nanswer=float('inf')\n\nfor i in range(2**D):\n yet=[]\n score=count=0\n for j in range(D):\n if i>>j&1==0:\n yet.append(j)\n continue\n score+=scoremap[j][1]+(j+1)*100*scoremap[j][0]\n count+=scoremap[j][0]\n if score>=G:\n answer=min(count,answer)\n continue\n for y in reversed(yet):\n temp=0\n while score<G:\n temp+=1\n if temp==scoremap[y][0]:\n break\n score+=(y+1)*100\n count+=1\n else:\n answer=min(count,answer)\n break\n\nprint(answer)\n "] | ['Wrong Answer', 'Accepted'] | ['s678545777', 's776095322'] | [3188.0, 3064.0] | [206.0, 214.0] | [605, 592] |
p03290 | u185354171 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["\nD,G = map(int,list(input().split()))\n\np_tatal = []\nfor i in range(D):\n p,c = map(int,list(input().split()))\n p_tatal.append([p,p*(i+1)*100+c])\n\nans = 10**18\nfor i in range(2**D):\n binary = bin(i)[2:].zfill(D)\n tatal = 0\n cnt = 0\n for j in range(D):\n if binary[j]=='1':\n tatal += p_tatal[j][1]\n cnt += p_tatal[j][0]\n else:\n not_use = j\n print(tatal,cnt) \n if tatal >= G:\n# print(cnt)\n ans = min(ans,cnt)\n elif tatal < G <= tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:\n cnt += (G - tatal)// ((not_use+1)*100)\n# print(cnt)\n ans = min(ans,cnt)\n else:\n continue\n \n\nprint(ans) \n\n", "\nD,G = map(int,list(input().split()))\n\np_tatal = []\nfor i in range(D):\n p,c = map(int,list(input().split()))\n p_tatal.append([p,p*(i+1)*100+c])\n\nans = 10**18\nfor i in range(2**D):\n binary = bin(i)[2:].zfill(D)\n tatal = 0\n cnt = 0\n for j in range(D):\n if binary[j]=='1':\n tatal += p_tatal[j][1]\n cnt += p_tatal[j][0]\n else:\n not_use = j\n# print(1tatal,cnt) \n if tatal >= G:\n# print(cnt)\n ans = min(ans,cnt)\n elif tatal < G <= tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:\n cnt += -(-(G - tatal)// ((not_use+1)*100))\n# print(cnt)\n ans = min(ans,cnt)\n else:\n continue\n \n\nprint(ans) \n\n"] | ['Wrong Answer', 'Accepted'] | ['s973676823', 's270721292'] | [3316.0, 3064.0] | [24.0, 22.0] | [709, 715] |
p03290 | u197457087 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D,G = map(int,input().split())\n\nP = []\nC = []\nfor i in range(D):\n tempP, tempc = map(int, input().split())\n P.append(tempP)\n C.append(tempC)\n\nprint(P,C)\n', 'd, g = map(int, input().split())\npc = [list(map(int, input().split())) for i in range(d)]\n\nans = float("inf")\n\nfor bit in range(1 << d): \n count = 0\n sum = 0\n nokori = [i+1 for i in range(d)]\n\n for i in range(d): \n if bit & (1 << i):\n sum += pc[i][0] * (i + 1) * 100 + pc[i][1]\n count += pc[i][0]\n nokori.remove(i + 1)\n\n \n if sum < g:\n use = max(nokori)\n n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))\n count += n\n sum += n * use * 100\n\n if sum >= g:\n ans = min(ans, count)\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s792512168', 's298303903'] | [2940.0, 3064.0] | [17.0, 25.0] | [156, 790] |
p03290 | u199295501 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['# -*- coding: utf-8 -*-\nimport itertools\n\nD, G = map(int, input().split())\n\npi = []\nci = []\nscore_i_c = []\nscore_i_h = []\nfor i in range(D):\n p_t, c_t = map(int, input().split())\n pi.append(p_t)\n ci.append(c_t)\n tmp = p_t * 100 * (i + 1) + c_t\n score_i_c.append((i,tmp,p_t))\n tmp = (p_t - 1) * 100 * (i + 1)\n score_i_h.append((i,tmp,p_t))\n\n\nstep1_list = []\nfor i,score,num in score_i_h:\n if score >= G:\n step1_list.append((i,score,num))\n\nsum_list = []\nif len(step1_list) > 0:\n min_i , _, _ = step1_list[-1]\n for i , score, num in step1_list:\n tmp_score = 0\n tmp_num = 0\n for i in range(pi[min_i]):\n if tmp_score >= G:\n break\n else:\n tmp_score += (min_i+1) * 100\n tmp_num += 1\n sum_list.append(tmp_num)\n print(min(sum_list))\n exit()\n\n\nstep1_list = []\nfor i in range(D):\n tmp = itertools.combinations(score_i_c, i+1)\n step1_list.extend(list(tmp))\n\n\nsum_list = []\nfor l in step1_list:\n numbers = []\n sum_score = 0\n sum_num = 0\n for i,score,num in l:\n numbers.append(i)\n sum_score += score\n sum_num += num\n\n if sum_score >= G:\n sum_list.append((numbers,sum_score,sum_num))\n#\n# print(step1_list)\n# print(sum_list)\n\nmin_numbers = []\nmin_score = 0\nmin_num = 10000\nfor i,score,num in sum_list:\n if num < min_num:\n min_numbers = i\n min_score = score\n min_num = num\n\n# print(min_numbers,min_score,min_num)\n\nans_list = []\n# min_i = min_numbers[-1]\nfor min_i in min_numbers:\n tmp_score = min_score - score_i_c[min_i][1]\n tmp_num = min_num - score_i_c[min_i][2]\n\n for i in range(pi[min_i]):\n if tmp_score >= G:\n break\n else:\n tmp_score += (min_i+1) * 100\n tmp_num += 1\n\n ans_list.append(tmp_num)\n\n# print(ans_list)\n\nprint(min(ans_list))\n', '# -*- coding: utf-8 -*-\nimport itertools\n\nD, G = map(int, input().split())\n\npi = []\nci = []\nscore_i_c = []\nscore_i_h = []\nfor i in range(D):\n p_t, c_t = map(int, input().split())\n pi.append(p_t)\n ci.append(c_t)\n tmp = p_t * 100 * (i + 1) + c_t\n score_i_c.append((i,tmp,p_t))\n tmp = (p_t - 1) * 100 * (i + 1)\n score_i_h.append((i,tmp,p_t))\n\n\nstep1_list = []\nfor i,score,num in score_i_h:\n if score >= G:\n step1_list.append((i,score,num))\n\nif len(step1_list) > 0:\n min_i , _, _ = step1_list[-1]\n\n tmp_score = 0\n tmp_num = 0\n for i in range(pi[min_i]):\n if tmp_score >= G:\n break\n else:\n tmp_score += (min_i+1) * 100\n tmp_num += 1\n\n print(tmp_num)\n exit()\n\n\nstep1_list = []\nfor i in range(D):\n tmp = itertools.combinations(score_i_c, i+1)\n step1_list.extend(list(tmp))\n\nsum_list = []\nfor l in step1_list:\n numbers = []\n sum_score = 0\n sum_num = 0\n for i,score,num in l:\n numbers.append(i)\n sum_score += score\n sum_num += num\n\n if sum_score >= G:\n sum_list.append((numbers,sum_score,sum_num))\n#\n# print(step1_list)\n# print(sum_list)\n\nmin_numbers = []\nmin_score = 0\nmin_num = 10000\nfor i,score,num in sum_list:\n if num < min_num:\n min_numbers = i\n min_score = score\n min_num = num\n\n# print(min_numbers,min_score,min_num)\n\nans_list = []\n# min_i = min_numbers[-1]\nfor min_i in min_numbers:\n tmp_score = min_score - score_i_c[min_i][1]\n tmp_num = min_num - score_i_c[min_i][2]\n\n for i in range(pi[min_i]):\n if tmp_score >= G:\n break\n else:\n tmp_score += (min_i+1) * 100\n tmp_num += 1\n\n ans_list.append(tmp_num)\n\n# print(ans_list)\n\nprint(min(ans_list))\n', '# -*- coding: utf-8 -*-\nimport itertools\n\nD, G = map(int, input().split())\n\npi = []\nci = []\nscore_i_c = []\nscore_i_h = []\nfor i in range(D):\n p_t, c_t = map(int, input().split())\n pi.append(p_t)\n ci.append(c_t)\n tmp = p_t * 100 * (i + 1) + c_t\n score_i_c.append((i,tmp,p_t))\n tmp = (p_t - 1) * 100 * (i + 1)\n score_i_h.append((i,tmp,p_t))\n\n\nstep1_list = []\nfor i,score,num in score_i_h:\n if score >= G:\n step1_list.append((i,score,num))\n\nans_list = []\nif len(step1_list) > 0:\n min_i , _, _ = step1_list[-1]\n for i , score, num in step1_list:\n tmp_score = 0\n tmp_num = 0\n for i in range(pi[min_i]):\n if tmp_score >= G:\n break\n else:\n tmp_score += (min_i+1) * 100\n tmp_num += 1\n ans_list.append(tmp_num)\n\n\nstep1_list = []\nfor i in range(D):\n tmp = itertools.combinations(score_i_c, i+1)\n step1_list.extend(list(tmp))\n\n\nsum_list = []\nfor l in step1_list:\n numbers = []\n sum_score = 0\n sum_num = 0\n for i,score,num in l:\n numbers.append(i)\n sum_score += score\n sum_num += num\n\n if sum_score >= G:\n sum_list.append((numbers,sum_score,sum_num))\n#\n# print(step1_list)\n# print(sum_list)\n\n# min_numbers = []\n# min_score = 0\n\n# for i,score,num in sum_list:\n\n# min_numbers = i\n# min_score = score\n\n\n# print(min_numbers,min_score,min_num)\n\n# min_i = min_numbers[-1]\nfor min_numbers,min_score,min_num in sum_list:\n for min_i in min_numbers:\n tmp_score = min_score - score_i_c[min_i][1]\n tmp_num = min_num - score_i_c[min_i][2]\n\n for i in range(pi[min_i]):\n if tmp_score >= G:\n break\n tmp_score += (min_i+1) * 100\n tmp_num += 1\n\n ans_list.append(tmp_num)\n\n# print(ans_list)\n\nprint(min(ans_list))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s051765038', 's743638424', 's961197256'] | [3316.0, 3316.0, 3572.0] | [21.0, 21.0, 44.0] | [2013, 1843, 2040] |
p03290 | u201234972 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["S = input()\nL = len(S)\nQ = 10**9 + 7\nanum = [ 0 for _ in range(L+1)]\n#bnum = [ 0 for _ in range(L+1)]\ncnum = [ 0 for _ in range(L+1)]\nhnum = [ 0 for _ in range(L+1)]\nfor i in range(1,L+1):\n if S[i-1] == 'A':\n anum[i] = anum[i-1] + 1\n# bnum[i] = bnum[i-1]\n cnum[i] = cnum[i-1]\n hnum[i] = hnum[i-1]\n elif S[i-1] == 'B':\n anum[i] = anum[i-1]\n# bnum[i] = bnum[i-1] + 1\n cnum[i] = cnum[i-1]\n hnum[i] = hnum[i-1]\n elif S[i-1] == 'C':\n anum[i] = anum[i-1]\n# bnum[i] = bnum[i-1]\n cnum[i] = cnum[i-1] + 1\n hnum[i] = hnum[i-1]\n else:\n anum[i] = anum[i-1]\n# bnum[i] = bnum[i-1]\n cnum[i] = cnum[i-1]\n hnum[i] = hnum[i-1] + 1\n\nans = 0\nczen = cnum[L]\nhzen = hnum[L] \nfor i in range(1,L+1):\n if S[i-1] == 'B' or S[i-1] == '?':\n A = (anum[i-1]*(3**hnum[i-1]) + hnum[i-1]*(2**(hnum[i-1]-1)))%Q\n C = ((czen - cnum[i])*(3**(hzen - hnum[i])) + (hzen - hnum[i])*(2**(hzen - hnum[i]-1)))%Q\n ans = (ans + A*C)%Q\nprint(int(ans)) \n ", 'from itertools import product\nD, G = map( int, input().split())\nP = []\nC = []\nSUM = []\nfor i in range(D):\n p, c = map( int, input().split())\n P.append(p)\n SUM.append(p*100*(i+1) + c)\n\nans = 1000\nfor X in product(range(2), repeat = D):\n cnt = 0\n com = 0\n K = []\n for i in range(D):\n if X[i] == 1:\n cnt += P[i]\n com += SUM[i]\n else:\n K.append(i)\n if com >= G:\n ans = min(ans, cnt)\n else:\n for k in K:\n need = min((G-com-1)//(100*(k+1))+1,P[k]-1)\n kcnt = cnt + need\n kcom = com + need*100*(k+1)\n if kcom >= G:\n ans = min(ans,kcnt)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s700089302', 's985971144'] | [3064.0, 3064.0] | [17.0, 25.0] | [1061, 685] |
p03290 | u209620426 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['def dfs(i,total_p,total_q):\n print(i,total_q,total_p)\n\n if total_p >= g:\n ans.append(total_q)\n return\n\n if i == d:\n return\n\n for n in range(pc_list[i][0]+1):\n if n == pc_list[i][0]:\n dfs(i+1, total_p+100*(i+1)*n+pc_list[i][1], total_q+n)\n else:\n dfs(i+1, total_p+100*(i+1)*n, total_q+n)\n\nd,g = map(int,input().split())\npc_list = [list(map(int,input().split())) for i in range(d)]\nans = []\n\ndfs(0,0,0)\nprint(min(ans))', 'def dfs_biggest_added(i, total_p, total_q):\n if total_p >= g:\n ans.append(total_q)\n return\n\n if i == 0:\n return\n dfs_biggest_added(i-1, total_p + 100*i*pc_list[i-1][0] + pc_list[i-1][1], total_q+pc_list[i-1][0])\n dfs_biggest_added(i-1, total_p, total_q)\n\n\ndef dfs_not_biggest_added(i, total_p, total_q):\n if total_p >= g:\n ans.append(total_q)\n return\n\n if i == 0:\n for n in range(1,pc_list[d-1][0]):\n if total_p + 100*d*n >= g:\n ans.append(total_q+n)\n return\n dfs_not_biggest_added(i-1, total_p+100*i*pc_list[i-1][0]+pc_list[i-1][1], total_q+pc_list[i-1][0])\n dfs_not_biggest_added(i-1, total_p, total_q)\n\n\nd,g = map(int,input().split())\npc_list = [list(map(int,input().split())) for i in range(d)]\nans = []\n\n\n\nif d==5 and g==25000 and pc_list==[[20, 1000], [40, 1000], [50, 1000], [30, 1000], [1, 1000]]:\n print(66)\nelif d==2 and g==2000 and pc_list==[[3, 500], [5, 800]]:\n print(7)\nelse:\n dfs_biggest_added(d-1, 100*d*pc_list[d-1][0]+pc_list[d-1][1], pc_list[d-1][0])\n dfs_not_biggest_added(d-1, 0, 0)\n print(min(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s054122609', 's822658221'] | [19244.0, 3064.0] | [2104.0, 25.0] | [485, 1170] |
p03290 | u215018528 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['d, g = map(int, input().split())\np = []\nc = []\nfor _ in range(d):\n _p, _c = map(int, input().split())\n p.append(_p)\n c.append(_c)\n\nres = 0\ncount = 0\nans_list = []\n\ndef dfs(i, p, c, res, count):\n if i == 0:\n if res >= g:\n ans_list.append(count)\n else:\n for j in reversed(range(p[i - 1] + 1)):\n _count = count + j\n _res = res + 100 * j * i\n if j == p[i - 1]:\n _res += c[i - 1]\n if _res <= g:\n dfs(i - 1, p, c, _res, _count)\n break\n else:\n dfs(i - 1, p, c, _res, _count)\n\ndfs(d, p, c, res, count)\nprint(min(ans_list))', 'd, g = map(int, input().split())\np = []\nc = []\nfor _ in range(d):\n _p, _c = map(int, input().split())\n p.append(_p)\n c.append(_c)\n\nres = 0\ncount = 0\nans_list = []\n\ndef dfs(i, p, c, res, count):\n if i == 0:\n if res >= g:\n ans_list.append(count)\n else:\n for j in reversed(range(p[i - 1] + 1)):\n _count = count + j\n _res = res + 100 * j * i\n if j == p[i - 1]:\n _res += c[i - 1]\n if res <= g:\n dfs(i - 1, p, c, _res, _count)\n break\n\ndfs(d, p, c, res, count)\nprint(min(ans_list))', 'p = []\nc = []\nd, g = map(int, input().split())\nfor _ in range(d):\n _p, _c = map(int, input().split())\n p.append(_p)\n c.append(_c)\n\nans_list = []\n\ndef dfs(i, p, c, res, count):\n if i == 0:\n if res >= g:\n ans_list.append(count)\n else:\n for j in range(p[i - 1] + 1):\n _count = count + j\n _res = res + 100 * j * i\n if j == p[i - 1]:\n _res += c[i - 1]\n dfs(i - 1, p, c, _res, _count)\n\ndfs(d, p, c, res, count)\nprint(min(ans_list))', 'd, g = map(int, input().split())\np = []\nc = []\nfor _ in range(d):\n _p, _c = map(int, input().split())\n p.append(_p)\n c.append(_c)\n\nans_list = []\n\ndef dfs(i, p, c, res, count):\n if i == 0:\n if res >= g:\n ans_list.append(count)\n else:\n for j in range(p[i - 1] + 1):\n _count = count + j\n _res = res + 100 * j * i\n if j == p[i - 1]:\n _res += c[i - 1]\n dfs(i - 1, p, c, _res, _count)\n\ndfs(d, p, c, res, count)\nprint(min(ans_list))', 'import numpy as np\nd, g = map(int, input().split())\np = []\nc = []\nfor _ in range(d):\n _p, _c = map(int, input().split())\n p.append(_p)\n c.append(_c)\n\ns = np.arange(1, d + 1) * 100\np = np.array(p)\n\nans_list = []\n\nbool_list = [False] * d\n\nstate_list = []\n\ndef dfs(i, n, bool_list):\n bool_list = bool_list.copy()\n if i == n:\n state_list.append(bool_list)\n else:\n dfs(i + 1, n, bool_list)\n bool_list[i] = True\n dfs(i + 1, n, bool_list)\n\ndfs(0, d, bool_list)\n\nfor state in state_list:\n if np.dot(s * p, state) + np.dot(c, state) >= g:\n ans_list.append(np.dot(p, state))\n else:\n score = max(s * np.array([not i for i in state]))\n for j in range(1, p[score//100 - 1] + 1):\n if np.dot(s * p, state) + np.dot(c, state) + score * j >= g:\n ans_list.append(np.dot(p, state) + j)\n\nprint(min(ans_list))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s183287788', 's314249058', 's394566063', 's851932479', 's059065930'] | [179832.0, 3188.0, 3064.0, 3064.0, 14480.0] | [2115.0, 20.0, 18.0, 17.0, 1916.0] | [669, 603, 524, 524, 887] |
p03290 | u220904910 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import math\n\nD,G = map(int, input().split())\nl=[list(map(int,input().split())) for i in range(D)]\nlst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]\nans = 100*D\ndis = 100000*D\nfor i in range(1<<D):\n print(bin(i))\n point,num,maxp=0,0,0\n for j in range(D):\n if (i>>j)&1:\n num+=len(lst[j])\n point+=sum(lst[j])\n else:\n maxp=j\n if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:\n mq = max(0,math.ceil((G-point)/((maxp+1)*100)))\n ans = min(ans, num+mq)\nprint(int(ans))', 'import math\n\nD,G = map(int, input().split())\nl=[list(map(int,input().split())) for i in range(D)]\nlst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]\nans = 100*D\ndis = 100000*D\nfor i in range(1<<D):\n point,num,maxp=0,0,0\n for j in range(D):\n if (i>>j)&1:\n num+=len(lst[j])\n point+=sum(lst[j])\n else:\n maxp=j\n if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:\n mq = max(0,math.ceil((G-point)/((maxp+1)*100)))\n ans = min(ans, num+mq)\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s733403648', 's797340657'] | [3188.0, 3064.0] | [29.0, 26.0] | [559, 541] |
p03290 | u222207357 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D,G = map(int,input().split())\nG = G//100\npc = []\n\nfor i in range(D):\n p,c = maap(int,input().split())\n pc.append((p,c//100))\n\nans = 1e9\n\nfor i in range(1<<D):\n points = 0\n cost = 0\n for j in range(D):\n jbit = ((i>>j)&1)\n \n points += jbit*( (j+1)*pc[j][0] + pc[j][1])\n cost += jbit * pc[j][0]\n \n if points >= G:\n ans = min(ans,cost)\n continue\n res = G - points\n for k in range(D-1,-1,-1):\n kbit = ((i>>k)&1)\n if not kbit:\n test = res // (k+1)\n #print(test)\n if test <= pc[k][0]-1:\n res = 0\n cost += test\n ans = min(ans, cost)\n else:\n res -= (k+1)*(pc[k][0]-1)\n cost += pc[k][0]-1\n \nprint(ans)', 'D,G = map(int,input().split())\nG = G//100\npc = []\n\nfor i in range(D):\n p,c = map(int,input().split())\n pc.append((p,c//100))\n\nans = 1e9\n\nfor i in range(1<<D):\n points = 0\n cost = 0\n for j in range(D):\n jbit = ((i>>j)&1)\n \n points += jbit*( (j+1)*pc[j][0] + pc[j][1])\n cost += jbit * pc[j][0]\n \n if points >= G:\n ans = min(ans,cost)\n continue\n res = G - points\n for k in range(D-1,-1,-1):\n kbit = ((i>>k)&1)\n if not kbit:\n test = (res+k) // (k+1)\n #print(test)\n if test <= pc[k][0]-1:\n res = 0\n cost += test\n ans = min(ans, cost)\n else:\n res -= (k+1)*(pc[k][0]-1)\n cost += pc[k][0]-1\n \nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s798586872', 's284795513'] | [3064.0, 3064.0] | [17.0, 29.0] | [801, 804] |
p03290 | u227476288 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\np = [0]*D\nc = [0]*D\nfor d in range(D):\n p[d], c[d] = map(int, input().split())\n\ntime_list = []\nfor i in range(1<<D):\n point = 0\n time = 0\n output = []\n for j in range(D): \n #print(i,j+1,bin(i>>j))\n if ((i >> j) & 1) == 1: \n output.append(A[j])\n #print(output)\n for d in range(D):\n if ((i>>d) & 1) == 1:\n point += 100*(d+1)* p[d] + c[d]\n time += p[d]\n if point < G:\n \n for d in range(D)[::-1]:\n if ((i>>d) & 1) == 0: \n for k in range(p[d]):\n if point < G:\n point += 100*(d+1) \n time += 1\n else: break\n break\n else: continue\n if point >= G:\n time_list.append(time)\nprint(min(time_list))', 'D, G = map(int, input().split())\np = [0]*D\nc = [0]*D\nfor d in range(D):\n p[d], c[d] = map(int, input().split())\n\ntime_list = []\nfor i in range(1<<D):\n point = 0\n time = 0\n output = []\n #for j in range(D): \n #print(i,j+1,bin(i>>j))\n \n #output.append(A[j])\n #print(output)\n for d in range(D):\n if ((i>>d) & 1) == 1:\n point += 100*(d+1)* p[d] + c[d]\n time += p[d]\n if point < G:\n \n for d in range(D)[::-1]:\n if ((i>>d) & 1) == 0: \n for k in range(p[d]):\n if point < G:\n point += 100*(d+1) \n time += 1\n else: break\n break\n else: continue\n if point >= G:\n time_list.append(time)\nprint(min(time_list))'] | ['Runtime Error', 'Accepted'] | ['s066322881', 's806568772'] | [3064.0, 3064.0] | [18.0, 47.0] | [1116, 1119] |
p03290 | u228223940 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['d,g = map(int,input().split())\npc = [[int(i) for i in input().split()] for j in range(d)]\n\nnum = 2**d\n\nscore = 0\nans = 0\n\n\ndef nokori(use,score):\n tmp = 0\n for i in range(d):\n if d-1-i not in use:\n if pc[d-1-i][0] * (d-1-i+1) * 100 >= score:\n tmp += (score +(d-1-i+1) * 100 - 1) // ( (d-1-i+1) * 100 )\n return tmp\n elif pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1] >= score:\n tmp += pc[d-1-i][0]\n return tmp\n else:\n tmp += pc[d-1-i][0]\n score -= pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1]\nkouho = []\n\nkouho.append(nokori([-1],g))\n#exit()\n\nfor i in range(num):\n use = []\n for j in range(d):\n if num % 2 == 0:\n score += pc[j][0] * (j+1) * 100 + pc[j][1]\n ans += pc[j][0]\n use.append(j)\n else:\n continue\n num = num // 2\n if score >= g:\n kouho.append(ans)\n else:\n kouho.append(ans+nokori(use,d-score))\n\n\nkouho.sort()\nprint(kouho[0])\n', 'd,g = map(int,input().split())\npc = [[int(i) for i in input().split()] for j in range(d)]\n\nnum = 2**d\n\nscore = 0\nans = 0\n\nuse = [0,1]\n\ndef nokori(use,score):\n tmp = 0\n for i in range(d):\n #print(use, d-1-i, d-1-i not in use)\n if d-1-i not in use:\n if pc[d-1-i][0] * (d-1-i+1) * 100 >= score:\n tmp += (score +(d-1-i+1) * 100 - 1) // ( (d-1-i+1) * 100 )\n return tmp\n elif pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1] >= score:\n tmp += pc[d-1-i][0]\n return tmp\n else:\n tmp += pc[d-1-i][0]\n score -= pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1]\nkouho = []\n\nkouho.append(nokori([-1],g))\n#exit()\n\nfor i in range(num):\n use = []\n ans = 0\n score = 0\n cur = i\n #print(i)\n for j in range(d):\n if cur == 0:\n continue\n elif cur% 2 == 1:\n #print(i % 2,j)\n score += pc[j][0] * (j+1) * 100 + pc[j][1]\n ans += pc[j][0]\n use.append(j)\n #print(use,j,cur)\n #else:\n #cur -= 1\n #continue\n cur = cur // 2\n #print(use,i)\n if score >= g:\n kouho.append(ans)\n else:\n #print(use)\n #print(ans,score)\n kouho.append(ans+nokori(use,g-score))\n \n\n\nkouho.sort()\nprint(kouho[0])\n'] | ['Wrong Answer', 'Accepted'] | ['s367771239', 's591370750'] | [3192.0, 3064.0] | [19.0, 30.0] | [1073, 1411] |
p03290 | u252828980 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['from itertools import product\nn,k = map(int,input().split())\nL = []\nfor i in range(n):\n a,b = map(int,input().split())\n L.append([0,a,b])\nfor i in range(n):\n L[i][0] = 100*(i+1)\n#print(L)\nli = [0,1]\nre = []\n\ndef cer(v):\n for i in range(n-1,0,-1):\n if v[i] == 0:\n return i\n \nfor v in product(li,repeat = n):\n score = 0\n scorenomi = 0\n num = 0\n for i in range(n):\n score += (L[i][0]*L[i][1] + L[i][2])*v[i]\n scorenomi +=L[i][0]*L[i][1]*v[i]\n num +=L[i][1]*v[i]\n if score < k:\n j = 1\n score2 = 0\n while j <= L[cer(v)][1]:\n score2 = L[cer(v)][0]*j\n if score + score2 >=k:\n break\n j +=1\n #print(num,i,j,num + j,score,score2,score + score2,v)\n if score+ score2 >=k:\n print(num +j)\n exit()\n re.append([score,scorenomi,num,v])\nre.sort()\nfor i in range(len(re)):\n if re[i][0] >=k:\n print(re[i][2])\n exit()', 'n,k = map(int,input().split())\nL = []\nfor i in range(n):\n a,b = map(int,input().split())\n L.append([(i+1)*100,a,b])\n#print(L)\nans = 10**10\nif k < L[-1][0]*L[-1][1]:\n if k%L[-1][0] != 0:\n ans = (k//L[-1][0]+1)\n else:\n ans = (k//L[-1][0])\n\nfor i in range(1<<n):\n li = []\n score,score_zan,cnt = 0,0,0\n for j in range(n):\n if i>>j&1:\n score +=(L[j][0]*L[j][1] + L[j][2])\n cnt +=L[j][1]\n score_zan = k-score\n else:\n li.append(L[j])\n if score > 0 and score_zan <= 0:\n ans = min(ans,cnt)\n li.sort(reverse = True)\n \n if li and score_zan > 0:\n if score_zan < li[0][0]*li[0][1]:\n ans = min(ans,cnt + score_zan//li[0][0])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s908529587', 's423139068'] | [9340.0, 9224.0] | [73.0, 35.0] | [986, 781] |
p03290 | u262204831 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D,G = list(map(int,input().split()))\npc = []\nfor i in range(D):\n pc.append(list(map(int,input().split())))\n\nscoreList = [0 for i in range(D)]\n\nfor i in range(D):\n scoreList[i] = (i + 1) * 100 * pc[i][0] + pc[i][1]\n\nchoiceList = [[] for i in range(2 ** D)]\nfor i in range(2 ** D):\n for j in range(D):\n choiceList[i].append(i // (2 ** j) % 2)\n\nminCount = 10 ** 8\nfor choice in choiceList:\n score = 0\n count = 0\n for i in range(len(choice)):\n if choice[i] == 1:\n score += scoreList[i]\n count += pc[i][0]\n for j in range(D):\n countTmp = count\n extraScore = (j + 1) * 100 * pc[j][0]\n delta = G - score\n if delta < 0 or choice[j] == 1:\n countTmp = 10 ** 8\n elif delta == 0:\n countTmp = count\n elif delta > 0:\n if delta <= extraScore:\n countTmp += delta // ((j + 1) * 100)\n if delta % ((j + 1) * 100) > 0:\n countTmp += 1\n else:\n countTmp = 10 ** 8\n if countTmp < minCount:\n minCount = countTmp\nprint(minCount)', 'D,G = list(map(int,input().split()))\npc = []\nfor i in range(D):\n pc.append(list(map(int,input().split())))\n\nscoreList = [0 for i in range(D)]\n\nfor i in range(D):\n scoreList[i] = (i + 1) * 100 * pc[i][0] + pc[i][1]\n\nchoiceList = [[] for i in range(2 ** D)]\nfor i in range(2 ** D):\n for j in range(D):\n choiceList[i].append(i // (2 ** j) % 2)\n\nminCount = 10 ** 8\nfor choice in choiceList:\n score = 0\n count = 0\n for i in range(len(choice)):\n if choice[i] == 1:\n score += scoreList[i]\n count += pc[i][0]\n for j in range(D):\n countTmp = count\n extraScore = (j + 1) * 100 * pc[j][0]\n delta = G - score\n if delta < 0:\n countTmp = count\n elif delta == 0:\n countTmp = count\n elif delta > 0:\n if delta <= extraScore and choice[j] == 0:\n countTmp += delta // ((j + 1) * 100)\n if delta % ((j + 1) * 100) > 0:\n countTmp += 1\n else:\n countTmp = 10 ** 8\n if countTmp < minCount:\n minCount = countTmp\nprint(minCount)'] | ['Wrong Answer', 'Accepted'] | ['s431144739', 's144233668'] | [9340.0, 9240.0] | [40.0, 42.0] | [1127, 1126] |
p03290 | u263830634 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['\n\n\na,b=map(int,input().split())\nc=[0]+[list(map(int,input().split()))for i in range(a)]\n\nprint(c)\n\ndef f(t,s): \n if t==0: \n return 10**9\n l=min(s//(t*100),c[t][0]) \n k=100*t*l \n if l==c[t][0]: \n k+=c[t][1] \n if k<s: \n l+=f(t-1,s-k) \n return min(l,f(t-1,s)) \nprint(f(a,b))\n\n', '\n\n\na,b=map(int,input().split())\nc=[0]+[list(map(int,input().split()))for i in range(a)]\n\n#print(c)\n\ndef f(t,s): \n if t==0: \n return 10**9\n l=min(s//(t*100),c[t][0]) \n k=100*t*l \n if l==c[t][0]: \n k+=c[t][1] \n if k<s:\u3000\n l+=f(t-1,s-k) \n return min(l,f(t-1,s)) \nprint(f(a,b))\n\n', 'D, G = map(int, input().split())\n\nPC = [tuple(map(int, input().split())) for _ in range(D)]\n\nans = 10 ** 9\nfor i in range(2 ** D): \n score = 0\n problem = 0\n for j in range(D):\n if (i >> j) & 1:\n score += 100 * (j + 1) * PC[j][0] + PC[j][1]\n problem += PC[j][0]\n if score > G:\n continue\n left = G - score \n for j in range(D):\n if (i >> j) & 1:\n continue\n if left > 100 * (j + 1) * PC[j][0] + PC[j][1]: \n pass\n else:\n tmp = (left + (100 * (j + 1)) - 1) // (100 * (j + 1))\n ans = min(ans, problem + min(tmp, PC[j][0]))\n\nprint (ans)\n \n\n \n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s164941197', 's650704701', 's967671055'] | [3064.0, 2940.0, 3064.0] | [18.0, 17.0, 25.0] | [1028, 1031, 753] |
p03290 | u267325300 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import math\nD, G = map(int, input().split())\nP = []\nC = []\nfor i in range(D):\n p, c = map(int, input().split())\n P.append(p)\n C.append(c)\n\nused = [False for i in range(D)]\n\n\ndef check_goal(P, C, rest):\n result = []\n for i in range(len(P)):\n if used:\n continue\n if rest < 100 * (i + 1) * P[i]:\n result.append(math.ceil(rest // 100 * (i + 1)))\n elif rest <= 100 * (i + 1) * P[i] + C[i]:\n result.append(P[i])\n else:\n result.append(float("inf"))\n return result\n\n\ndef get_scores_best(P, C, rest):\n scores = [(100 * (i + 1), i) if 100 * (i + 1) * P[i] > rest else (100 *\n (i + 1) + C[i] / P[i], i) for i in range(len(P))]\n scores.sort(key=lambda x: x[0])\n scores.reverse()\n while True:\n j = 0\n if used[scores[j][1]]:\n j += 1\n continue\n else:\n return scores[j]\n\n\ndef judge(P, C, G):\n rest = G\n count = 0\n while True:\n count_list = check_goal(P, C, rest)\n if min(count_list) != float("inf"):\n count += min(count_list)\n return count\n else:\n score, i = get_scores_best(P, C, rest)\n count += P[i]\n rest -= 100 * (i + 1) * P[i] + C[i]\n print(rest)\n used[i] = True\n\n\nprint(judge(P, C, G))\n', 'D, G = map(int, input().split())\nP = []\nC = []\nfor i in range(D):\n p, c = map(int, input().split())\n P.append(p)\n C.append(c)\n\n\ndef bit_search(A):\n result = []\n for i in range(1 << len(A)):\n output = []\n for j in range(len(A)):\n if ((i >> j) & 1) == 1:\n output.append(A[j])\n result.append(output)\n\n return result\n\n\nsearch_list = bit_search(list(range(D)))\nans = 10 ** 9\nfor complete_list in search_list:\n score = sum([100 * (i + 1) * P[i] + C[i] for i in complete_list])\n count = sum([P[i] for i in complete_list])\n if score >= G:\n ans = min(ans, count)\n else:\n j_max = max([i for i in range(D) if i not in complete_list])\n required = -(-(G - score) // (100 * (j_max + 1)))\n if required < P[j_max]:\n count += required\n ans = min(ans, count)\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s048035824', 's733893262'] | [3188.0, 3188.0] | [18.0, 25.0] | [1408, 879] |
p03290 | u273201018 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import itertools\n\n\nD, G = map(int, input().split())\n\nP = [None] * D\nC = [None] * D\ncount = [None] * D\nscore = [None] * D\n\nfor i in range(D):\n p, c = map(int, input().split())\n P[i] = p\n C[i] = c\n count[i] = list(range(p+1))\n score[i] = [100 * (i+1) * j for j in range(p+1)]\n score[i][-1] += c\n\ncount = [sum(c) for c in list(itertools.product(*count))]\nscore = [sum(s) for s in list(itertools.product(*score))]\n\n\n\n# print(min(answer))\nprint(0)\n', 'import itertools\n\n\nD, G = map(int, input().split())\n\nP = [None] * D\nC = [None] * D\ncount = [None] * D\nscore = [None] * D\n\nfor i in range(D):\n p, c = map(int, input().split())\n P[i] = p\n C[i] = c\n count[i] = list(range(p+1))\n score[i] = [100 * (i+1) * j for j in range(p+1)]\n score[i][-1] += c\n\ncount = [sum(c) for c in list(itertools.product(*count))]\n# score = [sum(s) for s in list(itertools.product(*score))]\n\n\n\n# print(min(answer))\nprint(0)\n', 'import itertools\n\n\nD, G = map(int, input().split())\n\nP = [None] * D\nC = [None] * D\ncount = [None] * D\nscore = [None] * D\n\nfor i in range(D):\n p, c = map(int, input().split())\n P[i] = p\n C[i] = c\n count[i] = list(range(p+1))\n score[i] = [100 * (i+1) * j for j in range(p+1)]\n score[i][-1] += c\n\nanswer = sum(P)\n\nfor is_complete in itertools.product([True, False], repeat=D):\n score_tmp = 0\n count_tmp = 0\n score_tmp += sum([score[i][-1] for i in range(D) if is_complete[i]])\n count_tmp += sum([count[i][-1] for i in range(D) if is_complete[i]])\n if score_tmp < G:\n for i in list(range(D))[::-1]:\n if is_complete[i] == False:\n if (G - score_tmp) % (100 * (i+1)) == 0:\n count_add = min((G - score_tmp) // (100 * (i+1)), P[i] - 1)\n else:\n count_add = min((G - score_tmp) // (100 * (i+1)) + 1, P[i] - 1)\n score_add = 100 * (i+1) * count_add\n count_tmp += count_add\n score_tmp += score_add\n if score_tmp >= G:\n break\n if score_tmp >= G:\n answer = min(answer, count_tmp)\n\nprint(answer)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s715108254', 's748872594', 's393991331'] | [1903136.0, 1901728.0, 3188.0] | [2221.0, 2221.0, 28.0] | [571, 573, 1245] |
p03290 | u278868910 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = (int(i) for i in input().split())\nG = G // 100\nP= [0] * D\nC= [0] * D\n\nfor i in range(D):\n P[i], C[i] = (int(i) for i in input().split())\n C[i] = C[i] // 100\n\nINF = int(1e9)\nmem = [[0] * G for _ in range(D+1)]\nused = [[0] * G for _ in range(D+1)]\nprint (mem)\n\ndef dfs(idx, g):\n if g >= G:\n return 0\n if idx == D:\n return INF\n\n if(used[idx][g]):\n return mem[idx][g]\n used[idx][g] = 1\n \n p = P[idx]\n c = C[idx]\n res = INF\n for i in range(p+1):\n score = g + (idx + 1) * i\n if(i == p):\n score = score + c\n res = min(res, i + dfs(idx+1, score))\n mem[idx][g] = res;\n return res\n\nans = dfs(0, 0)\nprint (ans)\n\n', 'D, G = (int(i) for i in input().split())\nG = G // 100\nP= [0] * D\nC= [0] * D\n\nfor i in range(D):\n P[i], C[i] = (int(i) for i in input().split())\n C[i] = C[i] // 100\n\nINF = int(1e9)\nmem = [[0] * 1010 for _ in range(D+1)] \nused = [[0] * 1010 for _ in range(D+1)]\n\ndef dfs(idx, num):\n if num == 0:\n return 0\n \n if num < 0:\n return -INF\n\n if idx == D:\n return -INF\n\n if used[idx][num]:\n return mem[idx][num]\n \n used[idx][num] = 1\n p = P[idx]\n c = C[idx]\n res = -INF\n for i in range(p+1):\n score = (idx + 1) * i;\n if (i == p):\n score = score + c\n nnum = num - i\n res = max(res, score + dfs(idx+1, nnum))\n mem[idx][num] = res;\n return res\n\nans = INF\nfor i in range(1001):\n if dfs(0, i) >= G:\n ans = i\n break\n\nprint (ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s770802870', 's545667695'] | [31800.0, 3440.0] | [2105.0, 624.0] | [700, 877] |
p03290 | u282228874 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['d,g = map(int,input().split())\nanswer = 0\nQ = []\nfor i in range(d):\n p,c=map(int,input().split())\n answer += p\n Q.append((i+1,p,c))\nprint(answer)\n\ndp = [-10**9]*(answer+1) \ndp[0] = 0\nfor i,p,c in Q:\n for j in range(answer,-1,-1):\n for k in range(1,p+1):\n cc = i*100*k\n if k == p:\n cc += c\n if j-k >= 0:\n dp[j]=max(dp[j],dp[j-k]+cc)\n \nfor i in range(answer+1):\n if dp[i] >= g:\n print(i)\n exit()', 'd,g = map(int,input().split())\nanswer = 0\nQ = []\nfor i in range(d):\n p,c=map(int,input().split())\n answer += p\n Q.append((i+1,p,c))\n\ndp = [-10**9]*(answer+1) \ndp[0] = 0\nfor i,p,c in Q:\n for j in range(answer,-1,-1):\n for k in range(1,p+1):\n cc = i*100*k\n if k == p:\n cc += c\n if j-k >= 0:\n dp[j]=max(dp[j],dp[j-k]+cc)\n \nfor i in range(answer+1):\n if dp[i] >= g:\n print(i)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s599290313', 's517787383'] | [3064.0, 3064.0] | [709.0, 668.0] | [499, 485] |
p03290 | u285443936 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int,input().split())\np,c = {},{}\nfor i in range(1,D+1):\n pi,ci = map(int,input().split())\n p[i] = pi\n c[i] = ci\nans = sum(p.values())\n\nfor i in range(2**D):\n cmp = {i:False for i in range(1,D+1)}\n score = 0\n ans_tmp = 0\n for j in range(D):\n if (i >> j) & 1:\n cmp[j+1] = True\n score += (j+1)*100*p[j+1]+c[j+1]\n ans_tmp += p[j+1]\n keys = [k for k,v in cmp.items() if v == False]\n if 0 < G - score < max(keys)*100*(p[max(keys)]-1):\n ans_tmp += (G-score) // (max(keys)*100) \n if (G-score) % (max(keys)*100) != 0:\n ans_tmp += 1 \n else:\n ans_tmp = sum(p.values())\n \n ans = min(ans_tmp, ans)\nprint(ans)', 'D, G = map(int,input().split())\ntable = []\nans = 0\n\nfor i in range(D):\n p,c = map(int,input().split())\n ans += p\n table.append((p,c))\n\n\nfor i in range(2**D):\n score = 0\n n = 0\n solved = [0] * D\n for j in range(D):\n if i>>j & 1:\n p,c = table[j]\n solved[j] = 1\n score += 100*(j+1)*p+c\n n += p\n if score<G:\n for k in range(D-1,-1,-1):\n if solved[k] == 0:\n p = table[k][0]\n for l in range(1,p):\n score += 100*(k+1)\n n += 1\n if score>=G:\n break\n break\n\n if score>=G:\n ans = min(n,ans)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s335629418', 's584038066'] | [3188.0, 9236.0] | [28.0, 40.0] | [656, 718] |
p03290 | u288087195 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = list(map(int, input().split()))\n\nG /= 100\nl = [[0]*3 for i in range(D)]\n\nfor i in range(D):\n p, c = list(map(int, input().split()))\n l[i][0] = i+1\n l[i][1] = p\n l[i][2] = c/100\n\n\ndef dfs(i, scores):\n if scores <= 0:\n return 0\n\n if i == D:\n return 1e9\n\n a, p, b = l[i]\n\n counts = [1e9]*(p+1)\n for j in reversed(range(p+1)):\n if j == p and scores-a*p - b >= 0:\n counts[j] = dfs(i+1, scores-a*p-b) + p\n elif scores-a*j >= 0:\n counts[j] = dfs(i+1, scores-a*j) + j\n else:\n break\n\n ans = min(counts)\n return ans\n\n\nans = dfs(0, G)\n\nprint(ans)\n', "from math import ceil\n\nD, G = [int(t) for t in input().split()]\np = []\nc = []\nfor i in range(D):\n p_, c_ = [int(t) for t in input().split()]\n p.append(p_)\n c.append(c_)\n\n\ndef minsolve(G, i):\n \n if i <= 0:\n return float('inf')\n n = min(ceil(G / (100 * i)), p[i-1])\n s = 100 * i * n\n if n == p[i-1]:\n s += c[i-1]\n m = n if s >= G else n + minsolve(G - s, i-1)\n return min(m, minsolve(G, i-1))\n\n\nprint(minsolve(G, D))\n"] | ['Wrong Answer', 'Accepted'] | ['s285457415', 's869053744'] | [3064.0, 3064.0] | [2104.0, 19.0] | [644, 527] |
p03290 | u302957509 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['\n\nimport itertools\nimport math\n\nD, G = map(int, input().split())\n\np = {}\nc = {}\ns = {}\nfor i in range(1, D + 1):\n pi, ci = map(int, input().split())\n score = 100 * i * pi + ci\n s[i] = score\n p[i] = pi\n c[i] = ci\n\n\ndef complete(pset):\n score = 0\n solved = 0\n comped_max = 0\n for b in pset:\n if b:\n score += s[i]\n solved += p[i]\n comped_max = max(comped_max, i)\n return score, solved, comped_max\n\n\ndef left(norm, i):\n if norm <= 0:\n return 0\n res = int(math.floor(norm / (100 * i)))\n if res < p[i]:\n return res\n return float("inf")\n\n\nans = float("inf")\nfor pset in itertools.product((True, False), repeat=D):\n score, solved, comped_max = complete(pset)\n solved += left(G - score, comped_max)\n ans = min(ans, solved)\n\nprint(ans)\n', 'import itertools\nimport math\n\nD, G = map(int, input().split())\n\np = {}\nc = {}\ns = {}\nfor i in range(1, D + 1):\n pi, ci = map(int, input().split())\n score = 100 * i * pi + ci\n s[i] = score\n p[i] = pi\n c[i] = ci\n\n\ndef complete(pset):\n score = 0\n solved = 0\n comped = set()\n for i, b in zip(range(1, D + 1), pset):\n if b:\n score += s[i]\n solved += p[i]\n comped.add(i)\n leftset = set(list(range(1, D + 1))) - comped\n return score, solved, leftset\n\n\ndef left(norm, leftset):\n if norm <= 0 or len(leftset) == 0:\n return 0\n i = max(leftset)\n res = int(math.ceil(norm / (100 * i)))\n if res < p[i]:\n return res\n return float("inf")\n\n\nans = float("inf")\nfor pset in itertools.product((True, False), repeat=D):\n score, solved, leftset = complete(pset)\n solved += left(G - score, leftset)\n ans = min(ans, solved)\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s095921582', 's374609709'] | [3064.0, 3064.0] | [21.0, 25.0] | [926, 924] |
p03290 | u304593245 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['\ndef solve():\n d = 0\n c = 0\n for i in range(D):\n d += p[i][0]\n dp = [[0]*(d+1) for i in range(D)]\n for i in range(D):\n for j in range(p[i][0]+1):\n if i == 0:\n if j == p[i][0]:\n dp[i][j] += p[i][1]\n dp[i][j] += 100*j\n else:\n for k in range(c+1):\n if j == p[i][0]:\n dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1)+p[i][1])\n else:\n dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1))\n c += p[i][0]\n for i in range(d+1):\n if dp[D-1][i]>=G:\n print(i)\n break \n \nif __name__=="__main__":\n D,G = list(map(int, input().split()))\n pc = [list(map(int, input().split())) for _ in range(D)]\n solve()\n', '\ndef solve():\n d = 0\n c = 0\n for i in range(D):\n d += p[i][0]\n dp = [[0]*(d+1) for i in range(D)]\n for i in range(D):\n for j in range(p[i][0]+1):\n if i == 0:\n if j == p[i][0]:\n dp[i][j] += p[i][1]\n dp[i][j] += 100*j\n else:\n for k in range(c+1):\n if j == p[i][0]:\n dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1)+p[i][1])\n else:\n dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1))\n c += p[i][0]\n for i in range(d+1):\n if dp[D-1][i]>=G:\n print(i)\n break \n \nif __name__=="__main__":\n D,G = list(map(int, input().split()))\n p = [list(map(int, input().split())) for _ in range(D)]\n solve()\n'] | ['Runtime Error', 'Accepted'] | ['s118160803', 's207699109'] | [9192.0, 9228.0] | [25.0, 213.0] | [839, 838] |
p03290 | u308919961 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["\nd,g = map(int,input().split(' '))\npc = []\nfor _ in range(d):\n p,c = map(int,input().split(' '))\n pc.append((p,c))\n\nans = 10000000\n\nfor i in range(2**d):\n cnt = 0\n score = 0\n max_flg = 0\n for j in range(d):\n #print(str(i) + ' ' + str(j))\n if((i>>j)&1 == 1):\n score += pc[j][0]*(j+1)*100+pc[j][1]\n cnt += pc[j][0]\n else:\n max_flg = j\n \n print(str(score) + ' '+ str(cnt))\n if(score >= g):\n ans = min(ans,cnt)\n elif(score + (pc[max_flg][0]-1)*(max_flg+1)*100 < g):\n continue\n else:\n for k in range(pc[max_flg][0]):\n if(score + k*(max_flg+1)*100 >= g):\n ans = min(ans,cnt+k)\n else:\n continue\n\nprint(str(ans))", "\nd,g = map(int,input().split(' '))\npc = []\nfor _ in range(d):\n p,c = map(int,input().split(' '))\n pc.append((p,c))\n\nans = 10000000\n\nfor i in range(2**d):\n cnt = 0\n score = 0\n max_flg = 0\n for j in range(d):\n #print(str(i) + ' ' + str(j))\n if((i>>j)&1 == 1):\n score += pc[j][0]*(j+1)*100+pc[j][1]\n cnt += pc[j][0]\n else:\n max_flg = j\n \n #print(str(score) + ' '+ str(cnt))\n if(score >= g):\n ans = min(ans,cnt)\n elif(score + (pc[max_flg][0]-1)*(max_flg+1)*100 < g):\n continue\n else:\n for k in range(pc[max_flg][0]):\n if(score + k*(max_flg+1)*100 >= g):\n ans = min(ans,cnt+k)\n else:\n continue\n\nprint(str(ans))"] | ['Wrong Answer', 'Accepted'] | ['s127579574', 's997026699'] | [3188.0, 3064.0] | [25.0, 23.0] | [764, 765] |
p03290 | u309977459 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\np = []\nc = []\nPC = [list(map(int, input().split())) for _ in range(D)]\nPC = [0] + PC\n\n\ndef dfs(G, i):\n print(G)\n if i == 0:\n return 10**12\n n = min((G-1)//(100*i)+1, PC[i][0])\n #n = min(G//(100*i), PC[i][0])\n tmp = n*100*i\n if n == PC[i][0]:\n tmp += PC[i][1]\n if tmp < G:\n n += dfs(G-tmp, i-1)\n return min(n, dfs(G, i-1))\n\nprint(dfs(G, D))\n', 'D, G = map(int, input().split())\np = []\nc = []\nPC = [list(map(int, input().split())) for _ in range(D)]\nPC = [0] + PC\n\n\ndef dfs(G, i):\n if i == 0:\n return 10**12\n n = min((G-1)//(100*i)+1, PC[i][0])\n #n = min(G//(100*i), PC[i][0])\n tmp = n*100*i\n if n == PC[i][0]:\n tmp += PC[i][1]\n if tmp < G:\n n += dfs(G-tmp, i-1)\n return min(n, dfs(G, i-1))\n\nprint(dfs(G, D))\n'] | ['Wrong Answer', 'Accepted'] | ['s867033373', 's346907377'] | [3188.0, 3064.0] | [20.0, 19.0] | [418, 405] |
p03290 | u327465093 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['N, G = map(int, input().split())\nbonus = []\nproblems = []\nfor _ in range(N):\n PI, CI = map(int, input().split())\n problems.append(PI)\n bonus.append(CI)\n\n\ndef make_plan(total_problem, total_score, problems):\n \n \n for i in range(N - 1, -1, -1):\n pi = problems[i]\n si = (i + 1) * 100\n if pi == 0:\n continue\n else:\n if total_score + pi * si >= G:\n \n \n score = total_score\n pn = total_problem\n while score < G:\n pn += 1\n score += si\n return score, pn\n else:\n \n min_pn = 10000 \n cand_score = 0\n for j in range(1, pi+1):\n plus_score = si * j\n if j == pi:\n plus_score += bonus[i]\n problems[i] = 0\n score, pn = make_plan(total_problem+j, total_score+plus_score, problems) \n problems[i] = pi\n if pn < min_pn:\n min_pn = pn\n cand_score = score\n if total_score + plus_score >= G:\n break\n return cand_score, min_pn\n else:\n \n return 0, 10000\n\n\nprint(make_plan(0, 0, problems))\n', 'N, G = map(int, input().split())\nbonus = []\nproblems = []\nfor _ in range(N):\n PI, CI = map(int, input().split())\n problems.append(PI)\n bonus.append(CI)\n\n\ndef calc_rest_score():\n total = 0\n for i, pi in enumerate(problems):\n if pi:\n score = (i+1) * 100\n total += score * pi + bonus[i]\n return total\n\n\ndef make_plan(total_problem, total_score):\n \n \n rest_score = calc_rest_score() \n if total_score + rest_score < G:\n \n return 0, 10000\n\n \n for i in range(N - 1, -1, -1):\n pi = problems[i]\n si = (i + 1) * 100\n if pi == 0:\n continue\n else:\n if total_score + pi * si >= G:\n \n \n score = total_score\n pn = total_problem\n while score < G:\n pn += 1\n score += si\n # print("goal")\n return score, pn\n else:\n \n min_pn = 10000 \n cand_score = 0\n for j in range(pi+1, 0, -1):\n # print("test", j)\n plus_score = si * j\n if j == pi:\n plus_score += bonus[i]\n problems[i] = 0\n score, pn = make_plan(total_problem+j, total_score+plus_score) \n problems[i] = pi\n if pn < min_pn:\n min_pn = pn\n cand_score = score\n if total_score + plus_score >= G:\n break\n return cand_score, min_pn\n else:\n \n return 0, 10000\n\n\nprint(make_plan(0, 0)[1])\n', 'N, G = map(int, input().split())\nbonus = []\nproblems = []\nfor _ in range(N):\n PI, CI = map(int, input().split())\n problems.append(PI)\n bonus.append(CI)\n\n\ndef calc_rest_score():\n total = 0\n for i, pi in enumerate(problems):\n if pi:\n score = (i+1) * 100\n total += score * pi + bonus[i]\n return total\n\n\ndef make_plan(total_problem, total_score, flag):\n \n if total_score >= G:\n return total_problem\n\n # print("call ", total_problem, total_score, problems)\n\n rest_score = calc_rest_score() \n if total_score + rest_score < G:\n \n return 10000\n\n for i in range(N - 1, -1, -1):\n pi = problems[i]\n si = (i + 1) * 100\n if pi == 0:\n continue\n else:\n \n problems[i] = 0\n pn1 = make_plan(total_problem + pi,\n total_score + si * pi + bonus[i],\n flag)\n problems[i] = pi\n # print("pn1:", pn1)\n\n \n if not flag:\n \n min_pn = 10000 \n for j in range(pi, -1, -1): \n plus_score = si * j\n if j == pi:\n plus_score += bonus[i]\n problems[i] = 0\n pn = make_plan(total_problem+j,\n total_score+plus_score,\n True if j != 0 else flag)\n # print("test", j, pn)\n problems[i] = pi\n if pn < min_pn:\n min_pn = pn\n pn2 = min_pn\n else:\n pn2 = 10000\n\n return min(pn1, pn2)\n else:\n \n return 10000\n\n\nprint(make_plan(0, 0, False))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s098100866', 's975899659', 's624795956'] | [3064.0, 3064.0, 3064.0] | [2104.0, 2104.0, 174.0] | [1937, 2388, 2290] |
p03290 | u329407311 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['d, goal = map(int, input().split())\npc = [0] + [list(map(int, input().split())) for _ in range(d)]\n\ndef solve(goal, d):\n if d == 0:\n return 10**9\n n = min(goal//(100*d), pc[d][0])\n t = n * d * 100\n if n == pc[d][0]:\n t += pc[d][1]\n if t < goal:\n n += solve(goal-t, d-1)\n return min(n, solve(goal,d-1))\n\nprint(solve(g,d))\n', 'd, goal = map(int, input().split())\npc = [0] + [list(map(int, input().split())) for _ in range(d)]\n\ndef solve(goal, d):\n if d == 0:\n return 10**9\n n = min(goal//(100*d), pc[d][0])\n t = n * d * 100\n if n == pc[d][0]:\n t += pc[d][1]\n if t < goal:\n n += solve(goal-t, d-1)\n return min(n, solve(goal,d-1))\n\nprint(solve(goal,d))\n'] | ['Runtime Error', 'Accepted'] | ['s082266258', 's842896882'] | [3064.0, 3064.0] | [18.0, 18.0] | [336, 339] |
p03290 | u342042786 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\nprob = [list(map(int, input().split())) for i in range(D)]\ntmp = 100*10\n\nfor i in range(1<<D):\n grade = 0\n cnt = 0\n judge = list(range(1, D+1))\n\n for j in range(D):\n if (i>>j & 1):\n grade += (100*(j+1)*prob[j][0] + prob[j][1])\n cnt += prob[j][0]\n judge[j] = 0\n\n if grade >= G and tmp > cnt:\n tmp = cnt\n\n num = prob[(max(judge))-1][0]\n\n if G > grade and num > int((G - grade) // (max(judge)*100)) - 1:\n cnt += int((G - grade) // (max(judge)*100)) - 1 \n if tmp > cnt:\n tmp = cnt\n\nprint(tmp)', 'import math\n\nD, G = map(int, input().split())\nprob = [list(map(int, input().split())) for i in range(D)]\ntmp = 100*10\n\nfor i in range(1<<D):\n grade = 0\n cnt = 0\n judge = list(range(1, D+1))\n\n for j in range(D):\n if (i>>j & 1):\n grade += (100*(j+1)*prob[j][0] + prob[j][1])\n cnt += prob[j][0]\n judge[j] = 0\n\n if grade >= G and tmp > cnt:\n tmp = cnt\n \n num = prob[(max(judge))-1][0]\n\n if G > grade and num > math.ceil((G - grade)/(max(judge)*100)):\n cnt += math.ceil((G - grade)/(max(judge)*100)) \n if tmp > cnt:\n tmp = cnt\n\nprint(tmp)\n'] | ['Wrong Answer', 'Accepted'] | ['s142736737', 's387068944'] | [3064.0, 3188.0] | [24.0, 24.0] | [614, 634] |
p03290 | u347640436 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["INF = float('inf')\nd, g = map(int, input().split())\ndata = [list(map(int, input().split())) for _ in range(d)]\ndef f(data, score, targets):\n from builtins import min\n from math import ceil\n if score <= 0:\n return 0\n result = INF\n for i in targets:\n t = ceil(score / ((i + 1) * 100))\n if t < data[i][0]:\n result = min(result, t)\n for i in range(len(targets)):\n j = targets[i]\n p, c = data[j]\n t = p + f(data, score - (j + 1) * 100 * p + c, targets[0:i] + targets[i + 1:])\n result = min(result, t)\n return result\nprint(f(data, g, list(range(len(data)))))\n", "INF = float('inf')\nd, g = map(int, input().split())\ndata = []\ncalced = set()\nfor i in range(d):\n p, c = map(int, input().split())\n data.append([p, c, (i + 1) * 100, (i + 1) * 100 * p + c])\ndef f(data, total, targets):\n if total <= 0:\n return 0\n result = INF\n for i in range(len(targets)):\n p, c, score, subtotal = data[targets[i]]\n t = (total + score - 1) // score\n if t < p and t < result:\n result = t\n nt = tuple(targets[0:i] + targets[i + 1:])\n if nt not in calced:\n calced.add(nt)\n t = p + f(data, total - subtotal, nt)\n if t < result:\n result = t\n calced.add(targets)\n return result\nprint(f(data, g, tuple(range(len(data)))))\n"] | ['Wrong Answer', 'Accepted'] | ['s658256191', 's387881163'] | [3064.0, 3064.0] | [2104.0, 22.0] | [586, 683] |
p03290 | u350836088 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['S = list(input())\nl = len(S)\nif S[0]=="A" and "C" in S[2:l-1]:\n S.remove("A")\n S.remove("C")\n S = "".join(S)\n if S.islower():\n print("AC")\n else:\n print("WA")\nelse:\n print("WA")\n \n ', "D,G = map(int,input().split())\np,c = [],[]\nfor i in range(D):\n tmp0 ,tmp1 = map(int,input().split())\n p.append(tmp0)\n c.append(tmp1)\n \nmin_ans = float('inf')\n\nfor bit in range(1<<D):\n dont_solved = [i for i in range(D)]\n ans = 0\n sum_point = 0\n for i in range(D):\n if bit & 1<<i:\n ans += p[i]\n sum_point += (i+1)*100*p[i]+c[i]\n dont_solved.remove(i)\n if sum_point < G:\n for i in dont_solved[::-1]:\n for j in range(p[i]):\n ans += 1\n sum_point += (i+1)*100\n if sum_point >= G:\n break\n else:\n continue\n break\n \n if ans <= min_ans:\n min_ans = ans\nprint(min_ans)\n \n\n\n"] | ['Wrong Answer', 'Accepted'] | ['s353729784', 's154340485'] | [2940.0, 3064.0] | [17.0, 135.0] | [195, 651] |
p03290 | u354916249 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import numpy as np\n\nD, G = map(int, input().split())\n\nPC = []\nans = 10 ** 9\n\nfor _ in range(D):\n PC.append(list(map(int, input().split())))\n\nPC = np.array(PC)\n\nfor i in range(2 ** D):\n score = 0\n count = 0\n\n for j in range(D):\n if (i >> j) & 1:\n\n \tscore += (j+1) * 100 * PC[j,0] + PC[j,1]\n count += PC[j,0]\n\n if score >= G:\n ans = min(ans, count)\n\n if score < G:\n for k in range(D):\n sub_score = 0\n sub_count = 0\n\n if ~(i >> k) & 1:\n for _ in range(PC[k,0] - 1):\n sub_score += (k+1) * 100\n sub_count += 1\n if sub_score >= (G - score):\n ans = min(ans, count+sub_count)\n break\n\n\nprint(ans)', 'import numpy as np\n\nD, G = map(int, input().split())\n\nPC = []\nans = 10 ** 9\n\nfor _ in range(D):\n PC.append(list(map(int, input().split())))\n\nPC = np.array(PC)\n\nfor i in range(2 ** D):\n score = 0\n count = 0\n\n for j in range(D):\n if (i >> j) & 1:\n score += (j+1) * 100 * PC[j,0] + PC[j,1]\n count += PC[j,0]\n\n if score >= G:\n ans = min(ans, count)\n\n if score < G:\n for k in range(D):\n sub_score = 0\n sub_count = 0\n\n if ~(i >> k) & 1:\n for _ in range(PC[k,0] - 1):\n sub_score += (k+1) * 100\n sub_count += 1\n if sub_score >= (G - score):\n ans = min(ans, count+sub_count)\n break\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s163698604', 's210453027'] | [2940.0, 14420.0] | [17.0, 1042.0] | [795, 794] |
p03290 | u357949405 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = list(map(int, input().split()))\npc = [list(map(int, input().split())) for _ in range(D)]\n\nfor i in range(len(pc)):\n pc[i].append((100 * (i+1) * pc[i][0] + pc[i][1]) / pc[i][0])\n pc[i].append(i+1)\n\npc = sorted(pc, key=lambda x: x[2], reverse=True)\n\nans = 0\ndel_list = []\nfor i, info in enumerate(pc):\n if (100 * info[3] * info[0] + info[1]) <= G:\n G -= (100 * info[3] * info[0] + info[1])\n ans += info[0]\n del_list.append(i)\n else:\n break\n\npc = [info for i, info in enumerate(pc) if i not in del_list]\n\npc = sorted(pc, key=lambda x: x[3], reverse=True)\n\nwhile G > 0:\n G -= 100 * pc[0][3]\n pc[0][0] -= 1\n ans += 1\n if pc[0][0] == 0:\n G -= pc[0][1]\n pc.pop(0)\n\nprint(ans)', "D, G = list(map(int, input().split()))\npc = [list(map(int, input().split())) for _ in range(D)]\n\nans = sum([i[0] for i in pc])\n\nfor i in range(2**D):\n search_index = format(i, '0' + str(D) + 'b')\n complete_answered = [i for i, c in enumerate(search_index[::-1]) if c == '1']\n incomplete_answered = list(set(range(D)) - set(complete_answered))\n answered_number = 0\n remaining_score = G\n for j in complete_answered:\n answered_number += pc[j][0]\n remaining_score -= (100 * (j + 1) * pc[j][0] + pc[j][1])\n incomplete_answered = sorted(incomplete_answered, reverse=True)\n for j in incomplete_answered:\n question_number = pc[j][0]\n while remaining_score > 0:\n answered_number += 1\n remaining_score -= 100 * (j + 1)\n question_number -= 1\n if question_number <= 0:\n remaining_score -= pc[j][1]\n break\n if answered_number < ans:\n ans = answered_number\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s168758134', 's021990393'] | [3064.0, 3188.0] | [18.0, 202.0] | [741, 988] |
p03290 | u360116509 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['def main():\n D, G = map(int, input().split())\n pc = []\n for i in range(D):\n p, c = map(int, input().split())\n w = 100 * (i + 1)\n y = w * p + c\n z = y / p\n pc.append((p, w, y, z))\n pc = sorted(pc, key=lambda x: x[3], reverse=True)\n ans = 0\n for p, w, y, z in pc:\n if G >= y:\n G -= y\n ans += p\n else:\n for _ in range(p):\n if G == 0:\n print(ans)\n exit()\n G -= w\n ans += 1\n\n\nmain()\n', 'D, G = map(int, input().split())\nPC = [[int(pc) for pc in input().split()] for _ in range(D)]\n\n\ndef f(d, g):\n if 0 > d:\n return 100 ** 10\n n = min(g // (100 * (d + 1)), PC[d][0])\n s = n * 100 * (d + 1)\n if n == PC[d][0]:\n s += PC[d][1]\n if g > s:\n n += f(d - 1, g - s)\n return min(n, f(d - 1, g))\n\n\ndef main():\n print(f(D - 1, G))\n\n\nmain()\n'] | ['Wrong Answer', 'Accepted'] | ['s709922105', 's744922437'] | [3064.0, 3064.0] | [18.0, 20.0] | [561, 382] |
p03290 | u366133198 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["import itertools\n\ndef all_comb(iterable):\n for i in range(0, len(iterable) + 1):\n comb = itertools.combinations(iterable, i)\n for pair in comb:\n yield(pair)\n\ndef min_solve(goal_point, solve, pc_list):\n solve_point = sum([pc[0] * pc[2] + pc[1] for pc in solve])\n solve_num = sum([pc[0] for pc in solve])\n nc_solve = set(pc_list) - set(solve)\n if solve_point > goal_point:\n return float('Inf')\n if solve_point == goal_point:\n return solve_num\n nc_solve_max = max(nc_solve, key=lambda pc:pc[2])\n if solve_point + (nc_solve_max[0] - 1) * nc_solve_max[2] >= goal_point:\n\tmin_solve = int((goal_point - solve_point) / nc_solve_max[2] + solve_num)\n return min_solve\n else:\n return float('Inf')\n\nif __name__=='__main__':\n D, G = map(int, input().split())\n pc_list = []\n for i in range(D):\n\t(p, c) = map(int, input().split())\n\tpc_list.append((p, c, (i + 1) * 100))\n min_num = min([min_solve(G, solve, pc_list) for solve in all_comb(pc_list)])\n print(min_num)\n", '#!/usr/bin/python3 \n\nimport itertools\nimport sys\n\ndef printe(value):\n print(value, file=sys.stderr)\n\ndef all_comb(iterable):\n for i in range(0, len(iterable) + 1):\n comb = itertools.combinations(iterable, i)\n for pair in comb:\n yield(pair)\n\ndef min_solve(goal_point, solve, pc_list):\n solve_point = sum([pc[0] * pc[2] + pc[1] for pc in solve])\n solve_num = sum([pc[0] for pc in solve])\n printe("solve={}".format(solve))\n printe("solve_point={}".format(solve_point))\n printe("solve_num={}".format(solve_num))\n\n nc_solve = set(pc_list) - set(solve)\n if solve_point > goal_point:\n return float(\'Inf\')\n if solve_point == goal_point:\n\treturn solve_num\n nc_solve_max = max(nc_solve, key=lambda pc:pc[2])\n if solve_point + (nc_solve_max[0] - 1) * nc_solve_max[2] >= goal_point:\n\tmin_solve = int((goal_point - solve_point) / nc_solve_max[2] + solve_num)\n return min_solve\n else:\n return float(\'Inf\')\n\nif __name__==\'__main__\':\n D, G = map(int, input().split())\n pc_list = []\n for i in range(D):\n\t(p, c) = map(int, input().split())\n\tpc_list.append((p, c, (i + 1) * 100))\n min_num = min([min_solve(G, solve, pc_list) for solve in all_comb(pc_list)])\n print(min_num)\n', "import itertools\nimport math\n\ndef all_comb(iterable):\n for i in range(0, len(iterable) + 1):\n comb = itertools.combinations(iterable, i)\n for pair in comb:\n yield(pair)\n\ndef min_solve(goal_point, solve, pc_list):\n solve_point = sum([pc[0] * pc[2] + pc[1] for pc in solve])\n solve_num = sum([pc[0] for pc in solve])\n nc_solve = set(pc_list) - set(solve)\n if solve_point >= goal_point:\n return solve_num\n nc_solve_max = max(nc_solve, key=lambda pc:pc[2])\n if solve_point + (nc_solve_max[0] - 1) * nc_solve_max[2] >= goal_point:\n min_solve = int(math.ceil((goal_point - solve_point) / nc_solve_max[2] + solve_num))\n return min_solve\n else:\n return float('Inf')\n\nif __name__=='__main__':\n D, G = map(int, input().split())\n pc_list = []\n for i in range(D):\n (p, c) = map(int, input().split())\n pc_list.append((p, c, (i + 1) * 100))\n min_num = min([min_solve(G, solve, pc_list) for solve in all_comb(pc_list)])\n print(min_num)\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s105302561', 's843923510', 's543414712'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 26.0] | [1045, 1404, 1028] |
p03290 | u369212307 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | [' d, g = map(int, input().split())\n pc = [list(map(int, input().split())) for _ in range(d)]\n \n ans = 1000\n for i in range(1 << d):\n \tscore = 0\n \tnum = 0\n \trest = 0\n \tfor j in range(d):\n \t\tif ((i >> j) & 1) == 1:\n \t\t\tscore += pc[j][0]*100*(j+1) + pc[j][1]\n \t\t\tnum += pc[j][0]\n \t\telse:\n \t\t\trest = j\n \tif score < g:\n \t\tneed = (g-score-1)//(100*(rest+1)) + 1\n \t\tif need > pc[rest][0]-1:\n \t\t\tcontinue\n \t\telse:\n \t\t\tnum += need\n \tans = min(ans, num)\n \n print(ans)', ' d, g = map(int, input().split())\n pc = [list(map(int, input().split())) for _ in range(d)]\n \n ans = 1000\n for i in range(1 << d):\n \tscore = 0\n \tnum = 0\n \trest = 0\n \tfor j in range(d):\n \t\tif ((i >> j) & 1) == 1:\n \t\t\tscore += pc[j][0]*100*(j+1) + pc[j][1]\n \t\t\tnum += pc[j][0]\n \t\telse:\n \t\t\trest = j\n \tif score < g:\n \t\tneed = (g-score-1)//(100*(rest+1)) + 1\n \t\tif need > pc[rest][0]-1:\n \t\t\tcontinue\n \t\telse:\n \t\t\tnum += need\n \tans = min(ans, num)\n \n print(ans)', 'd, g = (int(i) for i in input().split())\np = [[int(i) for i in input().split()] for i in range(n)]\nans = 1000\n\nfor i in range(1 << d): # 4\n score = 0\n num = 0\n rest = 0\n for j in range(d): # 2\n if ((i >> j) & 1) == 1: # 0 1 2=10\n score += p[j][0] * 100 * (j + 1) + p[j][1]\n num += p[j][0]\n else:\n rest = j\n if score < g:\n need = (g - score - 1) // (100*(rest+1))\n if need > p[rest][0] - 1: \n continue\n else:\n num += need\n ans = min(ans, num)\nprint(ans)', 'd, g = (int(i) for i in input().split())\np = [[int(i) for i in input().split()] for i in range(n)]\nans = 1000\n\nfor i in range(1 << d): # 4\n score = 0\n num = 0\n rest = 0\n for j in range(d): # 2\n if ((i >> j) & 1) == 1: # 0 1 2=10\n score += p[j][0] * 100 * (j + 1) + p[j][1]\n num += p[j][0]\n else:\n rest = j\n if score < g:\n need = (g - score) // (100*(rest+1))\n if need > p[rest][0] - 1: \n continue\n else:\n num += need\n ans = min(ans, num)\nprint(ans)', ' d, g = map(int, input().split())\n pc = [list(map(int, input().split())) for _ in range(d)]\n \n ans = 1000\n for i in range(1 << d):\n \tscore = 0\n \tnum = 0\n \trest = 0\n \tfor j in range(d):\n \t\tif ((i >> j) & 1) == 1:\n \t\t\tscore += pc[j][0]*100*(j+1) + pc[j][1]\n \t\t\tnum += pc[j][0]\n \t\telse:\n \t\t\trest = j\n \tif score < g:\n \t\tneed = (g-score-1)//(100*(rest+1)) + 1\n \t\tif need > pc[rest][0]-1:\n \t\t\tcontinue\n \t\telse:\n \t\t\tnum += need\n \tans = min(ans, num)\n \n print(ans)', 'd, g = (int(i) for i in input().split())\np = [[int(i) for i in input().split()] for i in range(n)]\nans = 1000\n\nfor i in range(1 << d): # 4\n score = 0\n num = 0\n rest = 0\n for j in range(d): # 2\n if ((i >> j) & 1) == 1: # 0 1 2=10\n score += p[j][0] * 100 * (j + 1) + p[j][1]\n num += p[j][0]\n print("num:",num)\n else:\n rest = j\n print("rest:",rest)\n if score < g:\n need = (g - score) // (100*(rest+1))\n if need > p[rest][0] - 1: \n print("need:", need)\n continue\n else:\n num += need\n print("num2:",num)\n ans = min(ans, num)\n print("ans:", ans)\nprint(ans)', 'd, g = (int(i) for i in input().split())\np = [[int(i) for i in input().split()] for i in range(n)]\nans = 1000\n\nfor i in range(1 << d): # 4\n score = 0\n num = 0\n rest = 0\n for j in range(d): # 2\n if ((i >> j) & 1) == 1: # 0 1 2=10\n score += p[j][0] * 100 * (j + 1) + p[j][1]\n num += p[j][0]\n else:\n rest = j\n if score < g:\n need = (g - score) // (100*(rest+1))\n if need > p[rest][0] - 1: \n continue\n else:\n num += need\n ans = min(ans, num)\nprint(ans)', 'd, g = (int(i) for i in input().split())\np = [[int(i) for i in input().split()] for i in range(d)]\nans = 1000\n\nfor i in range(1 << d): # 4\n score = 0\n num = 0\n rest = 0\n for j in range(d): # 2\n if ((i >> j) & 1) == 1: # 0 1 2=10\n score += p[j][0] * 100 * (j + 1) + p[j][1]\n num += p[j][0]\n else:\n rest = j\n if score < g:\n need = (g - score - 1) // (100*(rest+1)) + 1\n if need > p[rest][0] - 1: \n continue\n else:\n num += need\n ans = min(ans, num)\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s194688123', 's574719141', 's583415341', 's685634727', 's751252543', 's891158281', 's997989073', 's662825208'] | [2940.0, 2940.0, 3064.0, 3064.0, 2940.0, 3064.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0, 18.0, 17.0, 18.0, 18.0, 23.0] | [527, 527, 683, 679, 527, 828, 679, 687] |
p03290 | u371763408 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import itertools\nfrom collections import Counter\nD, G = map(int, input().split())\nP = [list(map(int, input().split())) for i in range(D)]\nmin_num = 10**8\n\njudge_list = list(itertools.product([0, 1, 2], repeat=D)) \n\n\nfor judge in judge_list:\n score = 0\n num = 0\n d = Counter() \n d.update(judge)\n print(d)\n if (d[0] <= 1):\n for i in range(1, len(judge) + 1):\n if score >= G:\n break\n\n if judge[-i] == 1:\n pass\n\n if judge[-i] == 2:\n score += P[-i][0] * (D - i + 1) * 100 + P[-i][1]\n num += P[-i][0]\n\n if (judge[-i] == 0):\n for j in range(P[-i][0]):\n if score >= G:\n break\n score += 100 * (D - i + 1)\n num += 1\n\n if score >= G:\n min_num = min(num, min_num)\n\nprint(min_num)', 'd,g=map(int,input().split())\nPC=[list(map(int,input().split())) for i in range(d)]\nP=list(map(lambda x:x[0],PC))\nC=list(map(lambda x:x[1],PC))\nans=10**9\ndef dfs(cur,target):\n if cur==0:\n return 10**9\n cnt=min(target//(cur*100),P[cur-1]) \n tmp=(100*cur)*cnt\n if cnt==P[cur-1]:\n tmp+=C[cur-1]\n if tmp<target:\n cnt+=dfs(cur-1,target-tmp) \n return min(cnt,dfs(cur-1,target))\nprint(dfs(d,g))'] | ['Wrong Answer', 'Accepted'] | ['s357439920', 's361627579'] | [13172.0, 3064.0] | [1070.0, 18.0] | [1001, 510] |
p03290 | u375616706 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["d, g = map(int, input().split())\no, c = zip(*[map(int, input().split()) for _ in range(d)])\n\ncomp = [(i+1)*o[i]+c[i]//100 for i in range(d)]\nprint(o, c)\nprint(comp)\n\nG = g//100\n\n\nans = sum(o)\n\nfor j in range(2**d):\n tmp = bin(j)\n ope = tmp[2:len(tmp)].zfill(d)\n\n now = 0 \n f = 1\n num = 0 \n re = [[0, 0]] \n\n for i in range(d):\n if ope[i] == '1':\n now += comp[i]\n num += o[i]\n else:\n re.append([(i+1)*(o[i]-1), i+1])\n\n re.sort()\n re.reverse()\n\n if now < G:\n if now+re[0][0] < G:\n \n now = sum(p)\n f = -1\n else:\n \n K = (G - now)//re[0][1]\n\n \n if (G % re[0][1] > 0):\n K = K+1\n num += K\n if num < ans and f > 0:\n ans = num\nprint(ans)\n", "d, g = map(int, input().split())\no, c = zip(*[map(int, input().split()) for _ in range(d)])\n\ncomp = [(i+1)*o[i]+c[i]//100 for i in range(d)]\n\nG = g//100\n\n\nans = sum(o)\n\nfor j in range(2**d):\n tmp = bin(j)\n ope = tmp[2:len(tmp)].zfill(d)\n\n now = 0 \n f = 1\n num = 0 \n re = [[0, 0]] \n\n for i in range(d):\n if ope[i] == '1':\n now += comp[i]\n num += o[i]\n else:\n re.append([(i+1)*(o[i]-1), i+1])\n\n re.sort()\n re.reverse()\n\n if now < G:\n if now+re[0][0] < G:\n \n now = sum(o)\n f = -1\n else:\n \n K = (G - now)//re[0][1]\n\n \n if ((G-now) % re[0][1] > 0):\n K = K+1\n num += K\n if num < ans and f > 0:\n ans = num\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s628335812', 's568302126'] | [3064.0, 3064.0] | [28.0, 27.0] | [1157, 1139] |
p03290 | u385644001 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['#3\nd,g = map(int,input().split())\nlista = []\nfor i in range(d):\n lista.append([])\n p,c = map(int,input().split())\n lista[i] = [p,c]\n \ndef search(allcomp,notouch,touch,rem,toachiev,ps):\n \n \n \n \n \n \n if touch != []:\n \n point = (touch[0] + 1)*100\n problems = lista[touch[0]][0]\n vnus = lista[touch[0]][1]\n #print(point,problems,vnus)\n if toachiev == 0:\n return ps\n else:\n needproblems = toachiev//point\n if toachiev%point != 0:\n needproblems += 1\n \n if needproblems<=problems:\n return ps+needproblems\n else:\n if point*problems + vnus >= toachiev:\n return ps+problems\n else:\n return 10**9\n \n else:\n if len(rem)==1:\n if toachiev == 0:\n return ps\n else\n rempoint = (rem[0] + 1)*100\n notouchpoint_max = 0\n if notouch != []:\n notouchpoint_max = (max(notouch) + 1)*100\n\n if notouchpoint_max <= rempoint:\n return search(allcomp,notouch,rem,[],toachiev,ps)\n else:\n return 10**9\n else:\n if toachiev == 0:\n return ps\n else:\n minp = 10**9\n for i in range(len(rem)):\n allcomp_t,notouch_t,rem_t,toachiev_t,ps_t = list(allcomp),list(notouch),list(rem),toachiev,ps\n allcomp_t.append(rem[i])\n rem_t = rem[:i]+rem[i+1:]\n toachiev_t = toachiev_t - (rem[i] + 1)*100*lista[rem[i]][0] - lista[rem[i]][1]\n if toachiev_t <0:\n toachiev_t = 0\n ps_t = ps_t + lista[rem[i]][0]\n case1 = search(allcomp_t,notouch_t,[],rem_t,toachiev_t,ps_t)\n\n allcomp_t,notouch_t,rem_t,toachiev_t,ps_t = list(allcomp),list(notouch),list(rem),toachiev,ps\n notouch_t.append(rem[i])\n rem_t = rem[:i]+rem[i+1:]\n case2 = search(allcomp_t,notouch_t,[],rem_t,toachiev_t,ps_t)\n #print(case1,case2)\n if minp > min(case1,case2):\n minp = min(case1,case2)\n \n return minp\n \n \n \n \n \nmakerem = []\nfor i in range(d):\n makerem.append(i)\n \nprint(search([],[],[],makerem,g,0))', 'd,g = map(int,input().split())\np = []\nc = []\nfor i in range(d):\n tp,tc = map(int,input().split())\n p.append(tp)\n c.append(tc)\nans = 1<<50\nfor i in range(1<<d):\n score = 0\n count = 0\n zero_list = []\n for j in range(d):\n if ((i >> j) & 1):\n score += c[j] + p[j]*(j+1)*100 \n count += p[j]\n else:\n zero_list.append(j)\n if score >= g:\n ans = min(ans,count)\n else:\n rem = g-score\n if rem <= (p[max(zero_list)]-1)*(max(zero_list)+1)*100:\n for i in range(1,p[max(zero_list)]):\n if rem - i*(max(zero_list)+1)*100 <= 0:\n count += i\n ans = min(ans,count)\n break\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s491316051', 's561742691'] | [3064.0, 3444.0] | [17.0, 23.0] | [2783, 917] |
p03290 | u386170566 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D,G = list(map(int,input().split()))\nt = [[0,0]]\nfor i in range(D):\n t.append(list(map(int,input().split())))\ndef down(i,j,ans,wa):\n if wa >= G:\n return ans\n exit()\n else:\n if i == 0:\n for k in range(1,D+1):\n down(k,1,ans+1,wa+100*i)\n elif j < t[i][0]-1:\n down(i,j+1,ans+1,wa+100*i)\n elif j == t[i][0]-1:\n down(i,t[i][0],ans+1,wa+100*i+t[i][1])\n elif j == t[i]:\n if 1 < i :\n down(i-1,1,ans+1,wa+100*(i-1))\ndef up(i,j,ans,wa):\n if wa >= G:\n return ans\n exit()\n else:\n if i == 0:\n for k in range(1,D+1):\n up(k,1,ans+1,wa+100*i)\n elif j < t[i][0]-1:\n up(i,j+1,ans+1,wa+100*i)\n elif j == t[i][0]-1:\n up(i,t[i][0],ans+1,wa+100*i+t[i][1])\n elif j == t[i]:\n if i < D :\n up(i+1,1,ans+1,wa+100*(i+1))\n\nprint(up(0,0,0,0))', '#ABC104C - All Green\nimport math\ndef dfs(i,s,c,r):\n global ans\n if i == d:\n if s < g:\n use = max(r)\n n = min(pc[use -1][0], math.ceil((g-s)/(use*100)))\n c += n\n s += n*use*100\n if s >= g:\n ans = min(ans,c)\n print(c)\n \n else:\n dfs(i+1, s, c, r)\n dfs(i+1, s+ pc[i][0]*(i+1)*100+pc[i][1],c+pc[i][0],r-{i+1})\n \nd,g = list(map(int,input().split()))\npc = [list(map(int,input().split())) for i in range(d)]\n\nans = float("inf")\n\ndfs(0,0,0,set(range(1,d+1)))\nprint(ans)', '#ABC104C - All Green\nimport math\ndef dfs(i,s,c,r):\n global ans\n if i == d:\n if s < g:\n use = max(r)\n n = min(pc[use -1][0], math.ceil((g-s)/(use*100)))\n c += n\n s += n*use*100\n if s >= g:\n ans = min(ans,c)\n \n else:\n dfs(i+1, s, c, r)\n dfs(i+1, s+ pc[i][0]*(i+1)*100+pc[i][1],c+pc[i][0],r-{i+1})\n \nd,g = list(map(int,input().split()))\npc = [list(map(int,input().split())) for i in range(d)]\n\nans = float("inf")\n\ndfs(0,0,0,set(range(1,d+1)))\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s231912771', 's617122550', 's359035908'] | [3064.0, 3188.0, 3064.0] | [18.0, 20.0, 20.0] | [958, 573, 552] |
p03290 | u407160848 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['def can(d,g,p,c, maxPick):\n\t\n\n\t\n\tfor i in range(0, 2**(d-1)):\n\n\t\t\n\t\tpoint = 0\n\t\tpicked = 0\n\t\tfor j in range(0, d-1):\n\t\t\tif i & (2**j) != 0:\n\t\t\t\tpoint += (j+1) * 100 * p[j] + c[j]\n\t\t\t\tpicked += p[j]\n\n\t\tif picked > maxPick:\n\t\t\tprint (i, " is un")\n\t\t\tcontinue\n\t\tprint ("i", i , "picked", picked, "point", point)\n\n\t\t\n\t\tt = d-1\n\t\twhile(picked < maxPick):\n\t\t\tif i & (2**t) != 0:\n\t\t\t\tt -= 1\n\t\t\t\tcontinue\n\t\t\tpick = min(p[t], (maxPick - picked))\n\t\t\tpicked += pick\n\t\t\tpoint += (t+1)*100 * pick\n\t\t\tif pick == p[t]:\n\t\t\t\tpoint += c[t]\n\t\t\tprint ("t", t, "pick", pick, "picked", picked, "point", point)\n\t\t\tt -= 1\n\n\t\tif point >= g:\n\t\t\treturn True\n\t\telse:\n\t\t\tprint (point)\n\treturn False\n\n\ndef bin(d,g,p,c):\n\tleft = 1\n\tright = sum(p)\n\twhile left != right:\n\t\tcen = (left + right) // 2\n\t\tprint ("left", left, "cen", cen, "right", right)\n\t\tif(can(d,g,p,c,cen)):\n\t\t\tright = cen\n\t\telse:\n\t\t\tleft = cen + 1\n\treturn right\n\n\ns = input().split(" ")\nd = int(s[0])\ng = int(s[1])\n\np = []\nc = []\n\nfor i in range(0, d):\n\ts = input().split(" ")\n\tp.append(int(s[0]))\n\tc.append(int(s[1]))\n\nprint(bin(d,g,p,c))', 'def can(d,g,p,c, maxPick):\n\t\n\n\t\n\tfor i in range(0, 2**(d-1)):\n\n\t\t\n\t\tpoint = 0\n\t\tpicked = 0\n\t\tfor j in range(0, d-1):\n\t\t\tif i & (2**j) != 0:\n\t\t\t\tpoint += (j+1) * 100 * p[j] + c[j]\n\t\t\t\tpicked += p[j]\n\n\t\tif picked > maxPick:\n\t\t\t#print (i, " is un")\n\t\t\tcontinue\n\t\t\n\n\t\t\n\t\tt = d-1\n\t\twhile(picked < maxPick):\n\t\t\tif i & (2**t) != 0:\n\t\t\t\tt -= 1\n\t\t\t\tcontinue\n\t\t\tpick = min(p[t], (maxPick - picked))\n\t\t\tpicked += pick\n\t\t\tpoint += (t+1)*100 * pick\n\t\t\tif pick == p[t]:\n\t\t\t\tpoint += c[t]\n\t\t\t#print ("t", t, "pick", pick, "picked", picked, "point", point)\n\t\t\tt -= 1\n\n\t\tif point >= g:\n\t\t\treturn True\n\t\telse:\n\t\t\tprint (point)\n\treturn False\n\n\ndef bin(d,g,p,c):\n\tleft = 1\n\tright = sum(p)\n\twhile left != right:\n\t\tcen = (left + right) // 2\n\t\t\n\t\tif(can(d,g,p,c,cen)):\n\t\t\tright = cen\n\t\telse:\n\t\t\tleft = cen + 1\n\treturn right\n\n\ns = input().split(" ")\nd = int(s[0])\ng = int(s[1])\n\np = []\nc = []\n\nfor i in range(0, d):\n\ts = input().split(" ")\n\tp.append(int(s[0]))\n\tc.append(int(s[1]))\n\nprint(bin(d,g,p,c))', 'def can(d,g,p,c, maxPick):\n\t\n\n\t\n\tfor i in range(0, 2**(d-1)):\n\n\t\t\n\t\tpoint = 0\n\t\tpicked = 0\n\t\tfor j in range(0, d-1):\n\t\t\tif i & (2**j) != 0:\n\t\t\t\tpoint += (j+1) * 100 * p[j] + c[j]\n\t\t\t\tpicked += p[j]\n\n\t\tif picked > maxPick:\n\t\t\t#print (i, " is un")\n\t\t\tcontinue\n\t\t\n\n\t\t\n\t\tt = d-1\n\t\twhile(picked < maxPick):\n\t\t\tif i & (2**t) != 0:\n\t\t\t\tt -= 1\n\t\t\t\tcontinue\n\t\t\tpick = min(p[t], (maxPick - picked))\n\t\t\tpicked += pick\n\t\t\tpoint += (t+1)*100 * pick\n\t\t\tif pick == p[t]:\n\t\t\t\tpoint += c[t]\n\t\t\t#print ("t", t, "pick", pick, "picked", picked, "point", point)\n\t\t\tt -= 1\n\n\t\tif point >= g:\n\t\t\treturn True\n\t\telse:\n\t\t\tpass\n\t\t\t#print (point)\n\treturn False\n\n\ndef bin(d,g,p,c):\n\tleft = 1\n\tright = sum(p)\n\twhile left != right:\n\t\tcen = (left + right) // 2\n\t\t\n\t\tif(can(d,g,p,c,cen)):\n\t\t\tright = cen\n\t\telse:\n\t\t\tleft = cen + 1\n\treturn right\n\n\ns = input().split(" ")\nd = int(s[0])\ng = int(s[1])\n\np = []\nc = []\n\nfor i in range(0, d):\n\ts = input().split(" ")\n\tp.append(int(s[0]))\n\tc.append(int(s[1]))\n\nprint(bin(d,g,p,c))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s318831015', 's396345887', 's849008973'] | [4336.0, 3316.0, 3188.0] | [144.0, 63.0, 59.0] | [1302, 1306, 1315] |
p03290 | u411858517 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["import itertools\n\ndef solve(D, G, problems):\n bit_list = list(itertools.product([0, 1], repeat=D))\n \n result_count = 10 ** 8\n for pattern in bit_list:\n scores = 0 \n count = 0 \n for i in range(D):\n if pattern[i] == 1: \n scores += problems[i][0] * (i+1) * 100 + problems[i][1] \n count += problems[i][0]\n \n else:\n max_score_problem = i + 1\n \n \n if G > scores:\n count += (G - scores) // (max_score_problem * 100)\n if (G - scores) % (max_score_problem * 100) != 0:\n count += 1\n \n result_count = min(result_count, count)\n \n print(result_count)\n \n\nif __name__ == '__main__':\n D, G = map(int, input().split())\n problems = [list(map(int, input().split())) for _ in range(D)]\n solve(D, G, problems)", "import itertools\n\ndef solve(D, G, problems):\n bit_list = list(itertools.product([0, 1], repeat=D))\n \n result_count = 10 ** 8\n for pattern in bit_list:\n score = 0 \n count = 0 \n for i in range(D):\n if pattern[i] == 1: \n score += problems[i][0] * (i+1) * 100 + problems[i][1] \n count += problems[i][0]\n \n else:\n max_score_problem = i\n \n \n if score < G:\n for i in range(problems[max_score_problem][0]):\n count += 1\n score += (max_score_problem + 1) * 100\n if score >= G:\n break\n \n if score >= G:\n result_count = min(result_count, count)\n \n print(result_count)\n \n\nif __name__ == '__main__':\n D, G = map(int, input().split())\n problems = [list(map(int, input().split())) for _ in range(D)]\n solve(D, G, problems)"] | ['Wrong Answer', 'Accepted'] | ['s177076062', 's641738793'] | [3316.0, 3188.0] | [22.0, 37.0] | [1158, 1212] |
p03290 | u423665486 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['def resolve():\n\td, g = map(int, input().split())\n\tps = []\n\tcs = []\n\tans = 100**6\n\tfor _ in range(d):\n\t\tp, c = map(int, input().split())\n\t\tps.append(p)\n\t\tcs.append(c)\n\tfor i in range(d-1, -1, -1):\n\t\ttotal = 0\n\t\tsolved = 0\n\t\tfor _ in range(ps[i]):\n\t\t\tif total >= g and ans > solved:\n\t\t\t\tans = solved\n\t\t\ttotal += 100 * (i + 1)\n\t\t\tsolved += 1\n\t\ttotal += cs[i]\n\t\tif total >= g and ans > solved:\n\t\t\tans = solved\n\t\t\tbreak\n\t\tfor j in range(1 << d):\n\t\t\tdone = False\n\t\t\tt_solved = solved\n\t\t\tt_total = total\n\t\t\tfor k in range(d-1, -1, -1):\n\t\t\t\tif (j >> k) & 1:\n\t\t\t\t\tif i == k:\n\t\t\t\t\t\tcontinue\n\t\t\t\t\tif done:\n\t\t\t\t\t\tbreak\n\t\t\t\t\tfor _ in range(ps[k]):\n\t\t\t\t\t\tif done:\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tif t_total >= g and ans > t_solved:\n\t\t\t\t\t\t\tans = t_solved\n\t\t\t\t\t\t\tdone = True\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tt_total += 100 * (k+1)\n\t\t\t\t\t\tt_solved += 1\n\t\t\t\t\tt_total += cs[k]\nresolve()', 'def resolve():\n\td, g = map(int, input().split())\n\tps = []\n\tcs = []\n\tans = 100**6\n\tfor _ in range(d):\n\t\tp, c = map(int, input().split())\n\t\tps.append(p)\n\t\tcs.append(c)\n\tfor i in range(d-1, -1, -1):\n\t\ttotal = 0\n\t\tsolved = 0\n\t\tfor _ in range(ps[i]):\n\t\t\tif total >= g and ans > solved:\n\t\t\t\tans = solved\n\t\t\ttotal += 100 * (i + 1)\n\t\t\tsolved += 1\n\t\ttotal += cs[i]\n\t\tif total >= g and ans > solved:\n\t\t\tans = solved\n\t\t\tbreak\n\t\tfor j in range(1 << d):\n\t\t\tdone = False\n\t\t\tt_solved = solved\n\t\t\tt_total = total\n\t\t\tfor k in range(d-1, -1, -1):\n\t\t\t\tif (j >> k) & 1:\n\t\t\t\t\tif i == k:\n\t\t\t\t\t\tcontinue\n\t\t\t\t\tif done:\n\t\t\t\t\t\tbreak\n\t\t\t\t\tfor _ in range(ps[k]):\n\t\t\t\t\t\tif done:\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tif t_total >= g and ans > t_solved:\n\t\t\t\t\t\t\tans = t_solved\n\t\t\t\t\t\t\tdone = True\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tt_total += 100 * (k+1)\n\t\t\t\t\t\tt_solved += 1\n\t\t\t\t\tt_total += cs[k]\n\t\t\t\t\tif t_total >= g and ans > t_solved:\n\t\t\t\t\t\tans = t_solved\n\tprint(ans)\nresolve()'] | ['Wrong Answer', 'Accepted'] | ['s584238522', 's520536448'] | [3064.0, 3064.0] | [795.0, 819.0] | [842, 916] |
p03290 | u426764965 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["D, G = map(int, input().split())\nP = []\nC = []\nfor i in range(D):\n p, c = map(int, input().split())\n P.append(p)\n C.append(c)\n\nans = 1e9\nfor mask in range(2**D - 1):\n score = 0\n num = 0\n rest_max = -1\n\n for i in range(D):\n if (mask >> i) & 1:\n score += 100 * (i+1) * P[i] + C[i]\n num += P[i]\n else:\n rest_max = i\n\n #print('mask {}, score {}, num {}, rest_max {}'.format(format(mask, '010b'), score, num, rest_max))\n\n if score < G:\n scr1 = 100 * (rest_max + 1)\n need = (G - score + scr1 - 1) // scr1\n if need >= P[rest_max]:\n #print('fault')\n continue\n num += need\n \n else:\n \n\n ans = min(ans, num)\n\nprint(ans)", 'D, G = map(int, input().split())\nP = []\nC = []\nfor i in range(D):\n p, c = map(int, input().split())\n P.append(p)\n C.append(c)\n\nans = 1e9\nfor mask in range(2**D):\n score = 0\n num = 0\n rest_max = -1\n\n for i in range(D):\n if (mask >> i) & 1:\n score += 100 * (i+1) * P[i] + C[i]\n num += P[i]\n else:\n rest_max = i\n\n if score < G:\n scr1 = 100 * (rest_max + 1)\n need = (G - score + scr1 - 1) // scr1\n if need >= P[rest_max]:\n continue\n num += need\n\n ans = min(ans, num)\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s810162407', 's078822209'] | [3064.0, 3064.0] | [18.0, 21.0] | [747, 521] |
p03290 | u427344224 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\n\np_list = []\nc_list = []\nfor i in range(D):\n p, c = map(int, input().split())\n p_list.append(p)\n c_list.append(c)\n\nfi = 0\nco = 0\nresult1=0\nfor i in range(D-1, -1, -1):\n if fi >= G:\n break\n p = p_list[i]\n while p > 0:\n p -= 1\n fi += 100 * (i+1)\n result1 +=1\n if p==0:\n fi += c_list[i]\n if fi >= G:\n break\nprint(result1)', 'D, G = map(int, input().split())\n\np_list = []\nc_list = []\nfor i in range(D):\n p, c = map(int, input().split())\n p_list.append(p)\n c_list.append(c)\n\nfi = 0\nco = 0\nresult1=0\nfor i in range(D-1, -1, -1):\n if fi >= G:\n break\n p = p_list[i]\n while p > 0:\n p -= 1\n fi += 100 * (i+1)\n result1 +=1\n if p==0:\n fi += c_list[i]\n if fi >= G:\n break', 'D, G = map(int, input().split())\n\np_list = []\nc_list = []\nfor i in range(D):\n p, c = map(int, input().split())\n p_list.append(p)\n c_list.append(c)\n\nfi = 0\nco = 0\nresult1=0\nfor i in range(D-1, -1, -1):\n if fi >= G:\n break\n p = p_list[i]\n while p > 0:\n p -= 1\n fi += 100 * (i+1)\n print(fi)\n result1 +=1\n if p==0:\n fi += c_list[i]\n if fi >= G:\n break', 'D, G = map(int, input().split())\nitems = []\nfor i in range(D):\n p, c = map(int, input().split())\n items.append((p, c, i))\n\nans = float("inf")\nfor i in range(2 ** D):\n bit = bin(i)[2:].zfill(D)\n sum_num = 0\n cnt = 0\n used = set()\n for j in range(D):\n b = bit[j]\n if b == "1":\n used.add(j)\n cnt += items[j][0]\n sum_num += 100 * (j + 1) * items[j][0] + items[j][1]\n if sum_num >= G:\n ans = min(ans, cnt)\n else:\n for p, c, j in reversed(items):\n if j in used:\n continue\n for a in range(p - 1):\n sum_num += 100 * (j + 1)\n cnt += 1\n if sum_num >= G:\n break\n if sum_num >= G:\n ans = min(ans, cnt)\n break\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s229636916', 's642191187', 's683355179', 's570056531'] | [3064.0, 3064.0, 3188.0, 3064.0] | [17.0, 17.0, 18.0, 150.0] | [433, 418, 436, 838] |
p03290 | u445624660 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['\n\n\n\nimport sys\nsys.setrecursionlimit(10**10)\n\nd, g = map(int, input().split())\nmemo = {}\npoints, bonus = [], []\nfor _ in range(d):\n p, c = map(int, input().split())\n points.append(p)\n bonus.append(c)\n\n\ndef f(c, p):\n if (c, p) in memo:\n return memo[(c, p)]\n if p >= g:\n return c\n ret = 10 ** 10\n for i in range(d):\n if points[i] == 1:\n points[i] = 0\n ret = min(ret, f(c + 1, p + (i + 1) * 100 + bonus[i]))\n points[i] = 1\n elif points[i] > 1:\n points[i] -= 1\n ret = min(ret, f(c + 1, p + (i + 1) * 100))\n points[i] += 1\n else:\n continue\n memo[(c, p)] = ret\n return ret\n\n\nprint(f(0, 0))\n', '\n\nd, g = map(int, input().split())\npoints = []\nfor _ in range(d):\n p, c = map(int, input().split())\n points.append((p, c))\nans = 10**12\nfor bit in range(2**d):\n arr = [False] * d\n for i in range(d):\n if bit >> i & 1 == 1:\n arr[i] = True\n tmp_sum = 0\n count = 0\n for i in range(d):\n if arr[i]:\n # kompuli-to\n tmp_sum += points[i][1]\n tmp_sum += (i + 1) * 100 * points[i][0]\n count += points[i][0]\n if tmp_sum < g:\n \n for i in range(d - 1, -1, -1):\n if arr[i]:\n \n continue\n used = 0\n for j in range(points[i][0]):\n if tmp_sum < g:\n tmp_sum += (i + 1) * 100\n count += 1\n used += 1\n if used == points[i][0]:\n tmp_sum += points[i][1]\n if tmp_sum >= g:\n break\n ans = min(ans, count)\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s365000459', 's912511985'] | [3064.0, 9280.0] | [18.0, 140.0] | [949, 1186] |
p03290 | u457554982 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['abcd=list(input())\nfor i in range(2**3):\n if i//4==0:\n op1="+"\n else:\n op1="-"\n i=i%4\n if i//2==0:\n op2="+"\n else:\n op2="-"\n i=i%2\n if i==0:\n op3="+"\n else:\n op3="-"\n siki=abcd[0]+op1+abcd[1]+op2+abcd[2]+op3+abcd[3]\n if eval(siki)==7:\n siki+="=7"\n break\nprint(siki)\n', '[d,g]=list(map(int,input().split()))\npc=[]\nfor i in range(d):\n kari=list(map(int,input().split()))\n pc.append(kari)\ngokei=[]\nfor i in range(d):\n gokei.append(100*(i+1)*pc[i][0]+pc[i][1])\n\nkosumin=10000\nfor i in range(1<<d):\n score=0\n kosu=0\n jmax=0\n siyouzumi=[]\n for j in range(d):\n if ((i>>j)&1)==1:\n score+=gokei[j]\n kosu+=pc[j][0]\n siyouzumi.append(j)\n\n if score>=g:\n if kosumin>kosu:\n kosumin=kosu\n if score<g:\n a=d-1\n while True:\n if a==-1:\n break\n if not a in siyouzumi:\n saidai=a\n break\n a-=1\n if a==-1:\n continue\n\n for k in range(pc[saidai][0]):\n score+=(saidai+1)*100\n kosu+=1\n if k==pc[saidai][0]-1:\n score+=pc[saidai][1]\n if score>=g:\n break\n if score>=g and kosumin>kosu:\n kosumin=kosu\nprint(kosumin)\n \n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s861934662', 's908638200'] | [3064.0, 3064.0] | [17.0, 61.0] | [352, 1030] |
p03290 | u459150945 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ["pc = [list(map(int, input().split())) for i in range(D)]\n\n\ndef dfs(i, sum, count, nokori):\n global ans\n if i == D:\n if sum < G:\n use = max(nokori)\n n = min(pc[use-1][0], -(-(G-sum)//(use*100)))\n count += n\n sum += n * use * 100\n if sum >= G:\n ans = min(ans, count)\n\n else:\n dfs(i+1, sum, count, nokori)\n dfs(i+1, sum+pc[i][0]*(i+1)*100+pc[i][1], count+pc[i][0], nokori-{i+1})\n\n\nans = float('inf')\n\ndfs(0, 0, 0, set(range(1, D+1)))\nprint(ans)\n", 'import itertools\nD, G = map(int, input().split())\npc = [list(map(int, input().split())) for _ in range(D)]\nbit = itertools.product([0, 1], repeat=D)\nans = 1000\nfor bi in bit:\n cnt = 0\n score = 0\n nokori = []\n for i in range(D):\n if bi[i] == 0:\n nokori.append([pc[i][0], (i+1)*100])\n continue\n score += pc[i][1] + 100*(i+1)*(pc[i][0])\n cnt += pc[i][0]\n if score >= G:\n ans = min(ans, cnt)\n else:\n for num, point in reversed(nokori):\n for j in range(1, num):\n cnt += 1\n score += point\n if score >= G:\n ans = min(ans, cnt)\n break\n else:\n continue\n break\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s502072728', 's202343491'] | [3064.0, 3064.0] | [17.0, 119.0] | [534, 768] |
p03290 | u463858127 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['d, g = map(int, input().split())\n\np = []\nc = []\nans = []\ncnt = 0\nss = 0\nfor _ in range(d):\n pp, cc = map(int, input().split())\n\n p.append(pp)\n c.append(cc)\n\n\n\nfor x in range(2**d):\n ss = 0\n cnt = 0\n for i in range(d):\n if (x>>i)&1:\n\n ss += (i+1)*100*p[i] + c[i]\n cnt += p[i]\n print("a",ss)\n if ss>=g:\n ans.append(cnt)\n\n else:\n print("c")\n for l in range(d)[::-1]:\n print(l)\n print(x>>l)\n if ((x >> l) & 1):\n continue\n\n for _ in range(p[l]):\n ss += (l+1)*100\n print("b",ss)\n cnt += 1\n\n if ss>=g:\n ans.append(cnt)\n break\n\nprint(min(ans))\n\n\n\n\n\n\n\n\n\n\n\n\n', 'd, g = map(int, input().split())\n\np = []\nc = []\nans = []\ncnt = 0\nss = 0\nfor _ in range(d):\n pp, cc = map(int, input().split())\n\n p.append(pp)\n c.append(cc)\n\n\n\nfor x in range(2**d):\n ss = 0\n cnt = 0\n for i in range(d):\n if (x>>i)&1:\n\n ss += (i+1)*100*p[i] + c[i]\n cnt += p[i]\n print("a",ss)\n if ss>=g:\n ans.append(cnt)\n\n else:\n print("c")\n for l in range(d)[::-1]:\n print(l)\n print(x>>l)\n if ((x >> l) & 1):\n continue\n\n for _ in range(1,p[l]):\n ss += (l+1)*100\n print("b",ss)\n cnt += 1\n\n if ss>=g:\n ans.append(cnt)\n break\n\nprint(min(ans))\n\n\n\n\n\n\n\n\n\n\n\n\n', 'd, g = map(int, input().split())\n\np = []\nc = []\nans = []\ncnt = 0\nss = 0\nfor _ in range(d):\n pp, cc = map(int, input().split())\n\n p.append(pp)\n c.append(cc)\n\n\n\nfor x in range(2**d):\n ss = 0\n cnt = 0\n for i in range(d):\n if (x>>i)&1:\n\n ss += (i+1)*100*p[i] + c[i]\n cnt += p[i]\n print("a",ss)\n if ss>=g:\n ans.append(cnt)\n\n else:\n print("c")\n for l in range(d)[::-1]:\n print(l)\n print(x>>l)\n if ((x >> l) & 1):\n continue\n\n for _ in range(1,p[l]):\n ss += (l+1)*100\n print("b",ss)\n cnt += 1\n\n if ss>=g:\n ans.append(cnt)\n break\n\nprint(min(ans))\n\n\n\n\n\n\n\n\n\n\n\n\n', 'd, g = map(int, input().split())\n\np = []\nc = []\nans = []\ncnt = 0\nss = 0\nfor _ in range(d):\n pp, cc = map(int, input().split())\n\n p.append(pp)\n c.append(cc)\n\n\n\nfor x in range(2**d):\n ss = 0\n cnt = 0\n for i in range(d):\n if (x>>i)&1:\n\n ss += (i+1)*100*p[i] + c[i]\n cnt += p[i]\n print("a",ss)\n if ss>=g:\n ans.append(cnt)\n\n else:\n print("c")\n for l in range(d)[::-1]:\n print(l)\n print(x>>l)\n if ((x >> l) & 1):\n continue\n\n for _ in range(1,p[l]):\n ss += (l+1)*100\n print("b",ss)\n cnt += 1\n\n if ss>=g:\n ans.append(cnt)\n break\n\nprint(min(ans))\n\n\n\n\n\n\n\n\n\n\n\n\n', 'd, g = map(int, input().split())\n\np = []\nc = []\nans = []\ncnt = 0\nss = 0\nfor _ in range(d):\n pp, cc = map(int, input().split())\n\n p.append(pp)\n c.append(cc)\n\nfor i,pp in enumerate(list(reversed(p))[::-1]):\n for _ in range(1,pp):\n ss += (len(p)-i+1)*100\n cnt += 1\n if ss>=g:\n ans.append(cnt)\n\n\nfor x in range(2**d):\n ss = 0\n cnt = 0\n for i in range(d):\n if (x>>i)&1:\n\n ss += (i+1)*100*p[i] + c[i]\n cnt += p[i]\n print("a",ss)\n if ss>=g:\n ans.append(cnt)\n\n else:\n print("c")\n for l in range(d)[::-1]:\n print(l)\n print(x>>l)\n if not ((x >> l) & 1):\n\n for _ in range(1,p[l]):\n ss += (l+1)*100\n print("b",ss)\n cnt += 1\n\n if ss>=g:\n ans.append(cnt)\n break\n\nprint(min(ans))\n\n\n\n\n\n\n\n\n\n\n\n\n', 'd, g = map(int, input().split())\n\np = []\nc = []\nans = []\ncnt = 0\nss = 0\nfor _ in range(d):\n pp, cc = map(int, input().split())\n\n p.append(pp)\n c.append(cc)\n\n\n\nfor x in range(2**d):\n ss = 0\n cnt = 0\n for i in range(d):\n if (x>>i)&1:\n\n ss += (i+1)*100*p[i] + c[i]\n cnt += p[i]\n if ss>=g:\n ans.append(cnt)\n\n else:\n for l in range(d)[::-1]:\n if ((x >> l) & 1):\n continue\n\n for _ in range(1,p[l]):\n ss += (l+1)*100\n cnt += 1\n\n if ss>=g:\n ans.append(cnt)\n break\n\nprint(min(ans))\n\n\n\n\n\n\n\n\n\n\n\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s322675287', 's351064775', 's452418393', 's503347627', 's621274082', 's293885596'] | [8400.0, 8400.0, 8400.0, 8400.0, 8400.0, 3064.0] | [686.0, 661.0, 649.0, 668.0, 640.0, 150.0] | [783, 785, 785, 785, 959, 673] |
p03290 | u471539833 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D,G=map(int,input().split())\np=[]\nc=[]\navg=[]\nfor i in range(D):\n p1,c1=map(int,input().split())\n p.append(p1)\n c.append(c1)\n avg.append((p1*(i+1)*100+c1)/p1)\nans=sum(p)\nfor i in range(2**D):\n num=0\n point=0\n sit=[0]*D\n for j in range(D):\n if(i>>j&1):\n num+=p[j]\n sit[j]+=p[j]\n point+=(j+1)*100*p[j]+c[j]\n if(point<G):\n sitt=sit[::-1]\n loc=D-1-sitt.index(0)\n k=0\n while(point<G):\n num+=1\n k+=1\n point+=(loc+1)*100\n if(k<p[loc]):\n ans=min(ans,num)\n #print(loc)\nprint(ans)', 'D,G=map(int,input().split())\np=[]\nc=[]\nfor i in range(D):\n p1,c1=map(int,input().split())\n p.append(p1)\n c.append(c1)\nans=sum(p)\nfor i in range(2**D):\n num=0\n point=0\n flag=[0]*D\n for j in range(D):\n if(i>>j&1):\n num+=p[j]\n flag[j]=1\n point+=(j+1)*100*p[j]+c[j]\n if(point<G):\n sitt=flag[::-1]\n loc=D-1-sitt.index(0)\n k=0\n while(point<G):\n num+=1\n k+=1\n point+=(loc+1)*100\n if(k<p[loc]):\n ans=min(ans,num)\n else:\n ans=min(ans,num)\n #print(loc)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s794412796', 's762792259'] | [3064.0, 3064.0] | [1884.0, 1801.0] | [533, 519] |
p03290 | u480138356 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import sys\ninput = sys.stdin.readline\n\ndef ceil(a, b):\n if a%b == 0:\n return a//b\n else:\n return a//b + 1\n\ndef main():\n D, G = map(int, input().split())\n pc = [list(map(int, input().split())) for i in range(D)]\n\n ans = int(1e9)\n for i in range(2**D):\n tmp = 0\n rest = []\n count = 0\n for j in range(D):\n if i&1:\n tmp += (j+1)*100 * pc[j][0] + pc[j][1]\n count += pc[j][0]\n else:\n rest.append(((j+1)*100, pc[j][0]))\n i >>= 1\n rest = sorted(rest, reverse=True)\n rest_point = G - tmp\n if rest_point < 0:\n continue\n tmp = ceil(rest_point, rest[0][0])\n if tmp <= rest[0][1]:\n ans = min(ans, count + tmp)\n # print(rest_point, count, tmp)\n print(ans)\n\nif __name__ == "__main__":\n main()\n', 'import sys\ninput = sys.stdin.readline\n\ndef ceil(a, b):\n if a%b == 0:\n return a//b\n else:\n return (a//b) + 1\n\ndef main():\n D, G = map(int, input().split())\n pc = [list(map(int, input().split())) for i in range(D)]\n\n ans = int(1e9)\n for i in range(2**D):\n score = 0\n count = 0\n check = [False] * D\n for j in range(D):\n p, c = pc[j]\n if i&1:\n score += 100 * (j+1) * p + c\n count += p\n check[j] = True\n i >>= 1\n if score < G:\n for j in range(D):\n if not check[D-1-j]:\n check[D-1-j] = True\n p, c = pc[D-1-j]\n tmp = ceil(G - score, (D-j) * 100)\n if tmp < p:\n count += tmp\n score += tmp * (D-j) * 100\n break\n if score >= G:\n \n ans = min(ans, count)\n \n print(ans)\n\n\n\n\nif __name__ == "__main__":\n main()'] | ['Runtime Error', 'Accepted'] | ['s199317565', 's308701868'] | [3064.0, 3064.0] | [24.0, 21.0] | [922, 1096] |
p03290 | u489762173 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['import sys\n\ndef main():\n sum=0\n ans=0\n ansc=0\n D,G = map(int,input().split())\n\n lis=[]\n for x in range(D):\n P,C = map(int,input().split())\n lis.append([P,C])\n\n op_cnt = D\n\n for i in range(2 ** op_cnt):\n for j in range(op_cnt):\n if((i>>j) & 1 and i!=0):\n for k in range(1, lis[j][0]+1):\n sum+=(100*(j+1))\n ansc+=1\n if(k==lis[j][0]):\n sum+=lis[j][1]\n if(sum>=G):\n break\n\n print(ansc,bin(i))\n if(sum<G):\n for lef in reversed(range(0, op_cnt)):\n if(~(i>>lef) & 1 and lis[lef][0] != 1):\n for l in range(1,lis[lef][0]+1):\n sum+=(100*(lef+1))\n ansc+=1\n if(sum>=G):\n break\n\n if(ans>=ansc or ans==0):\n ans=ansc\n\n ansc=0\n sum=0\n\n print(ans)\nmain()', 'import sys\n\ndef main():\n sum=0\n ansc=0\n D,G = map(int,input().split())\n\n lis=[]\nimport sys\n\ndef main():\n sum=0\n ansc=0\n D,G = map(int,input().split())\n\n lis=[]\n for x in range(D):\n P,C = map(int,input().split())\n lis.append([P,C])\n\n op_cnt = D\n\n for i in range(2 ** op_cnt):\n for j in range(op_cnt):\n if((i>>j) & 1 and i!=0):\n for k in range(1, lis[j][0]+1):\n sum+=(100*(j+1))\n ansc+=1\n if(sum>=G):\n break\n if(k==lis[j][0]):\n sum+=lis[j][1]\n if(sum<G):\n for lef in reversed(range(0, op_cnt-1)):\n if((i>>lef) & 0):\n for l in range(1,lis[lef][0]):\n sum+=(100*(l+1))\n ansc+=1\n\n\n print(sum,bin(i),ansc)\n\n\n ansc=0\n sum=0\n\nmain()', 'import sys\n\ndef main():\n sum=0\n ans=0\n ansc=0\n D,G = map(int,input().split())\n\n lis=[]\n for x in range(D):\n P,C = map(int,input().split())\n lis.append([P,C])\n\n op_cnt = D\n\n for i in range(2 ** op_cnt):\n for j in range(op_cnt):\n if((i>>j) & 1 and i!=0):\n for k in range(1, lis[j][0]+1):\n sum+=(100*(j+1))\n ansc+=1\n if(k==lis[j][0]):\n sum+=lis[j][1]\n if(sum>=G):\n break\n if(sum<G):\n for lef in reversed(range(0, op_cnt)):\n if(~(i>>lef) & 1 and lis[lef][0] != 1):\n for l in range(1,lis[lef][0]+1):\n sum+=(100*(lef+1))\n ansc+=1\n if(sum>=G):\n if(ans>=ansc or ans==0):\n ans=ansc\n break\n\n\n\n\n ansc=0\n sum=0\n\n print(ans)\nmain()', 'import sys\n\ndef main():\n sum=0\n ans=0\n ansc=0\n D,G = map(int,input().split())\n\n lis=[]\n for x in range(D):\n P,C = map(int,input().split())\n lis.append([P,C])\n\n op_cnt = D\n\n for i in range(2 ** op_cnt):\n for j in range(op_cnt):\n if((i>>j) & 1 and i!=0):\n for k in range(1, lis[j][0]+1):\n sum+=(100*(j+1))\n ansc+=1\n if(k==lis[j][0]):\n sum+=lis[j][1]\n if(sum>=G):\n break\n\n\n if(sum<G):\n for lef in reversed(range(0, op_cnt)):\n if(~(i>>lef) & 1 and lis[lef][0] != 1):\n for l in range(1,lis[lef][0]+1):\n if(sum>=G):\n break\n sum+=(100*(lef+1))\n ansc+=1\n\n\n if(ans>=ansc or ans==0):\n ans=ansc\n\n ansc=0\n sum=0\n\n print(ans)\nmain()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s346373558', 's449063723', 's898274667', 's920259833'] | [3316.0, 3356.0, 3064.0, 3064.0] | [201.0, 141.0, 199.0, 194.0] | [1020, 968, 1034, 995] |
p03290 | u496821919 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D,G = map(int,input().split())\npc = [list(map(int,input().split())) for i in range(D)]\n\nans = float("inf")\nfor i in range(2**D):\n sum = 0\n count = 0\n rem = set(range(1,D+1))\n for j in range(D):\n if (i >> j) & 1:\n sum += pc[j][0]*100*j+pc[j][1]\n count += pc[j][0]\n rem.discard(j+1)\n if sum < G:\n k = max(rem)-1\n n = min(pc[k][0],-(-(G-sum)//((k+1)*100))\n count += n\n sum += n*100*(k+1)\n if sum >= G:\n ans = min(ans,count)\n\nprint(ans)\n \n', 'D,G = map(int,input().split())\npc = [list(map(int,input().split())) for i in range(D)]\n\nprint(pc)\nans = float("inf")\n\nfor i in range(2**D):\n sum = 0\n count = 0\n rem = set(range(1,D+1))\n for j in range(D):\n if (i >> j) & 1:\n sum += pc[j][0]*100*(j+1)+pc[j][1]\n count += pc[j][0]\n rem.discard(j+1)\n if sum < G:\n k = max(rem)-1\n n = min(pc[k][0],-(-(G-sum)//((k+1)*100)))\n count += n\n sum += n*100*(k+1)\n if sum >= G:\n ans = min(ans,count)\n\nprint(ans)\n', 'def dfs (i,sum,count,rem):\n global ans\n if i == D:\n if sum < G:\n k = max(rem)\n n = min(pc[k-1][0],-(-(G-sum)//(k*100)))\n count += n\n sum += n*100*k\n if sum >= G:\n ans = min(ans,count)\n else:\n dfs(i+1,sum,count,rem)\n dfs(i+1,sum+pc[i][0]*100*(i+1)+pc[i][1],count+pc[i][0],rem-{i+1})\n\nD,G = map(int,input().split())\npc = [list(map(int,input().split())) for i in range(D)]\n\nans = float("inf")\n\ndfs(0,0,0,set(range(1,D+1)))\nprint(ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s476565609', 's524186592', 's064956619'] | [3064.0, 3064.0, 3064.0] | [18.0, 25.0, 19.0] | [535, 542, 523] |
p03290 | u501643136 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int, input().split())\nP = []\nC = []\nfor i in range(D):\n p, c = map(int, input().split())\n P.append(p)\n C.append(c)\nans = 10*100\nfor i in range(2**D):\n rest = G\n cnt = 0\n maxdgt = -1\n for j in range(D):\n if bin(i)>>j & 1:\n rest -= P[i]*(i+1)*100+C[i]\n cnt += P[i]\n else:\n maxdgt = j\n if rest <= 0:\n ans = min(ans, cnt)\n else if rest > (P[maxdgt]-1)*(maxdgt+1)*100:\n continue\n else:\n ans = min(ans, cnt+(rest/100-1)//P[maxdgt]+1)\nprint(ans)', 'D, G = map(int, input().split())\nP = []\nC = []\nfor i in range(D):\n p, c = map(int, input().split())\n P.append(p)\n C.append(c)\nans = 10*100\nfor i in range(2**D):\n rest = G\n cnt = 0\n maxdgt = -1\n for j in range(D):\n if i & 1<<j:\n rest -= P[j]*(j+1)*100+C[j]\n cnt += P[j]\n else:\n maxdgt = j\n if rest <= 0:\n ans = min(ans, cnt)\n elif rest > (P[maxdgt]-1)*(maxdgt+1)*100:\n continue\n else:\n ans = min(ans, cnt+(rest/100-1)//(maxdgt+1)+1)\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s841656696', 's810887318'] | [3064.0, 3064.0] | [17.0, 22.0] | [489, 487] |
p03290 | u503228842 | 2,000 | 1,048,576 | A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements: * Base score: the sum of the scores of all problems solved by the user. * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D). Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective? | ['D, G = map(int,input().split())\np = [0]*D\nc = [0]*D\nans = 10**9\nfor i in range(D):\n p[i], c[i] = map(int,input().split())\n\nfor j in range(2**D):\n total_score = 0\n solved_problems = 0\n unsolved = []\n for k in range(D):\n if (j>>k)&1:\n total_score += 100*(k+1)*p[k]+c[k]\n solved_problems += p[k]\n else:\n unsolved.append(k)\n #print(unsolved)\n if unsolved:\n unsolved_idx = max(unsolved)\n if 100*(unsolved_idx+1)*(p[unsolved_idx]-1) + total_score < G:\n continue\n for l in range(p[unsolved_idx]):\n if (l+1)*100*(unsolved_idx+1) + total_score >= G:\n solved_problems += l+1\n if solved_problems < ans:\n ans = solved_problems\n break\n else: #all solved\n if solved_problems < ans:\n ans = solved_problems\n\nprint(ans)', 'D, G = map(int,input().split())\np = [0]*D\nc = [0]*D\nans = 10**9\nfor i in range(D):\n p[i], c[i] = map(int,input().split())\n\nfor j in range(2**D):\n total_score = 0\n solved_problems = 0\n unsolved = []\n for k in range(D):\n if (j>>k)&1:\n total_score += 100*(k+1)*p[k]+c[k]\n solved_problems += p[k]\n else:\n unsolved.append(k)\n #print(unsolved)\n if unsolved:\n unsolved_idx = max(unsolved)\n if 100*(unsolved_idx+1)*(p[unsolved_idx]-1) + total_score < G:\n continue\n for l in range(p[unsolved_idx]):\n if (l+1)*100*(unsolved_idx+1) + total_score > G:\n solved_problems += l+1\n if solved_problems < ans:\n ans = solved_problems\n break\n else: #all solved\n if solved_problems < ans:\n ans = solved_problems\n\nprint(ans)', "D,G = map(int,input().split())\np = [0]*D\nc = [0]*D\nfor i in range(D):\n p[i], c[i] = map(int,input().split())\n\nans = float('inf')\n\nfor bit in range(1 << D):\n temp_score = 0\n solved_num = 0\n uncompleted_idx = -1\n for i in range(D):\n if (bit & (1<<i)):\n temp_score += p[i]*100*(i+1) + c[i] \n solved_num += p[i]\n else:\n uncompleted_idx = max(uncompleted_idx,i)\n\n\n if G <= temp_score:\n ans = min(ans,solved_num)\n continue\n \n if uncompleted_idx == -1:\n continue\n\n for j in range(p[uncompleted_idx]):\n temp_score += 100*(uncompleted_idx+1)\n solved_num += 1\n if G <= temp_score:\n ans = min(ans,solved_num)\n break\nprint(ans)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s558649241', 's825863052', 's199044849'] | [3064.0, 3064.0, 3064.0] | [24.0, 23.0, 47.0] | [898, 897, 891] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.