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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02695 | u671455949 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import copy\n\nn, m, q = map(int, input().split())\n\na = []\nb = []\nc = []\nd = []\n\nfor i in range(q):\n _a, _b, _c, _d = map(int, input().split())\n a.append(_a)\n b.append(_b)\n c.append(_c)\n d.append(_d)\n\nseq = [[] for i in range(n)]\n\nfor i in range(1, m + 1):\n seq[0].append([i])\n\nfor i in range(... | ['Wrong Answer', 'Accepted'] | ['s089836867', 's412836257'] | [36924.0, 39684.0] | [1654.0, 1744.0] | [689, 692] |
p02695 | u672475305 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n,m,q = map(int,input().split())\narr = [list(map(int,input().split())) for _ in range(q)]\nans = 0\nfor i1 in range(1, m+1):\n for i2 in range(i1, m+1):\n for i3 in range(i2, m+1):\n for i4 in range(i3, m+1):\n for i5 in range(i4, m+1):\n for i6 in range(i5, m+1... | ['Wrong Answer', 'Accepted'] | ['s097473388', 's655911139'] | [9144.0, 9188.0] | [40.0, 592.0] | [939, 469] |
p02695 | u679236042 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import math\nimport itertools\n\nN,M,Q = map(int,input().split())\na =[0] * Q\nb =[0] * Q\nc =[0] * Q\nd =[0] * Q\nfor i in range(Q):\n a[i] , b[i] , c[i] , d[i] = map(int,input().split())\n\n\n\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\n\nA... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s022495111', 's461535111', 's518515620'] | [27280.0, 9256.0, 21604.0] | [2422.0, 24.0, 1293.0] | [1478, 1418, 1387] |
p02695 | u690419532 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['from itertools import combinations_with_replacement\n\nN, M, Q = map(int, input().split())\nlist = [list(map(int,input().split())) for _ in range(Q)]\nseq = [i for i in range(1,M+1)]\nC = combinations_with_replacement(seq, N)\nmax_score = 0\n\nfor A in C:\n A = sorted(A)\n score = 0\n for q in list:\n ... | ['Wrong Answer', 'Accepted'] | ['s740459295', 's222102989'] | [33964.0, 9164.0] | [2250.0, 702.0] | [443, 520] |
p02695 | u692311686 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N,M,Q=map(int,input().split())\na=[]\nb=[]\nc=[]\nd=[]\nfor i in range(Q):\n ta,tb,tc,td=map(int,input().split())\n a+=[ta]\n b+=[tb]\n c+=[tc]\n d+=[td]\nmaxs=0\nA=[0 for i in range(N)]\nfor i in intertools.combination_with_replacement(A,N):\n s=0\n for k in range(Q):\n if i[b[k]-1]-i[a[k]-1]==c[k]:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s329281621', 's372158722', 's418649688', 's857481298', 's862838201', 's983956693'] | [9160.0, 9120.0, 131904.0, 9064.0, 8864.0, 9048.0] | [21.0, 19.0, 2210.0, 23.0, 23.0, 1170.0] | [348, 980, 560, 954, 365, 365] |
p02695 | u693007703 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\n\nN, M, Q = list(map(int,input().split()))\nnumbers = [i for i in range(1, M+1)]\narray = itertools.combinations_wih_replacement(numbers, N)\n\ninput_data = [list(map(int,input().split())) for _ in range(Q)]\n\nmax_score = 0\nfor A in array:\n score = 0\n for _ in range(Q):\n a, b, c, d... | ['Runtime Error', 'Accepted'] | ['s405535183', 's947754354'] | [9216.0, 9216.0] | [25.0, 1551.0] | [484, 485] |
p02695 | u695079172 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['\nn,m,q = map(int,input().split())\nnum_lst = []\nfor i in range(q):\n num_lst.append(list(map(int,input().split())))\nl = list(range(1,m+1))\nA = list(combinations_with_replacement(l,n))\n\nmx = 0\nfor now_A in A:\n score = 0\n for nums in num_lst:\n a,b,c,d = nums\n if now_A[b-1] - now_A[a-1]... | ['Runtime Error', 'Accepted'] | ['s559256943', 's014409053'] | [9092.0, 21628.0] | [21.0, 1085.0] | [371, 424] |
p02695 | u697696097 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import sys\nfrom io import StringIO\nimport unittest\nimport itertools\n\ndef yn(b):\n print("Yes" if b==1 else "No")\n return\n\ndef resolve():\n readline=sys.stdin.readline\n\n n,m,q=map(int, readline().rstrip().split())\n\n aa=[0]*q\n bb=[0]*q\n cc=[0]*q\n dd=[0]*q\n\n for i in range(q):... | ['Wrong Answer', 'Accepted'] | ['s968063180', 's329778979'] | [16224.0, 16220.0] | [67.0, 763.0] | [655, 869] |
p02695 | u726615467 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N, M, Q = map(int, input().split())\nabcd = [list(map(int, input().split())) for _ in range(Q)]\n\nq = []\ndef dp(arg):\n global N\n if len(arg) == N:\n q.append(arg)\n else:\n tmp = 0 if len(arg) == 0 else arg[-1]\n for i in range(arg[-1], M + 1):\n dp(arg + [i])\n\ndp([])\n\... | ['Runtime Error', 'Accepted'] | ['s440555826', 's566788457'] | [9160.0, 22980.0] | [23.0, 1305.0] | [511, 519] |
p02695 | u727980193 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\nN,M,Q=list(map(int,input().split()))\nsrc=[list(map(int,input().split())) for q in range(Q)]\nML=[n+1 for n in range(M)]\nX=list(itertools.combinations_with_replacement(ML,N))\nL=[]\nfor x in X:\n a=0\n for s in src:\n if x[s[1]] - x[s[0]] == s[2]:\n a+=s[3]\n L.append(a)\nprint(max(L))',... | ['Runtime Error', 'Accepted'] | ['s911607175', 's639395796'] | [21544.0, 25352.0] | [45.0, 976.0] | [304, 324] |
p02695 | u731028462 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N,M,Q = list(map(int, input().split()))\nC = []\nfor i in range(Q):\n C.append(list(map(int, input().split())))\n \nimport itertools\nres = 0\nls=list(range(1,M+1))\nfor a in itertools.combinations_with_replacement(ls, N):\n p = 0\n for c in C:\n if a[c[1]]-a[c[0]]==c[2]:\n p += c[3]\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s242940460', 's342775919', 's206169162'] | [9220.0, 9220.0, 9240.0] | [18.0, 22.0, 1811.0] | [338, 341, 342] |
p02695 | u735891571 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\nN, M, Q = map(int,input().split())\nABCD = [tuple(map(int, input().split())) for _ in range(Q)]\nans = 0\nfor s in itertools.combinations_with_replacement(range(1,N+1),N):\n temp = 0\n for i in range(Q):\n if s[ABCD[i][1]-1] - s[ABCD[i][0]-1] == ABCD[i][2]:\n temp += ABCD[i][... | ['Wrong Answer', 'Accepted'] | ['s657358777', 's066858495'] | [9084.0, 9212.0] | [1375.0, 1284.0] | [347, 347] |
p02695 | u736470924 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n, m, q = map(int, input().split())\nI = list(range(1, m + 1))\nA = list(map(list, itertools.combinations(I, n)))\nl = len(A)\nans = [0 for i in range(l)]\nfor _ in range(q):\n a, b, c, d = map(int, input().split())\n for i in range(l):\n if A[i][b - 1] - A[i][a - 1] == c:\n ans[i] += d\nprint... | ['Runtime Error', 'Accepted'] | ['s531141048', 's483366619'] | [9208.0, 26340.0] | [24.0, 1064.0] | [318, 354] |
p02695 | u736641785 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['from itertools import combinations_with_replacement\n\nn, m, q = list(map(int,input().split()))\nA = [list(map(int,input().split())) for i in range(q)]\ndef keisan(tup):\n ans_keisan = 0\n print(tup)\n for j in A:\n if tup[j[1]-1] - tup[j[0]-1] == j[2]:\n ans_keisan += j[3]\n return ans_... | ['Wrong Answer', 'Accepted'] | ['s844477416', 's129246998'] | [9068.0, 9204.0] | [787.0, 676.0] | [415, 400] |
p02695 | u740267532 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\nN, M, Q = map(int,input().split())\nL = []\nfor _ in range(Q):\n L.append(list(map(int,input().split())))\n\nA = itertools.combinations_with_replacement([i for i in range(1,M+1)], N)\ncount = []\nfor a in A:\n temp = 0\n for l in l:\n if a[l[1]-1] - a[l[0]-1] == l[2]:\n te... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s537876284', 's980205473', 's166401395'] | [9108.0, 9100.0, 12524.0] | [23.0, 20.0, 1062.0] | [357, 357, 357] |
p02695 | u744920373 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ["import sys\nsys.setrecursionlimit(10**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]\ndef dp2(ini, i, j): return ... | ['Runtime Error', 'Accepted'] | ['s063666743', 's352413990'] | [9284.0, 12504.0] | [22.0, 831.0] | [1405, 1413] |
p02695 | u745514010 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import bisect\n\ndef lis(lst):\n lis_lst = [lst[0]]\n for i in lst:\n if i > lis_lst[-1]:\n lis_lst.append(i)\n else:\n lis_lst[bisect.bisect_left(lis_lst, i)] = i\n return len(lis_lst)\n\nn = int(input())\n\na = list(map(int, input().split()))\n\nuv = {}\nfor _ in range(n... | ['Runtime Error', 'Accepted'] | ['s297927508', 's550324679'] | [9156.0, 9072.0] | [20.0, 1011.0] | [529, 396] |
p02695 | u747703115 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import sys\nreadline = sys.stdin.readline\n\ndef score(A):\n t = 0\n for ai,bi,ci,di in zip(a,b,c,d):\n if A[bi]-A[ai]==ci:\n t += di\n return t\n\ndef dfs(A):\n if len(A)==n:\n return score(A)\n ans = 0\n prev_last = A[-1] if len(A)>0 else 0\n for v in range(prev_last, m... | ['Runtime Error', 'Accepted'] | ['s534604493', 's708627554'] | [8980.0, 9256.0] | [24.0, 559.0] | [578, 629] |
p02695 | u752907966 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n,m,q=map(int,input().split())\nli=[list(map(int,input().split()))for _ in range(q)]\nans = 0\ndef dfs(i,A):\n global ans \n if i == m:\n return\n tmp = 0\n for a,b,c,d in li:\n if A[b-1] - A[a-1] == c:\n tmp += d \n ans = max(ans,tmp)\n tmp = A[:]\n for j in range(n):\n ... | ['Wrong Answer', 'Accepted'] | ['s339854382', 's722925928'] | [9228.0, 9132.0] | [2205.0, 1069.0] | [422, 379] |
p02695 | u756518877 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['# -*- coding: utf-8 -*-\nfrom itertools import itertools.combinations_with_replacement\nN,M,Q=map(int,input().split())\nabcd=[]\nfor _ in range(Q):\n abcd.append(tuple(map(int,input().split())))\nAbase=[]\nfor a in range(1,M+1):\n Abase=Abase+[a]\nA=set(itertools.combinations_with_replacement(Abase,N))\nans=0\n... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s283762434', 's512614914', 's895966471', 's007670903'] | [9016.0, 9080.0, 9148.0, 25308.0] | [21.0, 22.0, 22.0, 970.0] | [459, 446, 446, 422] |
p02695 | u761087127 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['from itertools import combinations_with_replacement\nN, M, Q = [int(n) for n in input().split()]\nX = [[int(n) for n in input().split()] for _ in range(Q)]\nans = []\nfor A in combinations_with_replacement(range(1, M+1), N):\n t = 0\n for x in X:\n if A[x[1]-1]-A[x[0]-1] == x[2]:\n t += x[3]\n... | ['Wrong Answer', 'Accepted'] | ['s480874286', 's616970309'] | [12544.0, 9208.0] | [1137.0, 422.0] | [359, 441] |
p02695 | u762540523 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ["def resolve():\n n, m, q = map(int, input().split())\n queue = []\n for i in range(q):\n queue.append(list(map(int, input().split())))\n ans = 0\n import itertools\n l = list(itertools.combinations(range(1, n + m), m))\n for i in l:\n a = [x - y for y, x in enumerate(i)]\n x ... | ['Runtime Error', 'Accepted'] | ['s814713325', 's545287196'] | [21480.0, 9216.0] | [760.0, 739.0] | [496, 490] |
p02695 | u764215612 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['a, b, n = map(int, input().split())\nans = 0\ns = max(int(b/a),e-1000)\ne = min(n+1,b)\nfor i in range(s, e):\n x = (int(a*i/b)-a*int(i/b))\n if ans < x:\n ans = x\nprint(ans)', 'n, m, q = map(int, input().split())\na = [0]*q\nb = [0]*q\nc = [0]*q\nd = [0]*q\nfor i in range(q):\n a[i], b[i], c[i], d[i] = map(in... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s108191939', 's298714029', 's473762506', 's666568600', 's645338397'] | [9188.0, 9164.0, 9176.0, 9224.0, 9308.0] | [22.0, 62.0, 60.0, 231.0, 398.0] | [172, 834, 834, 1695, 848] |
p02695 | u764956288 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['from itertools import combinations_with_replacement\n\n\ndef main():\n n_ints, max_int, n_queries = map(int, input().split())\n\n queries = (list(map(int, input().split())) for _ in range(n_queries))\n\n possible_sequences = combinations_with_replacement(range(1, max_int+1), n_ints)\n\n max_score = 0\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s362770461', 's891650293', 's594859677'] | [9224.0, 9216.0, 9260.0] | [45.0, 577.0, 603.0] | [613, 613, 659] |
p02695 | u772029934 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N,M,Q = map(int,input().split())\nli = []\ncounter = 0\nn = []\nfor s in range(Q):\n li.append(list(map(int,input().strip())))\n\nfor i in range(10**(N-1),10**N):\n k = str(i)\n for q in range(Q):\n if k[li[q][1]] - k[li[q][0]] == k[li[q][2]]:\n counter += k[li[q][3]]\n n.append(counter)\n counter... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s262912029', 's426593393', 's362127838'] | [9216.0, 9148.0, 12520.0] | [22.0, 20.0, 1195.0] | [323, 320, 381] |
p02695 | u797572808 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools as it\n\nn,m,q = map(int,input().split())\n\nar = [[0]*4]*q\n\nfor i in range(q):\n ar[i] = [int(s) for s in input().split()]\n\nA = it.combinations_with_replacement(list(range(1,m+1)),n)\nmx = 0\n\nfor cnd in A:\n mx_tmp=0\n for i in range(q):\n if(A[ar[i][1]-1] - A[ar[i][0]-1] == ar... | ['Runtime Error', 'Accepted'] | ['s059745866', 's836741663'] | [9224.0, 21476.0] | [22.0, 1403.0] | [377, 387] |
p02695 | u802234211 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools as itr\nN,M,Q = map(int,input().split())\nsheat = list()\nfor i in range(Q):\n sheat.append(list(map(int,input().split())))\n\ncomb = tuple(itr.combinations(range(1,M+1),N))\nMaxsum = 0\nprint(sheat)\nprint(comb)\nsumd = 0\nfor i in range(len(comb)):\n ansum = 0\n for j in range(Q):\n ... | ['Wrong Answer', 'Accepted'] | ['s211446346', 's787214811'] | [9184.0, 21772.0] | [24.0, 1596.0] | [791, 812] |
p02695 | u829203929 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['# coding: utf-8\nimport itertools\ndef main():\n n, m, q = map(int, input().split())\n matrix = []\n for _ in range(q):\n row = list(map(int, input().split()))\n matrix.append(row)\n # print(matrix)\n A = list(range(1, m))\n ans = 0\n for tmp_A in itertools.combinations_with_replace... | ['Wrong Answer', 'Accepted'] | ['s357323572', 's120262809'] | [9124.0, 9124.0] | [350.0, 702.0] | [681, 683] |
p02695 | u833738197 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['#166d\nx = int(input())\nfor i in range(-73,73):\n for j in range(-73,73):\n print(i,j)\n if i**5-j**5==x:\n a = i\n b = j\n break\n \nprint(a,b)', 'from itertools import combinations_with_replacement\n\nn,m,q = map(int,input().split())\ns_list = [list(map(int,... | ['Runtime Error', 'Accepted'] | ['s187112020', 's665312233'] | [9072.0, 9192.0] | [20.0, 975.0] | [192, 340] |
p02695 | u842388336 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\n\nn,m,q = map(int, input().split())\nlist_ = [list(map(int, input().split())) for _ in range(q)]\ntmp = list(range(1,m+1))\ncases = [sorted(list(arr)) for arr in itertools.product(tmp, repeat=n)]\n\nmax_score = 0\nvisited = set()\nfor arr in cases:\n score = 0\n if str(arr) in visited:\n break\... | ['Wrong Answer', 'Accepted'] | ['s492703851', 's162268043'] | [510204.0, 23900.0] | [2218.0, 1107.0] | [480, 531] |
p02695 | u854685063 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['4 6 10\n2 4 1 86568\n1 4 0 90629\n2 3 0 90310\n3 4 1 29211\n3 4 3 78537\n3 4 2 8580\n1 2 1 96263\n1 4 2 2156\n1 2 0 94325\n1 4 3 94328', 'import sys\nimport math\ndef I():return int(sys.stdin.readline().replace("\\n",""))\ndef I2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef S():return str(sys... | ['Runtime Error', 'Accepted'] | ['s370842437', 's814664538'] | [8984.0, 12728.0] | [24.0, 726.0] | [124, 898] |
p02695 | u857293613 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import sys\nn, m, q = map(int, input().split())\nalis, blis, clis, dlis = [], [], [], []\nfor _ in range(q):\n a, b, c, d = map(int, input().split())\n alis.append(a)\n blis.append(b)\n clis.append(c)\n dlis.append(d)\nsys.setrecursionlimit(10**9)\nAlist = [] \ndef dfs(A):\n if len(A)==(n+1):\n ... | ['Runtime Error', 'Accepted'] | ['s855528615', 's081859249'] | [637196.0, 24300.0] | [701.0, 1078.0] | [591, 575] |
p02695 | u859987056 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N,M,Q = map(int,input().split())\na = [0]*Q\nb = [0]*Q\nc = [0]*Q\nd = [0]*Q\nfor i in range(Q):\n a[i],b[i],c[i],d[i] = map(int,input().split())\n a[i] -= 1 \n b[i] -= 1 \n\ndef score(A):\n score = 0\n for ai, bi, ci, di in zip(a, b, c, d):\n if A[bi] - A[ai] == ci:\n score += ci\n... | ['Wrong Answer', 'Accepted'] | ['s427180105', 's079306677'] | [9144.0, 9220.0] | [563.0, 562.0] | [598, 598] |
p02695 | u860002137 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import numpy as np\nimport itertools\n\nn, m, q = map(int, input().split())\na = np.zeros(q, type=int)\nb = np.zeros(q, type=int)\nc = np.zeros(q, type=int)\nd = np.zeros(q, type=int)\n\nfor i in range(q):\n a[i], b[i], c[i], d[i] = map(int, input().split())\n\nA = np.array(list(itertools.combinations_with_replace... | ['Runtime Error', 'Accepted'] | ['s553629103', 's913609887'] | [27128.0, 21616.0] | [104.0, 1373.0] | [514, 429] |
p02695 | u861141787 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n, m, q = map(int, input().split())\n\na = [0] * 55; b = [0] * 55; c = [0] * 55; d = [0] * 55\n\nfor i in range(q):\n a[i], b[i], c[i], d[i] = map(int, input().split())\n\ndef socer(A):\n now = 0\n for i in range(q):\n if A[b[i]-1] - A[a[i]-1] == c[i]: now += d[i]\n return now\n\ndef dfs(A):\n p... | ['Wrong Answer', 'Accepted'] | ['s989784434', 's106423457'] | [9212.0, 9156.0] | [976.0, 806.0] | [521, 523] |
p02695 | u861886710 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N, M, Q = list(map(int, input().split()))\na = []\nb = []\nc = []\nd = []\ndd = 0\nfor i in range(Q):\n t = list(map(int, input().split()))\n a.append(t[0])\n b.append(t[1])\n c.append(t[2])\n d.append(t[3])\n if t[1] - t[0] == t[3]:\n dd += t[4]\n\nprint(dd)\n ', 'N, M, Q = map(int, input... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s256405972', 's700567314', 's748837529', 's861973647', 's084905307'] | [9120.0, 9248.0, 9152.0, 9168.0, 9256.0] | [23.0, 983.0, 24.0, 23.0, 1012.0] | [274, 1207, 994, 1207, 1007] |
p02695 | u870736713 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\n \nN,M,Q=map(int,input().split())\nall=[]\n \nfor i in range(Q):\n all.append(list(map(int,input().split())))\n#print(all)\n#print(len(all))\n#print(all[0][1])\n \nx=sorted([i for i in range(1,M+1)])\nmaxdsum=0\n \n \nfor A in itertools.combinations_with_replacement(x, N):\n dsum=0\n "print("A=="... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s457496086', 's985981290', 's484530169'] | [8760.0, 8964.0, 9096.0] | [24.0, 22.0, 1316.0] | [462, 379, 380] |
p02695 | u870841038 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N, M, Q = map(int, input().split())\nb = [list(map(int, input().split())) for _ in range(Q)]\nans = 0\n\nimport itertools\na = range(1, M+1)\nfor set_A in itertools.combinations_with_replacement(a, N):\n A = list(set_A)\n print(A)\n n = 0\n for i in range(Q):\n if A[b[i][1]-1] - A[b[i][0]-1] == b[i... | ['Wrong Answer', 'Accepted'] | ['s101979258', 's960864985'] | [9220.0, 9212.0] | [1444.0, 1305.0] | [370, 357] |
p02695 | u878129968 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n, m, q = map(int, input().split())\na = [0] * q\nb = [0] * q\nc = [0] * q\nd = [0] * q\nfor i in range(q):\n a[i], b[i], c[i], d[i] = map(int,input().split())\nA_list = []\nfor p in itertools.combinations_with_replacement(range(1,m+1),n):\n A_list.append(p)\n# print(A_list)\n\nans = 0\nfor v in A_list:\n cu... | ['Runtime Error', 'Accepted'] | ['s262833639', 's974604256'] | [9232.0, 21736.0] | [23.0, 1135.0] | [450, 467] |
p02695 | u881195671 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import numpy as np\nimport itertools\n\n\nN, M, Q = map(int, input().split(" "))\n\nvals = []\nfor i in range(Q):\n vals.append([list(map(int, input().split(" ")))])\n \nmaxv = 0\ncand = list(itertools.combinations_with_replacement(range(1, M+1), N))\nfor c in cand:\n sumv = 0\n for v in vals:\n if... | ['Runtime Error', 'Accepted'] | ['s532514224', 's703140718'] | [39580.0, 39508.0] | [122.0, 1187.0] | [413, 411] |
p02695 | u892308039 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['from itertools import combinations\nN, M, Q = map(int,input().split())\nP = [list(map(int,input().split())) for i in range(Q)]\n\nA = list(itertools.combinations(range(1,M+1), 3))\nnumber = len(A)\n\namount = 0\nmax_amount = 0\nfor i in range(number): # 0,1,2,3 A\n for j in range(Q): # 0,1,2\n bi = P[j][1]\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s089441867', 's527558039', 's625259150', 's412325177'] | [9168.0, 9164.0, 9212.0, 21624.0] | [20.0, 21.0, 20.0, 1827.0] | [539, 553, 567, 549] |
p02695 | u894265012 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ["mport itertools\ndef main():\n N, M, Q = map(int, input().split())\n abcd = []\n for _ in range(Q):\n a, b, c, d = map(int, input().split())\n abcd.append((a-1, b-1, c, d))\n score = 0\n for ones in list(itertools.combinations([i for i in range(N+M-1)], M-1)):\n temp = [0] * (N + M... | ['Runtime Error', 'Accepted'] | ['s256494698', 's795215393'] | [8876.0, 19880.0] | [22.0, 589.0] | [873, 873] |
p02695 | u909991537 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N, M, Q = (int(i) for i in input().split()) \nABCD = []\nans = -1\n\nfor _ in range(Q):\n ABCD.append([int(i) for i in input().split()] )\n\ncomb_list = []\n\nimport sys\nsys.setrecursionlimit(100000000)\ndef recur(N, lis, c):\n if len(lis) == N:\n comb_list.append(lis)\n return\n\n if lis == []:\n for i... | ['Wrong Answer', 'Accepted'] | ['s794087754', 's956379884'] | [23044.0, 22912.0] | [1110.0, 1098.0] | [609, 603] |
p02695 | u910426639 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N, M, Q = map(int, input().split())\n\nquery = []\nfor i in range(Q):\n a, b, c, d = map(int, input().split())\n query.append([a, b, c, d])\n\n\ndef calcPoint(num):\n ret = 0\n for q in range(Q):\n if num[query[q][1] - 1] - num[query[q][0] - 1] == query[q][2]:\n ret += query[q][3]\n\n ... | ['Wrong Answer', 'Accepted'] | ['s825326455', 's727544264'] | [9280.0, 9224.0] | [640.0, 532.0] | [605, 607] |
p02695 | u915879510 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['#!/usr/bin/env python3\nimport sys\nimport numpy as np\nfrom itertools import *\n\n\ndef solve(N: int, M: int, Q: int, a: "List[int]", b: "List[int]", c: "List[int]", d: "List[int]"):\n l = [i for i in range(1,M+1)]\n A = []\n if N==M:\n A.append(l)\n else:\n for v in combinations_with_repla... | ['Wrong Answer', 'Accepted'] | ['s945214411', 's097020290'] | [28312.0, 27180.0] | [910.0, 811.0] | [1619, 1465] |
p02695 | u917558625 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\ns=list(map(int,input().split()))\nt=[list(map(int,input().split())) for i in range(s[2])]\nli=[x for x in range(1,s[0]+1)]\nlity=list(itertools.combinations_with_replacement(li,s[0]))\nans=0\nfor k in lity:\n vmax=0\n for l in t:\n if k[l[1]-1]-k[l[0]-1]==l[2]:\n vmax+=l[3]\n ans=max(ans,... | ['Wrong Answer', 'Accepted'] | ['s075025592', 's444835046'] | [21452.0, 21584.0] | [904.0, 1011.0] | [323, 323] |
p02695 | u923172145 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['def next_array(array):\n\ts = -1\n\tfor x in array[::-1]:\n \tif x < M:\n \tbreak\n else:\n \ts -= 1\n \n \n if s >= -N:\n \tarray[s] += 1\n \tif s < -1:\n \t\tfor i in range(s+1,0):\n \t\t\tarray[i] = array[s]\n \n\treturn array\n \ndef score(array, rules):\n\t... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s092365237', 's110686579', 's278756371', 's291678325', 's483796587', 's590610175', 's593674463', 's604184988', 's629304803', 's815000082', 's932598516', 's408648845'] | [9000.0, 9240.0, 9012.0, 9248.0, 9152.0, 9116.0, 8940.0, 9044.0, 8904.0, 8948.0, 8948.0, 9252.0] | [22.0, 839.0, 24.0, 2205.0, 2206.0, 878.0, 23.0, 23.0, 26.0, 24.0, 24.0, 737.0] | [916, 905, 916, 928, 897, 908, 901, 902, 900, 892, 895, 891] |
p02695 | u932868243 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import math\nn,m,q=map(int,input().split())\nabcd=[list(map(int,inpt().split())) for _ in range(q)]\nsumlist=[]\nfor A in math.combinations_with_replacement(range(1,m+1),n)\n sum=0\n for a,b,c,d in abcd:\n if A[b-1]-A[a-1]==c:\n sum+=d\n sumlist.append(sum)\nprint(max(sumlist))\n ', 'import itertool... | ['Runtime Error', 'Accepted'] | ['s780319762', 's389273248'] | [9028.0, 73908.0] | [24.0, 1462.0] | [288, 300] |
p02695 | u935642171 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n, m, q = map(int, input().split())\nabcd = [list(map(int, input().split())) for _ in range(q)]\na,b,c,d = [],[],[],[]\nfor i in range(q):\n a.append(abcd[i][0])\n b.append(abcd[i][1])\n c.append(abcd[i][2])\n d.append(abcd[i][3])\n\ndef score(A):\n tmp = 0\n for ai, bi, ci, di in zip(a, b, c, d):\n if A[b... | ['Wrong Answer', 'Accepted'] | ['s520297702', 's349647966'] | [9196.0, 9236.0] | [765.0, 560.0] | [539, 528] |
p02695 | u941644149 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ["N, M, Q = map(int, input().split())\nmax_n = 0\n\n\nA_list = []\nN=2\nfor i in range(10**(N-1),10**N):\n #A = [int(x) for x in list(str(i))]\n #A_replace = [int(str(a).replace('0', '10')) for a in A]\n \n A_list.append(sorted(str(i)))\nabcd_list = []\nfor q in range(Q):\n abcd_list.append(list(map(int,... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s195333487', 's605934639', 's900115193', 's481155056'] | [9224.0, 9160.0, 9232.0, 9196.0] | [24.0, 21.0, 21.0, 929.0] | [595, 329, 590, 346] |
p02695 | u961288441 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\nN, M, Q = map(int, input().split())\na = [int(input()) for _ in range(Q)]\nb = [int(input()) for _ in range(Q)]\nc = [int(input()) for _ in range(Q)]\nd = [int(input()) for _ in range(Q)]\nfor i in range (Q):\n a[i], b[i], c[i], d[i] = map(int, input().split())\nans = 0\nfor A in combinations_wi... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s772458836', 's839434240', 's055052395'] | [9204.0, 9224.0, 9220.0] | [24.0, 24.0, 1104.0] | [478, 370, 379] |
p02695 | u966810027 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N,M,Q = gets.split.map(&:to_i)\na = []\nb = []\nc = []\nd = []\nQ.times do |i|\n a[i], b[i], c[i], d[i] = gets.split.map(&:to_i)\n a[i] -= 1\n b[i] -= 1\nend\n\ndef score(array,a,b,c,d)\n tmp = 0\n for ai,bi,ci,di in a.zip(b,c,d)\n tmp += di if array[bi] - array[ai] == ci\n end\n tmp\nend\n\ndef dfs(array,a... | ['Runtime Error', 'Accepted'] | ['s560412731', 's284857191'] | [8944.0, 9200.0] | [22.0, 561.0] | [594, 694] |
p02695 | u968404618 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n, m, q = map(int, input().split())\nA, B, C, D = [0]*q, [0]*q, [0]*q, [0]*q\nfor i in range(q):\n A[i], B[i], C[i], D[i] = map(int, input().split())\n\na = [1]\nans = 0\ndef dfs(a):\n global ans\n if len(a) == n+1:\n now = 0\n for i in range(q):\n if a[B[i]] - a[A[i]] == C[i]:\n ... | ['Wrong Answer', 'Accepted'] | ['s135720584', 's120961734'] | [9192.0, 9200.0] | [22.0, 679.0] | [466, 480] |
p02695 | u973549339 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['n, m, q = map(int, input().split())\nabcd = [list(map(int, input().split())) for i in range(q)]\nimport itertools\n\nA = []\nM = []\nfor i in range(1, m+1):\n M.append(i)\nfor team in itertools.combinations(M, n):\n A.append(team)\n \nB = [0]*len(A)\nfor i in range(q):\n a = abcd[i][0]\n b = abcd[i][1]... | ['Wrong Answer', 'Accepted'] | ['s429486372', 's332788420'] | [9216.0, 25076.0] | [21.0, 1027.0] | [441, 465] |
p02695 | u973972117 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['mport itertools\n \nN, M, Q = map(int, input().split())\nc = [list(map(int, input().split())) for _ in range(Q)]\n \ndef score(seq):\n s = 0\n for q in range(Q):\n if seq[c[q][1]-1] - seq[c[q][0]-1] == c[q][2]:\n s += c[q][3]\n return s\n \np = [i for i in range(1, M+1)]\nA = itertools.combinations_with_re... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s292266457', 's974248316', 's123194695'] | [8948.0, 9008.0, 9072.0] | [25.0, 19.0, 956.0] | [378, 388, 389] |
p02695 | u980205854 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['# C - Many Requirements\nN,M,Q = map(int,input().split())\nq = []\nfor i in range(Q):\n q.append(list(map(int,input().split())))\nq.sort()\ndp = [[0]*(M+1) for _ in range(N+1)]\nfor a,b,c,d in q:\n for i in range(1,M-c+1):\n dp[b][i+c] = max(dp[b][i+c],dp[a][i]+d)\nprint(max(max(dp)))', '# C - Many Requi... | ['Wrong Answer', 'Accepted'] | ['s737580476', 's258920746'] | [9116.0, 16228.0] | [24.0, 610.0] | [288, 489] |
p02695 | u991619971 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['A,B,N = map(int,input().split())\n#N=int(input())\n#A = list(map(int,input().split()))\n#S=str(input())\nm=0\nif B<N:\n N=B\ns=int(B/A)\nif s>N:\n print(0)\n exit()\nfor x in range(s,N+1,s):\n num=int(A*x/B) - A * int(x/B)\n\n m=max(num,m)\n\nprint(m)\n', 'import itertools\n#K = int(input())\nN,M,Q = m... | ['Runtime Error', 'Accepted'] | ['s778392038', 's832757034'] | [9192.0, 9208.0] | [23.0, 970.0] | [251, 439] |
p02695 | u992471673 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import sys\nn,m,q=map(int,input().split())\n\n\na=[]\nb=[]\nc=[]\nd=[]\nfor i in range(0,q):\n ay,by1,cy,dy=map(int,input().split())\n a.append(ay)\n b.append(by1)\n c.append(cy)\n d.append(dy)\ns=0\nsmax=-100\n\nsys.setrecursionlimit(3000)\n\n\n\ndef dfs(h):\n global smax\n if len(h)==n+1:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s313647704', 's500008024', 's544706589'] | [9160.0, 9192.0, 9172.0] | [342.0, 2206.0, 696.0] | [592, 627, 594] |
p02695 | u994935583 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['\n\nimport itertools\nimport numpy as np\n\ndef resolve():\n N,M,Q = map(int,input().split())\n A = np.array(list(itertools.combinations_with_replacement(range(1,M+1),N)))\n s = np.zeros(len(A), np.int32)\n\n for i in range(Q):\n a,b,c,d = map(int,input().split()) \n s += d * (A[:,b-1] - A[:... | ['Wrong Answer', 'Accepted'] | ['s351878274', 's261890178'] | [27136.0, 46776.0] | [108.0, 234.0] | [399, 408] |
p02695 | u995062424 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['N, M, Q = map(int, input().split())\n\nA = []\nfor i in range(Q):\n A.append(list(map(int, input().split())))\n\nsA = sorted(A, key=lambda x:x[3], reverse=True)\n\nans = 0\nfor i in range(Q):\n cnt = 0\n num = 0\n tmp = [-1]*N\n tmp[sA[i][1]-1] = tmp[sA[i][0]-1]+sA[i][2]\n num += sA[i][3]\n cnt +... | ['Wrong Answer', 'Accepted'] | ['s162427361', 's355809792'] | [9284.0, 21368.0] | [21.0, 1326.0] | [743, 456] |
p02695 | u996665352 | 2,000 | 1,048,576 | Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ). Consider a sequence A satisfying the following conditions: * A is a sequence of N positive integers. * 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M. Let us define a score of this sequence as follows: * The score is ... | ['import itertools\nn,m,q=map(int,input().split())\nqs = [list(map(int,input().split())) for i in range(q)]\nmids = [i for i in range(m)]\n# print(nums)\nmax_ans= 0\nfor mid in itertools.combinations_with_replacement(nums, n-1):\n if sum(mid)>m-1:\n continue\n sum_ans=0\n for i in qs:\n sum_mid =... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s544911669', 's722860034', 's773382198'] | [9200.0, 9228.0, 9136.0] | [25.0, 22.0, 938.0] | [511, 510, 364] |
p02696 | u003034853 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['from math import floor\ndef seq(a, b, x):\n return int(floor((a*x)/b)) - int(a*floor(x/b))\nma = 0\na, b, n = map(int, input().split())\nfor i in range(int(1e6)+1):\n ma = max(ma, seq(a, b, i))\nprint(ma)', 'from math import floor\ndef seq(a, b, x):\n return int(floor((a*x)/b)) - int(a*floor(x/b))\nma = 0\na... | ['Wrong Answer', 'Accepted'] | ['s141664772', 's316015609'] | [9056.0, 9212.0] | [694.0, 19.0] | [203, 352] |
p02696 | u005317312 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math as mt\nA,B,N = map(int,input().split())\nprint(math.floor((A*N)/B)-A*math.floor(N/B)', 'A,B,N = map(int,input().split())\ntmp=0\nfor i in range(N//2,N+1):\n floor = (A*i)//B-A*(i//B)\n if floor>tmp:\n tmp = floor\n print(tmp)\nprint(tmp)', 'import math as mt\nA,B,N = map(int,input().split(... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s224860899', 's652341020', 's722489311', 's373097535'] | [8896.0, 28140.0, 9108.0, 9188.0] | [22.0, 2264.0, 21.0, 24.0] | [94, 158, 95, 166] |
p02696 | u007128301 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ["s=input().split(' ')\nA,B,N=int(s[0]),int(s[1]),int(s[2])\n\ndef f(x):\n a=np.floor(A*x/B)-A*np.floor(x/B)\n return a.astype(int)\n\nif N<B-1:\n print(f(N))\nelse:\n print(f(B-1))\n", "import numpy as np\n\ns=input().split(' ')\nA,B,N=int(s[0]),int(s[1]),int(s[2])\n\ndef f(x):\n a=np.floor(A*x/B)-A*np.... | ['Runtime Error', 'Accepted'] | ['s140205070', 's728983753'] | [9032.0, 27136.0] | [20.0, 105.0] | [182, 202] |
p02696 | u007886915 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['# -*- coding: utf-8 -*-\nimport sys\nimport itertools\nimport fractions\nimport copy\nimport bisect\nimport math\nimport numpy as np\n\n\n#w=input()\nfrom operator import itemgetter\nfrom sys import stdin\n\nfrom operator import mul\nfrom functools import reduce\nfrom collections import Counter\n#from collections imp... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s854823496', 's859719694', 's874899815', 's878676829'] | [79992.0, 8996.0, 78516.0, 27080.0] | [2208.0, 24.0, 2208.0, 111.0] | [6800, 6800, 6799, 7166] |
p02696 | u009787707 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A,B,N=map(int,input().split())\nx=N\nans=(A*x/B)//1-A*(x//B)\nprint(ans)', 'A,B,N=map(int,input().split())\nif N<B:\n x=N\nelif N==B:\n x=N-1\nelse:\n x=(N//B)*B-1\nans=(A*x/B)//1-A*(x//B)\nprint(ans)', 'A,B,N=map(int,input().split())\nif N<B:\n x=N\nelif N==B:\n x=N-1\nelse:\n x=(N//B)*B-1\nans=(A*... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s033800291', 's120028380', 's183343222'] | [9104.0, 9080.0, 9236.0] | [26.0, 29.0, 26.0] | [69, 125, 130] |
p02696 | u010090035 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n=map(int,input().split())\n\ndef f(a,b,x):\n return (a*x)//b - a*(x//b)\n\nprint(f(min(b-1,n)))', 'a,b,n=map(int,input().split())\n\ndef f(x):\n return (a*x)//b - a*(x//b)\n\nprint(f(min(b-1,n)))'] | ['Runtime Error', 'Accepted'] | ['s005642057', 's167612660'] | [9088.0, 9144.0] | [25.0, 28.0] | [98, 94] |
p02696 | u012955130 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ["import math\n\ndef floor(A, B, x):\n return math.floor(A * x / B) - A * math.floor(x/B) \n\nA, B, N = map(int, input().split(' '))\n\nprint(max(floor(A,B,N), floor(A,B,B-1)))", "import math\n\nA, B, N = map(int, input().split(' '))\n\n_max = 0\nfor x in range(N, N -10, -1):\n \n num =math.floor(A * x / B) - ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s585551516', 's767973488', 's572353358'] | [9108.0, 9076.0, 9072.0] | [21.0, 21.0, 23.0] | [170, 219, 165] |
p02696 | u017415492 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\na,b,n=map(int,input().split())\n\nprint(math.floor((b-1)*a/b))', 'import math\na,b,n=map(int,input().split())\nif n>b-1:\n print(math.floor((b-1)*a/b))\nelse:\n print(math.floor((n*a/b)))'] | ['Wrong Answer', 'Accepted'] | ['s417663984', 's176176547'] | [9144.0, 9172.0] | [22.0, 21.0] | [72, 118] |
p02696 | u020962106 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\na,b,n = map(int,input().split())\nm = 0\nx = 1\nax = a*x\nwhile ax/b <0.01:\n x*=10\n ax = a*x\n if x>n:\n x//10\n break\nif a-b==1:\n print(n)\nelif b-a==1:\n print(n-1)\nelse:\n for i in range(x,n+1):\n if i==b-1:\n ch = (a*i//b)-a*(i//b)\n p... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s158527524', 's760071587', 's948057509'] | [9140.0, 9156.0, 9092.0] | [2205.0, 21.0, 23.0] | [325, 50, 102] |
p02696 | u022658079 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A,B,N= list(map(int, input().split()))\nprint(min(B-1,N))', 'A,B,N= list(map(int, input().split()))\nma=0\nfor i in range(min(N,B)+1,1):\n a=int(A*i/B)-A*int(i/B)\n if(a<=A):\n \tif(ma<a):\n \tma=a\n break\nprint(ma)', 'A,B,N= list(map(int, input().split()))\nma=0\nfor i in range(1,min(N,B)... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s416430276', 's457036309', 's810247895', 's214813449'] | [9048.0, 8912.0, 9380.0, 9164.0] | [24.0, 21.0, 2235.0, 23.0] | [56, 172, 177, 85] |
p02696 | u026862065 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, x = map(int, input())\nprint(b - 1)', 'a, b, x = map(int, input().split())\nprint(a * (b - 1) // b)', 'a, b, x = map(int, input())\nprint(a * (b - 1) // b)', 'a, b, n = map(int, input().split())\nprint(a * min(n, b - 1) // b)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s134747772', 's400058270', 's820455077', 's248719896'] | [9096.0, 9152.0, 9084.0, 9160.0] | [24.0, 22.0, 19.0, 21.0] | [40, 59, 51, 65] |
p02696 | u028014940 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import numpy as np\na,b,n=map(int,input().split())\n\nx=np.arange(1,n+1)\n\ns1=np.floor((a/b)*x)\ns2=a*np.floor(x/b)\ns=s1-s2\nprint(np.max(s))', 'a, b, n = list(map(int, input().split()))\nx = min(b - 1, n) \nans = int(a * x / b)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s813949179', 's159658255'] | [27440.0, 9084.0] | [103.0, 24.0] | [135, 138] |
p02696 | u028554976 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int, input().split())\nprint(int((a*(max(n,b-1)%b)-(a*max(n,b-1))%b)/b))\n', 'a, b, n = map(int, input().split())\nprint((a*(max(n,b-1)%b)-(a*max(n,b-1))%b)/b)', 'a, b, n = map(int, input().split())\nprint(int((a*(min(n,b-1)%b)-(a*min(n,b-1))%b)/b))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s339459279', 's956606150', 's554319873'] | [9080.0, 9076.0, 9152.0] | [27.0, 26.0, 27.0] | [86, 80, 86] |
p02696 | u028973125 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import sys\nimport math\nfrom pprint import pprint\n\nA, B, N = map(int, sys.stdin.readline().strip().split())\n\ndef func(x):\n return math.floor(A*x/B) - A*math.floor(x/B)\n\n\nright = N\nleft = 0\nwhile right - left > 5:\n mid_left = right//3+left*2//3\n mid_right = right*2//3+left//3\n \n if func(m... | ['Wrong Answer', 'Accepted'] | ['s256212354', 's855991965'] | [9960.0, 9948.0] | [29.0, 27.0] | [573, 226] |
p02696 | u033287260 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ["import math\nA, B, N = map(int, input().split())\n\nfor i in range(N+1):\n num = math.floor(A*i/B) - A*math.floor(i/B)\n if num > maxnum:\n maxnum = num\n print(str(i) + ':' + str(num) + ' max is ' + str(maxnum))\nprint(maxnum)\n", 'import math\nA, B, N = map(int, input().split())\n\nnum = math.floor(... | ['Runtime Error', 'Accepted'] | ['s111806198', 's825474237'] | [9040.0, 9048.0] | [20.0, 21.0] | [236, 123] |
p02696 | u035453792 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n=map(int,input().split())\nif n>=b:\n x=b-1\n fl1=a*x//b\n fl2=a*(x//b)\nelse:\n fl1=a*(n//b)\n fl2=a*(n//b)\n \nans = fl1-fl2\nprint(ans)', 'a,b,n=map(int,input().split())\nif n>=b:\n x=b-1\n fl1=a*x//b\n fl2=a*(x//b)\nelse:\n fl1=a*n//b\n fl2=a*(n//b)\n \nans = fl1-fl2\nprin... | ['Wrong Answer', 'Accepted'] | ['s328041657', 's671896343'] | [9072.0, 8952.0] | [28.0, 31.0] | [151, 149] |
p02696 | u042113240 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A, B, N = input().split()\nA = float(A)\nB = float(B)\nN = float(N)\nimport math\nmax = 0\nx = B-1\nwhile x <= N:\n a = math.floor(A*x/B)-A*math.floor(x/B)\n if a > max:\n max = a\nprint(str(max))', 'A, B, N = input().split()\nA = float(A)\nB = float(B)\nN = float(N)\nimport math\nvalue = math.floor(A*(B-1)/B)\n... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s429471790', 's520780568', 's958140448'] | [8988.0, 9072.0, 9004.0] | [2205.0, 20.0, 22.0] | [190, 250, 195] |
p02696 | u048800107 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['\nfrom sys import stdin\ninput = stdin.readline\n\na,b,n = map(int,input().split())\n\nmaxpoint = 0\n\nfor i in reversed(range(n+1)):\n tmp = int((a * i) / b) - a * int(i/b) \n if i % (b-1) == 0 and b > 1:\n print(tmp) \n exit()\n maxpoint = max(tmp,maxpoint)\n\nprint(maxpoint)\n\n\n\n', 'from... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s007677794', 's029392867', 's154656696', 's380021491', 's497761752', 's909504753', 's318832038'] | [9108.0, 9132.0, 9088.0, 9044.0, 9200.0, 9324.0, 9188.0] | [2205.0, 2205.0, 22.0, 22.0, 22.0, 2214.0, 23.0] | [291, 353, 790, 803, 792, 612, 315] |
p02696 | u054825571 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A,B,N=map(int,input().split())\nif N>B:\n print((A*N)//B-A*(N//B))\nelse:\n print((A*(B-1)//B-A*((B-1)//B)))', 'A,B,N=map(int,input().split())\nif B>N:\n print((A*N)//B-A*(N//B))\nelse:\n print((A*(B-1)//B-A*((B-1)//B)))'] | ['Wrong Answer', 'Accepted'] | ['s735117051', 's270675997'] | [9104.0, 9048.0] | [27.0, 29.0] | [106, 106] |
p02696 | u057668615 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\nA, B, N = list(map(int, input().split()))\nans = 0\nif B+1 < N:\n C = B+1\nelse:\n C = N\nfor i in range(1, C+1):\n val = math.floor(A*i/B) - A*math.floor(i/B)\n print("i", i, "val", val)\n ans = max(ans, val)\n\nprint(ans)\n', 'import math\nA, B, N = list(map(int, input().split()))\nans =... | ['Wrong Answer', 'Accepted'] | ['s546265241', 's473218284'] | [26800.0, 9180.0] | [2248.0, 717.0] | [240, 376] |
p02696 | u064793078 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = [int(x) for x in input().split()]\n\n\nx = max(0,n-a-a-a-a)\n\ns = -a\n\nfor i in range(x,n+1):\n s = max(s,(a*i//b)-a*(i//b))\nfor i in range(b-1,b):\n s = max(s,(a*i//b)-a*(i//b))\n\n\nprint(s)\n', 'a, b, n = [int(x) for x in input().split()]\n\nn = min(n,b-1)\nx = max(0,n-a-a-a-a)\n\ns = -a\n\nfor ... | ['Wrong Answer', 'Accepted'] | ['s843176050', 's149829233'] | [9100.0, 9060.0] | [1856.0, 1859.0] | [199, 158] |
p02696 | u068944955 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A, B, N = map(int, input().split())\nfrom math import floor\n\nfor n in range(B-1, 0, -1):\n nB = n/B - floor(n/B)\n AnB = A * nB\n\n AnBf = floor(A*n/B) - A*n/B\n print(floor(A*n/B)-A*floor(n/B))\n exit()', 'A, B, N = map(int, input().split())\nfrom math import floor\nfrom math import gcd\nfrom math i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s238331435', 's366751884', 's064824986'] | [9132.0, 123928.0, 106304.0] | [22.0, 2255.0, 1647.0] | [211, 306, 284] |
p02696 | u075012704 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A, B, N = map(int, input().split())\n\ndef calc(x):\n return ((A * x) // B) - A * (x // B)\n\nprint(max(calc(N), calc(B - 1)))\n', 'A, B, N = map(int, input().split())\n\ndef calc(x):\n return ((A * x) // B) - A * (x // B)\n\nprit(max(calc(N), calc(B - 1)))\n', 'A, B, N = map(int, input().split())\n\ndef calc(x... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s422187839', 's739053510', 's819615897'] | [8992.0, 9168.0, 9156.0] | [20.0, 24.0, 22.0] | [125, 124, 150] |
p02696 | u075304271 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import numpy as np\nimport math\nimport scipy\nimport itertools\n\ndef score(arr):\n hoge = 0\n for ai,bi,ci,di in zip(a, b, c, d):\n if arr[bi-1]-arr[ai-1] == ci:\n hoge += di\n return hoge\n\ndef dfs(arr):\n if len(arr) == n:\n return score(arr)\n last = arr[-1] if len(arr) >... | ['Runtime Error', 'Accepted'] | ['s743877746', 's073509291'] | [31216.0, 31024.0] | [123.0, 123.0] | [727, 235] |
p02696 | u077003677 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ["import sys\nimport os\n\ndef file_input():\n f = open('../Beginner_Contest_165/input.txt', 'r')\n sys.stdin = f\n\ndef main():\n #file_input()\n # input()\n A,B,N=map(int, input().split())\n\n max=0\n # for x in range(N+1):\n \n \n # # ans=int(A*min)\n # # print(min)\n # ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s236935063', 's636594675', 's301278944'] | [9056.0, 9180.0, 9120.0] | [21.0, 23.0, 19.0] | [813, 529, 902] |
p02696 | u081784777 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int, input().split())\n \ntmp = 0\nfor x in (range(1, b+1, b): \n#for x in range(1, n+1):\n calc = a*x//b - a*(x//b)\n if calc > tmp:\n tmp = calc\n \nprint(tmp)', 'a, b, n = map(int, input().split())\n\ntmp = 0\nfor x in (range(1, b+1, b-1) if b<=n else range(1, n+1, n-1)):\n#for x in rang... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s433876337', 's826978867', 's903566203', 's747750533'] | [9044.0, 9112.0, 8956.0, 9192.0] | [25.0, 21.0, 24.0, 21.0] | [213, 219, 213, 213] |
p02696 | u087512063 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\ndef func(i):\n return math.floor(a * i * 1.0 / b) - a * math.floor(i * 1.0 / b);\n \na, b, n = map(int, input().split())\n \nprint (max(func(b), func(n))', 'a, b, n = map(int, input().split())\nx = min(n, b - 1)\nprint(int((a * x) / b) - a * int(x / b))'] | ['Runtime Error', 'Accepted'] | ['s099080579', 's166231872'] | [8908.0, 9156.0] | [21.0, 21.0] | [163, 94] |
p02696 | u090406054 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int, input().split())\nlist=[]\nfor x in range(n+1):\n q=x%b\n r=int(a*q)\n list.append(r)\nprint(max(list))\n ', 'import math\na, b, n = map(int, input().split())\n\nif n < b-1:\n x = n\nelse:\n x = b-1\n\nm = math.floor(a*x/b) - a*math.floor(x/b)\nprint(m)\n'] | ['Wrong Answer', 'Accepted'] | ['s263684673', 's915707561'] | [335660.0, 9052.0] | [2217.0, 26.0] | [122, 141] |
p02696 | u091051505 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int, input().split())\nprint(math.floor(a * min((b - 1), n) / b))', 'import math\na, b, n = map(int, input().split())\nprint(math.floor(a * min((b - 1), n) / b))'] | ['Runtime Error', 'Accepted'] | ['s262548184', 's313381665'] | [9104.0, 9008.0] | [19.0, 21.0] | [78, 90] |
p02696 | u092387689 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n = map(int,input().split())\nma = -1\nfor x in range(0,b):\n ans = ((a*x)//b) - (a * (x//b))\n print((a * (x//b)))\n if(ans > ma):\n ma = ans\n print(x,ma)\nprint(ma)', 'a,b,n = map(int,input().split())\nma = -1\n"""\nfor x in range(0,b):\n ans = ((a*x)//b) - (a * (x//b))\n print((... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s212760473', 's556667331', 's945412880', 's686109511'] | [10500.0, 9184.0, 9164.0, 9168.0] | [2219.0, 23.0, 2205.0, 25.0] | [187, 215, 154, 129] |
p02696 | u100277898 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\nA,B,N = map(int,input().split())\n\nans = 0\nfor x in range(1,N+1):\n a = math.floor(A*x/B)-A*math.floor(x/B)\n if ans < a:\n ans = a\nprint(ans)\n\nx=min(B-1,N)\nprint(math.floor(A*x/B)-A*math.floor(x/B))', 'import math\nA,B,N = map(int,input().split())\n\n\nx=min(B-1,N)\nprint(math.floor(A*x/B)-A*... | ['Wrong Answer', 'Accepted'] | ['s517642263', 's516262865'] | [8996.0, 9104.0] | [2205.0, 20.0] | [212, 102] |
p02696 | u100800700 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n = map(int,input().split())\nimport math\nif n < b:\n print(int(math.floor(a*n/b) - a*np.floor(n/b)))\nelse:\n print(int(math.floor(a*(b-1)/b) - a*np.floor((b-1)/b)))', 'a,b,n = map(int,input().split())\nimport math\nif n < b:\n print(int(math.floor(a*n/b) - a*math.floor(n/b)))\nelse:\n print(int(mat... | ['Runtime Error', 'Accepted'] | ['s520867690', 's315329815'] | [9192.0, 9000.0] | [20.0, 20.0] | [172, 176] |
p02696 | u102223485 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['# coding: utf-8\nA, B, N = map(int, input().split())\ndef calc(num):\n ans = A * num // B - A * num // B\n return ans\n\nprint(min(calc(B-1), calc(N)))', '# coding: utf-8\nA, B, N = map(int, input().split())\n\nnum = min(B-1, N)\n\nprint(A * num // B - A * (num // B))'] | ['Wrong Answer', 'Accepted'] | ['s290531979', 's017017542'] | [8928.0, 9100.0] | [24.0, 19.0] | [151, 108] |
p02696 | u106095117 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['\nA, B, N = map(int, input().split())\n\nx = min(B - 1, N)\nans = int(a * x / b)\nprint(ans)', '\nA, B, N = map(int, input().split())\n\nx = min(B - 1, N)\nans = int(A * x / B)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s306867107', 's948528533'] | [9028.0, 9088.0] | [23.0, 23.0] | [87, 87] |
p02696 | u106181248 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int,input().split())\n \nprint(max(int(a*(b-1)/b) - a*int((b-1)/b), int(a*n/b) - a*int(n/b)))', 'a, b, n = map(int,input().split())\n \nprint(int(a*min(b-1, n)/b) - a*int(min(b-1, n)/b))'] | ['Wrong Answer', 'Accepted'] | ['s269225822', 's540320388'] | [9184.0, 9168.0] | [21.0, 23.0] | [105, 87] |
p02696 | u110199424 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A, B, N = map(int, input().split())\n\ndef floor(x):\n out = (A * x)//B - A * (x//B)\n return out\n\nmax = 0\n\n #if(floor(i) > max):\n #max = floor(i)\nmax = max(floor(N), floor(B-1))\n\nprint(max)\n\n', 'A, B, N = map(int, input().split())\n\ndef floor(x):\n out = (A * x)//B - A * (x//B)\n ret... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s854058797', 's903175641', 's075911017'] | [9100.0, 9136.0, 9164.0] | [22.0, 22.0, 21.0] | [233, 276, 263] |
p02696 | u111652094 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\n\nA,B,N=map(int,input().split())\n\na=N//B\n\nif a==0:\n x=N\n \n\nelif N%B==0:\n x=a*B-1\nelse:\n x=B*a-1\n\nwhile math.floor(A*x/B)==math.floor(A*(x-1)/B):\n x=x-1\n if x==1:\n break\nans=math.floor(A*x/B)-A*math.floor(x/B)\nans=max(ans)\n\nprint(ans)\n', 'import math\n\ndef fl... | ['Runtime Error', 'Accepted'] | ['s926852152', 's763932475'] | [9120.0, 9164.0] | [1993.0, 24.0] | [270, 151] |
p02696 | u112247039 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int,input().split())\nx = min(n,b-1)\nprint(int(b*(x%b) / b))', 'result=[]; a,b,n = list(map(int,input().split()))\nfor x in range(n+1):\n result.append((math.floor(a*x/b))-(a*math.floor(x/b)))\nelse:\n print(max(result))', 'a, b, n = map(int, input().split())\nx = b-1 if n >= b else n\nprint(a*x//b)'... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s464661496', 's822493585', 's264217889'] | [9160.0, 9176.0, 9036.0] | [32.0, 21.0, 28.0] | [73, 154, 74] |
p02696 | u118760114 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\nA,B,N = map(int, input().split())\nif (B-1)<=N:\n print(math.floor(A*(B-1)/B)-math.floor((B-1)/B)*A)\nelse:\n print(0)\n \n', 'import math\nA,B,N = map(int, input().split())\nd = [0]\nx = 0\nfor i in range(N+1):\n C = math.floor(A*x/B)\n D = math.floor(x/B)\n ans = C-A*D\n d.append(a... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s330282742', 's561507083', 's950739702'] | [9100.0, 34656.0, 9156.0] | [20.0, 2207.0, 22.0] | [138, 231, 172] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.