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 | u122184618 | 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 = [],[],[],[]\nans = 0\nA = [1]\n\nfor i in range(q):\n ai,bi,ci,di = map(int, input().split())\n a.append(ai)\n b.append(bi)\n c.append(ci)\n d.append(di)\n\ndef dfs(A):\n global ans\n if n == len(A):\n now = 0\n for i in range(q):\n ... | ['Wrong Answer', 'Accepted'] | ['s440260028', 's093555972'] | [9240.0, 9252.0] | [511.0, 422.0] | [556, 539] |
p02695 | u123872895 | 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\nimport numpy as np\n\nn, m, q = list(map(int, input().split()))\n\na=[]\nb=[]\nc=[]\nd=[]\n\nfor i in range(q):\n ai, bi, ci, di = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\n c.append(ci)\n d.append(di)\n\ndef score(A, a, b, c, d):\n s = 0\n for i in range(le... | ['Wrong Answer', 'Accepted'] | ['s029953310', 's597659289'] | [27136.0, 25396.0] | [105.0, 1146.0] | [545, 448] |
p02695 | u141574039 | 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())\nS=[0]*Q;t=0;d=0;A=[0]*10\nfor i in range(Q):\n a,b,c,d=map(int,input().split())\n S[i]=[a,b,c,d]\n#print(S)\nfor i1 in range(M):\n for i2 in range(M):\n for i3 in range(M):\n for i4 in range(M):\n for i5 in range(M):\n for i6 in range(M):\n for i7 ... | ['Runtime Error', 'Accepted'] | ['s131414554', 's634648701'] | [9232.0, 9216.0] | [2205.0, 1417.0] | [678, 752] |
p02695 | u145600939 | 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 = [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\nans = 0\nfor p in itertools.permutations([0]*(m-2)+[1]*n):\n A = [0]*n\n cnt = 1\n i = 0\n for flag in p:\n if flag == 1:\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s416739253', 's772679910', 's900227653', 's057361608'] | [9176.0, 9184.0, 9080.0, 9220.0] | [2206.0, 22.0, 2205.0, 1107.0] | [508, 369, 508, 369] |
p02695 | u152614052 | 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())\nli=[list(map(int,input().split())) for i in range(q)]\nans = 0\n\nnum_li = itertools.combinations_with_replacement(range(1,m+1),n)\n\nfor i in num_li:\n temp = 0\n for j in li:\n a,b,c,d = j\n if i[b-1] - i[a-1] == c:\n temp += d\n ... | ['Wrong Answer', 'Accepted'] | ['s269013306', 's572233169'] | [9328.0, 9204.0] | [1154.0, 1134.0] | [352, 336] |
p02695 | u169350228 | 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 math\nn, m, q = map(int,input().split())\nmax = 0\nj = []\nfor i in range(q):\n aa,b,c,d = map(int,input().split())\n j.append([aa,b,c,d])\n\na = [0 for k in range(11)]\nfor i1 in range(1,11):\n a[1] = i1\n for i2 in range(i1,11):\n a[2] = i2\n for i3 in range(i2,1... | ['Runtime Error', 'Accepted'] | ['s660599849', 's574135183'] | [9020.0, 9208.0] | [23.0, 950.0] | [1291, 321] |
p02695 | u169702930 | 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\n\na,b,n = map(int, input().split())\ntmp = int(n/b)\nresult = 0\nif tmp != 0:\n result = b - 1\nelse:\n result = n\nprint(math.floor((a*result)/b) - a*math.floor(result/b))', 'ans = 0\n\ndef dfs():\n global ans\n if len(A) == n:\n count = 0\n for i in range(q):\n if A... | ['Wrong Answer', 'Accepted'] | ['s459856142', 's680330870'] | [9180.0, 9208.0] | [22.0, 1420.0] | [182, 711] |
p02695 | u177388368 | 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 as cmb\n\nn,m,q=map(int,input().split())\nabcd=[]\nfor i in range(q):\n ll=map(int,input().split())\n ll=[ww-1 for ww in ll]\n abcd.append(ll)\nans=0\nfor li in cmb(range(1,m+1),n):\n kari=0\n for i in abcd:\n if li[i[1]]-li[i[0]]==i[2]+1:\n ... | ['Wrong Answer', 'Accepted'] | ['s131056085', 's298723950'] | [9212.0, 9144.0] | [1087.0, 919.0] | [379, 360] |
p02695 | u180528413 | 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 as comb\n\nn,m,q = map(int, input().split(' '))\nlis = [list(map(int, input().split())) for _ in range(q)]\ntes = comb(range(1,m))\nres = 0\nfor i in tes:\n te = 0\n for a,b,c,d in lis:\n if c == i[b-1] - i[a-1]:\n te += d\n res = max(te,r... | ['Runtime Error', 'Accepted'] | ['s939193742', 's050517454'] | [9204.0, 9124.0] | [20.0, 1010.0] | [321, 325] |
p02695 | u182898140 | 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())\na=[list(map(int,input().split())) for _ in range(q)]\n\nms=[i for i in range(1,m+1)]\nans=0\nfor k in itertools.permutations(ms, n):\n x=0\n for j in range(q):\n if a[j][2]==k[a[j][1]-1]-k[a[j][0]-1]:\n x+=a[j][3]\n print(x)\n if ans<x:\n ans=x\np... | ['Wrong Answer', 'Accepted'] | ['s489314605', 's505164265'] | [9272.0, 9084.0] | [2212.0, 1419.0] | [312, 316] |
p02695 | u197968862 | 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())\nab = [list(map(int,input().split())) for _ in range(q)]\n\nprint('分かりません')", 'n, m, q = map(int,input().split())\na, b, c, d = [0] * q,[0] * q, [0] * q, [0] * q\n\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(z... | ['Wrong Answer', 'Accepted'] | ['s057904651', 's882070435'] | [9164.0, 9288.0] | [19.0, 577.0] | [119, 564] |
p02695 | u202826462 | 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())\nab = [list(map(int, input().split())) for i in range(q)]\n\nab.sort(key = lambda x: x[3],reverse=True)\nans = 0\nsub = [0] * n\nfor i in range(q):\n if sub[ab[i][1] - 1] - sub[ab[i][0] - 1] == ab[i][2]:\n ans += ab[i][3]\n else:\n if sub[ab[i][0] - 1] == 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s601756392', 's520019415'] | [9324.0, 8976.0] | [21.0, 1294.0] | [950, 350] |
p02695 | u208309047 | 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())\n\nK= [list(map(int, input().split())) for i in range(Q)]\n\nans = 0\nfor A in itertools.combinations_with_replacement([i for i in range(1, M + 1)], N):\n ans1 = 0\n for i in range(Q):\n a, b, c, d = K[i]\u3000\n if (A[b - 1] - A[a - 1] == c):\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s489826334', 's511145896', 's662769711'] | [8952.0, 9172.0, 9108.0] | [21.0, 20.0, 1996.0] | [419, 190, 416] |
p02695 | u223663729 | 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 as cwr\n\nN, M, Q, *Z = map(int, open(0).read().split())\n*Z, = zip(*[iter(Z)]*4)\nprint(Z)\n\nans = 0\nfor A in cwr(range(M), N):\n score = 0\n for a, b, c, d in Z:\n if A[b-1]-A[a-1] == c:\n score += d\n\n if score > ans:\n ans = ... | ['Wrong Answer', 'Accepted'] | ['s008285951', 's664166632'] | [9060.0, 9192.0] | [934.0, 1001.0] | [322, 313] |
p02695 | u224554402 | 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 += di\n return di\... | ['Wrong Answer', 'Accepted'] | ['s184235676', 's143373742'] | [9172.0, 9064.0] | [554.0, 566.0] | [564, 612] |
p02695 | u225627575 | 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 = []\nfor i in range(Q):\n abcd.append(list(map(int,input().split())))\nabcd.sort()\n\nDP = [0 for i in range(N+1)]\nfor i in range(1,N+1):\n for req in abcd:\n if req[0]==i:\n DP[req[1]] = max(DP[req[1]],DP[i]+req[3])\n print(DP)\nprint(max(DP))', 'N,... | ['Wrong Answer', 'Accepted'] | ['s536386664', 's059128319'] | [9212.0, 21524.0] | [22.0, 903.0] | [300, 385] |
p02695 | u227082700 | 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,m,q,*l=map(int,open(0).read().split());print(max(sum(d for a in[l[j*4:j*4+4]for j in range(q)]if i[b-1]-i[a-1]==c)for i in itertools.combinations_with_replacement(range(m),n)))', 'from itertools import*;n,m,q=map(int,input().split());l=[list(map(int,input().split()))for _ in[0]*q];print(max(sum(d f... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s677595273', 's765678375', 's842814354', 's422093768'] | [9076.0, 9096.0, 9132.0, 9184.0] | [21.0, 19.0, 25.0, 1104.0] | [195, 211, 177, 271] |
p02695 | u228303592 | 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 x in range(q)]\nans = 0\n\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(i4,m+1):\n for i5 in range(i4,m+1):\n for i6 in range(i5,m+1):\n for i7 in range(6,... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s014471195', 's264771220', 's435757832', 's582308100'] | [9252.0, 9096.0, 9112.0, 9096.0] | [23.0, 2205.0, 2206.0, 1098.0] | [699, 700, 700, 401] |
p02695 | u231095456 | 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 ... | ['use proconio::input;\nuse proconio::marker::Usize1;\nuse itertools::Itertools;\nuse std::cmp::max;\nfn main() {\n input! {\n n:usize,m:usize,q:usize,\n qs: [(Usize1, Usize1, usize, usize); q]\n };\n let mut ans = 0;\n for A in (1..m+1).combinations_with_replacement(n) {\n let mut sm =... | ['Runtime Error', 'Accepted'] | ['s857096207', 's782343785'] | [9004.0, 9212.0] | [24.0, 847.0] | [484, 363] |
p02695 | u235376569 | 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 dfs(A):\n global ans\n if len(A)==N: \n now=0\n for i in l:\n if A[i[1]-1]-A[i[0]-1]==i[2]:\n now+=i[3]\n ans=max(ans,now)\n return A\n\n\n A.append(A[-1])\n while A[-1]<=M:\n dfs(A)\n A[-1]+=1\n \n \n \n\n\n\nN,M,Q=[int(x) for x in input().rstrip().split()]\nA=[1]\nl=[]\n... | ['Wrong Answer', 'Accepted'] | ['s211535062', 's796102730'] | [9216.0, 9172.0] | [24.0, 394.0] | [406, 400] |
p02695 | u237299453 | 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 ... | ['\nimport random\nn, m, q = list(map(int,input().split()))\n\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\nA = [0]*60\n\n \n\nl = [0]*60\nfor z in range(60):\n x = 0\n for j in range(q - 1):\n if A[z[b[j] - 1]] - A[z[a[j] - 1]... | ['Runtime Error', 'Accepted'] | ['s978252934', 's682572483'] | [9576.0, 9132.0] | [25.0, 314.0] | [473, 462] |
p02695 | u237380963 | 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 ... | ['\nimport itertools\n\nn, m, q = map(int, input().split())\n\n\nn, m, q = map(int, input().split())\nquery = []\nfor i in range(q):\n query.append(list(map(int, input().split())))\n\nchoices = list(itertools.combinations_with_replacement([i for i in range(1, m+1)], n))\nans = -1\nfor choice in choices:\n score =... | ['Runtime Error', 'Accepted'] | ['s309275261', 's157385648'] | [9080.0, 21472.0] | [21.0, 926.0] | [441, 404] |
p02695 | u239917977 | 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)]\nscore=0\nfor i in range(1, M+1):\n dfs([i])\nprint(score)\n\n\ndef dfs(l):\n \n if judge_end(l,N):\n global score\n \n tmp_score = calc_score(ABCD,l)\n score = max(tmp_score, score)\n ... | ['Runtime Error', 'Accepted'] | ['s541376184', 's400759856'] | [9184.0, 9132.0] | [24.0, 670.0] | [720, 1147] |
p02695 | u247680229 | 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()))\n\nA=[list(map(int,input().split())) for _ in range(Q)]\nnum=0\nfor i in A:\n if i[1]-i[0]==i[2]:\n num+=i[3]\n \nprint(num)', 'N,M,Q=list(map(int,input().split()))\n\nA=[list(map(int,input().split())) for _ in range(Q)]\nnum=0\nfor i in A:\n if i[1]-i[0]==i[2] and i[3]>0:... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s037306852', 's949476035', 's209624523'] | [9184.0, 9184.0, 12672.0] | [22.0, 23.0, 1142.0] | [160, 171, 288] |
p02695 | u266014018 | 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 itertools import combinations_with_replacement as cwr\ninput = sys.stdin.readline\n\ndef dfs(n,m):\n adj = {}\n for i in range(1,m+1):\n adj[i] = [j for j in range(i,m+1)]\n \n stack = [[i] for i in range(1,m+1)]\n combs = []\n while stack:\n node = stack.pop()\n ... | ['Wrong Answer', 'Accepted'] | ['s200502974', 's621709324'] | [28964.0, 26468.0] | [1184.0, 1118.0] | [928, 930] |
p02695 | u276204978 | 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\nimport numpy as np\n\nN, M, Q = map(int, input().split())\n\nA = np.array(list(itertools.combinations_with_replacemeent(range(1, M+1), N)))\ns = np.zeros(len(A), np.int32)\n\nfor i in range(Q):\n a, b, c, d = map(int, input().split())\n s += d * (A[:, b-1] - A[:, a-1] == c)\n\nprint(s.max())',... | ['Runtime Error', 'Accepted'] | ['s357252177', 's197102978'] | [27124.0, 46664.0] | [106.0, 217.0] | [304, 303] |
p02695 | u278057806 | 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 sys import stdin\nfrom sys import setrecursionlimit\ninput = stdin.readline\n\nsetrecursionlimit(10 ** 9)\n\nN, M, Q = map(int, input().split())\n\nabcd = [list(map(int, input().split())) for _ in range(Q)]\n\nfor q in range(Q):\n abcd[q][3] *= - 1\n\nA = [-1 for _ in range(N + 1)]\n\nabcd.sort(key=lambda x: ... | ['Wrong Answer', 'Accepted'] | ['s213471874', 's498879819'] | [9152.0, 9192.0] | [24.0, 1236.0] | [686, 435] |
p02695 | u279266699 | 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())\nabcd = [tuple(map(int, input().split())) for _ in range(Q)]\nans = 0\nfor com in itertools.combinations_with_replacement(range(1, M + 1), N):\n score = sum([d for a, b, c, d in abcd if com[b-1] - com[a-1] == c])\n if ans < score:\n ans = score\npri... | ['Runtime Error', 'Accepted'] | ['s935205887', 's531338704'] | [9148.0, 9068.0] | [23.0, 560.0] | [317, 317] |
p02695 | u288147331 | 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\nans = []\nimport itertools\nfor A in itertools.combinations_with_replacement(range(1, M+1), N):\n tmp = 0\n print(A)\n for a, b, c, d in abcd:\n if A[b-1] - A[a-1] == c:\n tmp += d\n ans.ap... | ['Wrong Answer', 'Accepted'] | ['s139512281', 's671630447'] | [12712.0, 12532.0] | [1158.0, 1010.0] | [332, 319] |
p02695 | u296150111 | 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=[]\nfor _ in range(q):\n\ta,b,c,d=map(int,input().split())\n\tabcd.append((a,b,c,d))\nans=0\np=[]\nsys.setrecursionlimit(10**6)\ndef dfs(x):\n\tif len(x)==n:\n\t\tp.append(x)\n\telse:\n\t\tfor i in range(m-x[-1]+1):\n\t\t\tdfs(x+[x[-1]+i])\ndfs([1])\n# import itertools\n# p=iterto... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s287181509', 's498339011', 's915975235'] | [9180.0, 9240.0, 16132.0] | [21.0, 21.0, 786.0] | [471, 471, 482] |
p02695 | u303739137 | 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\nfrom itertools import combinations_with_replacement\n \nn, m, q = map(int, input().split())\n\npt = np.array(list(combinations_with_replacement(range(1,m+1), n)))\nscore = np.zeros(len(pt))\n\nfor i in range(q):\n a, b, c, d =map(int, input().split())\n flg = pt[:,b-1] - pt[:,a-1] == c\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s740691681', 's853474947', 's698109102'] | [46532.0, 9256.0, 46512.0] | [231.0, 2206.0, 224.0] | [362, 535, 369] |
p02695 | u307516601 | 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()]\na = []; b = []; c = []; d = []\nfor _ in range(q):\n l = list(map(int, input().split()))\n a.append(l[0])\n b.append(l[1])\n c.append(l[2])\n d.append(l[3])\n\nans = 0\n\ndef dfs(A):\n global ans\n if len(A) == n+1:\n now = 0\n print(A)\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s529364857', 's880895022', 's286551432'] | [9320.0, 9260.0, 9128.0] | [24.0, 22.0, 582.0] | [568, 576, 582] |
p02695 | u307622233 | 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())\nlst = []\nfor _ in range(q):\n lst_tmp = [int(i) for i in input().split()]\n lst.append(lst_tmp)\n\nlst.sort()\n\nans = 0\nA = list(range(1, -n, -1))\nA[1] = 1\nref = [0] * (n + 1)\n\nfor a, b, c, d in lst:\n if A[b] - A[a] != c:\n if ref[b] < ref[a] + d:\n ... | ['Wrong Answer', 'Accepted'] | ['s013787521', 's863077051'] | [9244.0, 9172.0] | [21.0, 967.0] | [543, 395] |
p02695 | u312158169 | 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\ns = [1] * n\n#st[b[i]] - st[a[i]] = c[i]\nnum = n-1\nans1 = [0] * 100000000\nans = 0\nt = 0\n\nwhile(s[0] != m):\n\n for i in range(q):\n if s[b... | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s012836101', 's771826042', 's824741879'] | [793108.0, 19496.0, 9292.0] | [2230.0, 1334.0, 1103.0] | [814, 810, 946] |
p02695 | u316649390 | 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 = [list(map(int,input().split())) for _ in range(Q)]\ndata = list(range(1,M+1))\nA=list(itertools.combinations_with_replacement(data,N))\nmax_score = 0\n\nfor Ai in A:\n x = 0\n for a,b,c,d in L:\n if Ai[b] - Ai[a] == c:\n x += d\n max_score = max(max_s... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s508833634', 's612749080', 's015550511'] | [21532.0, 9128.0, 21548.0] | [43.0, 21.0, 1102.0] | [331, 333, 335] |
p02695 | u317423698 | 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\nimport itertools\n\n\ndef resolve(in_):\n n, m, q = map(int, next(in_).split())\n abcd = tuple(tuple(map(int, row.split())) for row in in_)\n print(abcd)\n\n ans = 0\n for seq_a in itertools.combinations_with_replacement(range(1, m + 1), n):\n print(seq_a)\n point = 0\n ... | ['Wrong Answer', 'Accepted'] | ['s369259141', 's918059844'] | [9200.0, 9112.0] | [599.0, 505.0] | [562, 566] |
p02695 | u321035578 | 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\ndef main():\n N,M,Q = map(int,input().split())\n q = []\n for i in range(Q):\n a,b,c,d = map(int,input().split())\n q.append([a-1,b-1,c,d])\n A = [i for i in range(1,M+1)]\n if N==10:\n\n ans = 0\n for i, qq in enumerate(q):\n if A[qq[1]] - A[qq[... | ['Runtime Error', 'Accepted'] | ['s637195409', 's729416644'] | [9252.0, 21660.0] | [24.0, 627.0] | [747, 746] |
p02695 | u329049771 | 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 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 now += d[i]\n ans = max(ans, now)\n return\n\n A.append(A[-1])\n while A[-1] <= m:\n dfs(A)\n A[-1] += 1\n\n\nn, m, q = map(int,... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s295478204', 's421828742', 's057801623'] | [9176.0, 9196.0, 9324.0] | [25.0, 25.0, 679.0] | [511, 2157, 2159] |
p02695 | u330169562 | 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 math import ceil, floor, sqrt, sin, cos, pi\nfrom itertools import accumulate, permutations, combinations\nfrom fractions import gcd \nfrom collections import deque, Counter\nfrom operator import itemgetter\nfrom heapq import heappop,heappush\nsys.setrecursionlimit(10**7)\ndef lcm(x, y): return ((x *... | ['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s032174643', 's059769756', 's316132720', 's503679693', 's570663439', 's759305382', 's060828332'] | [10460.0, 10344.0, 10460.0, 10468.0, 10472.0, 10316.0, 9264.0] | [2206.0, 2206.0, 2206.0, 2205.0, 2206.0, 2206.0, 968.0] | [2127, 1013, 2146, 1091, 1086, 2149, 664] |
p02695 | u331327289 | 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 itertools import combinations_with_replacement\nfrom numba import njit\n\n\n@njit('(i8,i8,i8[:,:])')\ndef solve(n, m, query):\n li = [i for i in range(1, m + 1)]\n max_point: int = 0\n for a in combinations_with_replacement(li, n):\n point = 0\n for qer in query:\n i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s131275910', 's363697949', 's561846713'] | [106332.0, 106272.0, 9168.0] | [523.0, 519.0, 666.0] | [681, 712, 579] |
p02695 | u339199690 | 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 as cwd\n\nN, M, Q = map(int, input().split())\nA = list(cwd(range(1, M + 1), N))\nABCD = []\n\nfor i in range(Q):\n a, b, c, d = map(int, input().split())\n a, b = a - 1, b - 1\n ABCD.append([a, b, c, d])\n\nres = 0\nfor i in A:\n tmp = 0\n for j in A... | ['Wrong Answer', 'Accepted'] | ['s145746494', 's627678705'] | [27728.0, 21472.0] | [920.0, 860.0] | [405, 407] |
p02695 | u342563578 | 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 for i in range(q)]\nfor i in range(q):\n a[i] = list(map(int,input().split()))\nfor i in range(1,m+1):\n for j in range(i,m+1):\n for k in range(j,m+1):\n for s in range(k,m+1):\n for p in range(s,m+1):\n for l in range... | ['Runtime Error', 'Accepted'] | ['s650210853', 's789984035'] | [9176.0, 9272.0] | [25.0, 755.0] | [836, 844] |
p02695 | u354075848 | 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 = list(map(lambda x: int(x), input().split(' ')))\n\nprint((a * (n - 1)) // b - a * ((n - 1) // b))", "n, m, q = list(map(lambda x: int(x), input().split(' ')))\n\ne = []\n\nfor i in range(q):\n s = list(map(lambda x: int(x), input().split(' ')))\n e.append(s)\n\ndef helper(l, tmp, n, all):\n if len(tmp) =... | ['Wrong Answer', 'Accepted'] | ['s547990449', 's799772216'] | [9080.0, 22912.0] | [20.0, 1027.0] | [105, 573] |
p02695 | u357949405 | 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())\nABCD = [list(map(int, input().split())) for _ in range(Q)]\n\n\nans = 0\nR = [i for i in range(1, M+1)]\nprint(R)\nfor comb in itertools.combinations_with_replacement(R, N):\n temp = 0\n for abcd in ABCD:\n a, b, c, d = abcd\n if comb[b-1] -... | ['Wrong Answer', 'Accepted'] | ['s128682912', 's619601044'] | [9160.0, 9156.0] | [1157.0, 1095.0] | [514, 517] |
p02695 | u364555831 | 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 = []\n\nfor i in range(Q):\n A.append(list(map(int, input().split())))\n\ndef calc(B, n):\n ans = 0\n if len(B) < N:\n for i in range(n, M + 1):\n ans = max(ans, calc(B + [i], i))\n return ans\n else:\n for j in range(Q):\n if B[A[j][1]-1] - B[A[j][0]-1]... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s572807109', 's927712136', 's152517720'] | [9212.0, 9068.0, 9112.0] | [31.0, 1106.0, 958.0] | [376, 438, 440] |
p02695 | u364862909 | 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())\na=[]\nb=[]\nc=[]\nd=[]\nfor i in range(0,Q,1):\n tmp = list(map(int,input().split()))\n a.append(tmp[0])\n b.append(tmp[1])\n c.append(tmp[2])\n d.append(tmp[3])\n\nmax_score = -1\nfor i in itertools.combinations_with_replacement(range(1,M,1),N):\n ... | ['Wrong Answer', 'Accepted'] | ['s659755485', 's707615160'] | [9172.0, 9164.0] | [540.0, 1089.0] | [475, 478] |
p02695 | u370721525 | 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 i in range(Q):\n a, b, c, d = map(int, input().split())\n l.append([a, b, c, d])\n \nnum = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nnums = list(itertools.combinations_with_replacement(nums, 10))\nscores = []\nfor row in nums:\n score = 0\n i = 0\n while... | ['Runtime Error', 'Accepted'] | ['s324438895', 's697504132'] | [9232.0, 25156.0] | [23.0, 1559.0] | [436, 410] |
p02695 | u377265351 | 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 = []\nfor i in range (q):\n a.append(list(map(int,input().split(" "))))\nans = 0\nfor i in range (10**n):\n tmp = 0\n nlst = [1 for t in range(n)]\n for j in range (len(str(i))):\n nlst[j]=int(str(i)[j])+1\n if max(nlst)<=m and nlst==sorted(nlst):\n... | ['Wrong Answer', 'Accepted'] | ['s750673059', 's347821760'] | [9192.0, 9256.0] | [2205.0, 1222.0] | [566, 683] |
p02695 | u377834804 | 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())\nreqs = [list(map(int, input().split())) for _ in range(Q)]\n\nAs = []\n\ndef make(A):\n global As, N, M\n if len(A) == N+1:\n As.append(A)\n elif:\n for i in range(A[len(A)-1], M+1):\n A.append(i)\n\nmake([1])\n\nmax = 0\nfor A in As:\n score = 0\n for req in reqs:... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s685985370', 's720080284', 's943046421', 's203648493'] | [9040.0, 24304.0, 9140.0, 24248.0] | [21.0, 1126.0, 24.0, 944.0] | [398, 414, 403, 415] |
p02695 | u387080888 | 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=list(map(int,input().split()))\nb=[]\nans=0\nc=[]\nfor _ in range(a[2]):\n b.append(list(map(int,input().split())))\n\nfor i in range(1,a[1]+1):\n for j in range(i,a[1]+1):\n for k in range(j,a[1]+1):\n c=[i,j,k]\n for l in range(a[2]):\n if c[b[l][1]-1]-c[b[l][0]-1... | ['Runtime Error', 'Accepted'] | ['s510634797', 's598215205'] | [9212.0, 12848.0] | [24.0, 1415.0] | [408, 350] |
p02695 | u405483159 | 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() )\n\npoint_list = []\nfor i in range( Q ):\n a, b, c, d = map( int, input().split())\n point_list.append( [ a, b, c, d ] )\n \nl = ['{0:04b}'.format(i) for i in range( 2 ** M ) if sum(list(map(int, '{0:04b}'.format(i)))) == N]\n\ndef bin_to_numlist( bin ):\n l = []\n cnt = 1... | ['Wrong Answer', 'Accepted'] | ['s500035307', 's649447711'] | [9188.0, 9232.0] | [20.0, 1175.0] | [679, 449] |
p02695 | u411923565 | 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\n\nN,M,Q = map(int,input().split())\nabcd = []\nfor _ in range(Q):\n a,b,c,d = map(int,input().split())\n abcd.append((a,b,c,d))\ndef dfs(A):\n if len(A) == N:\n \n score = 0\n for ai,bi,ci,di in abcd:\n if A[bi-1] -A[ai-1] == ci:\n score ... | ['Runtime Error', 'Accepted'] | ['s270930736', 's614998609'] | [9024.0, 9268.0] | [22.0, 577.0] | [750, 779] |
p02695 | u423193302 | 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 = (int(x) for x in input().split())\nl = []\na = [1,2,3,4,5,6,7,8,9,10]\nb = []\nc = []\nd = []\n\n\nfor i in range(q):\n l.append([])\n l[i]=list(map(int, input().split()))\n \nfor i in itertools.combinations_with_replacement(a[:m], r=n):\n b.append(i) \nprint(b) \n ... | ['Wrong Answer', 'Accepted'] | ['s906453724', 's756376248'] | [27632.0, 25268.0] | [1058.0, 973.0] | [580, 571] |
p02695 | u428199834 | 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())\nimport itertools\nfor A in itertools.combinations_with_replacement(range(1,M+1),N):\n ans=0\n if i in range(Q):\n s=0\n A[b[i]]-A[a[i]]=c[i]\n s+=d[i]\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s175474251', 's656881980', 's259982903'] | [9000.0, 8852.0, 9196.0] | [20.0, 23.0, 318.0] | [337, 363, 457] |
p02695 | u430336181 | 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().aplist())\nlists = [list(map(int, input().split())) for i in range(Q)]\nans = 0\n\ndef calc_score(A):\n score = 0\n for a, b, c, d in lists:\n if A[b -1] - A[a - 1] == c:\n score += d\n return score\n\ndef dfs(A):\n global ans\n if len(A) == N:\n scor... | ['Runtime Error', 'Accepted'] | ['s597745912', 's282788993'] | [9084.0, 9164.0] | [21.0, 319.0] | [451, 430] |
p02695 | u449473917 | 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 *\nfrom more_itertools import *\n\nn,m,q=map(int,input().split())\n\naaa=[]\nfor i in range(m):\n aaa.append(i+1)\n\nl=[]\nfor i in range(q):\n a=list(map(int,input().split()))\n l.append(a)\n\na=list(combinations_with_replacement(aaa,n))\nans=0\nfor i in a:\n aa=0\n for j in l:\n... | ['Runtime Error', 'Accepted'] | ['s743071852', 's875663997'] | [9188.0, 21464.0] | [21.0, 948.0] | [398, 369] |
p02695 | u457460736 | 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\nal=list()\n\nfor i in range(Q): \n a,b,c,d=map(int,input().split())\n al.append([a,b,c,d])\n\n\nSum=0\nSummax=0\ncnt=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 r... | ['Wrong Answer', 'Accepted'] | ['s648763330', 's544632830'] | [9292.0, 9292.0] | [1399.0, 1311.0] | [1108, 1109] |
p02695 | u467736898 | 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 = map(int, input().split())\nABCD = [list(map(int, input().split())) for _ in range(Q)]\nans = 0\nfor t in combinations_with_replacement(range(1, M+1), N):\n an = 0\n for a, b, c, d in ABCD:\n if t[b-1]-t[a-1] == c:\n an += d\n if... | ['Runtime Error', 'Accepted'] | ['s810112169', 's828356618'] | [9056.0, 9120.0] | [22.0, 975.0] | [345, 347] |
p02695 | u469936642 | 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 as c\nn, m, q = map(int, input().split())\narr = []\nfor i in range(q):\n l = [*map(int, input().split())]\n arr.append(l)\nres = 0\nfor g in c(list(range(1, m+1)), n):\n f = 0\n for h in arr:\n if g[1] - g[0] == g[2]:\n f += g[3]\n res = max(res, f)\nprint(res)', 'from... | ['Runtime Error', 'Accepted'] | ['s311723802', 's609084355'] | [9216.0, 9080.0] | [20.0, 941.0] | [297, 355] |
p02695 | u474484450 | 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 ... | ["cin = open(0).read().strip().split('\\n')\nn, m, q = map(int, cin[0].split(' '))\nabcd = [tuple(map(int, a.split(' '))) for a in cin[1:]]\n\nret = 0\nfor case in itertools.combinations_with_replacement(list(range(1,m+1)), n):\n tmp = 0\n for c in abcd:\n if case[c[1]-1] - case[c[0]-1] == c[2]:\n ... | ['Runtime Error', 'Accepted'] | ['s247901536', 's082850950'] | [9220.0, 9212.0] | [24.0, 1050.0] | [357, 374] |
p02695 | u476674874 | 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\ndef generateA(N, M):\n m = range(1, M+1)\n A = [1 for i in range(N)]\n lastA = [M for i in range(N)]\n while True:\n yield A\n if A == lastA:\n break\n for i in range(N):\n if A[N-1-i] == M:\n continue\n A[N-1-i] += 1\n... | ['Wrong Answer', 'Accepted'] | ['s079042302', 's272367145'] | [52068.0, 14384.0] | [2272.0, 981.0] | [932, 889] |
p02695 | u479638406 | 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\ndef solve():\n n, m, q = map(int, input().split())\n l = [list(map(int, input().split())) for _ in range(q)]\n\n ans = 0\n for i in range(2**(n-2)):\n cur = []\n for j in range(n-2):\n if (i>>j)&1:\n cur.append(i+1)\n A = [1] + cur + [n, m]\n ... | ['Runtime Error', 'Accepted'] | ['s817373750', 's084798547'] | [9164.0, 9216.0] | [28.0, 353.0] | [562, 518] |
p02695 | u479719434 | 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 = [None for _ in range(Q)]\nb = [None for _ in range(Q)]\nc = [None for _ in range(Q)]\nd = [None for _ in range(Q)]\nfor i in range(Q):\n a[i], b[i], c[i], d[i] = map(int, input().split())\n\nans = 0\nelements = list(range(1, M+1))\nfor combination in itert... | ['Wrong Answer', 'Accepted'] | ['s487549977', 's897352111'] | [50064.0, 9136.0] | [2286.0, 1227.0] | [557, 806] |
p02695 | u486065927 | 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 \ndef check(lis, a):\n return sum((i[3] for i in a if lis[i[1]-1]-lis[i[0]-1]==i[2]))\n \nn, m, q = map(int, input().split())\na = ((int(i) for i in input().split(" ")) for j in range(q))\nans = 0\nfor i in itertools.combinations_with_replacement(range(m), n):\n ans = max(ans, check(i, a))\... | ['Runtime Error', 'Accepted'] | ['s363430482', 's109825472'] | [9104.0, 9104.0] | [20.0, 713.0] | [319, 319] |
p02695 | u506858457 | 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())\nL = []\nfor i in range(Q):\n L.append(list(map(int, input().split())))\n #print(L[i][1])\nimport itertools\n\nl =list(range(1,M+1))\nans=0\n\nv=list(itertools.combinations(l,N))\nprint(v)\nfor j in range(len(v)):\n for i in range(Q):\n if (v[j][L[i][1]-1] - v[j][L[i][0]-1])==L[i]... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s130137532', 's547496320', 's662007461'] | [9244.0, 21532.0, 21616.0] | [22.0, 45.0, 974.0] | [587, 327, 559] |
p02695 | u511457539 | 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())\nabcd = [list(map(int, input().split())) for i in range(Q)]\n\nanswer = 0\n\nnums=[]\nfor i in range(1, M+1):\n nums.append(i)\n\nfor balls in itertools.combinations_with_replacement(nums, N):\n score = 0\n for i in range(Q):\n test = list(balls)... | ['Wrong Answer', 'Accepted'] | ['s524783514', 's608883244'] | [52112.0, 9212.0] | [2309.0, 1429.0] | [484, 460] |
p02695 | u518085378 | 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 itertools\nn, m, q = map(int, input().split())\nl = [list(map(int, input().split())) for _ in range(q)]\n\nnum = 0\nnax = 0\n\nnums = [i for i in range(1, m+1)]\n\nfor com i... | ['Runtime Error', 'Accepted'] | ['s266423370', 's656362534'] | [9036.0, 21484.0] | [23.0, 1486.0] | [124, 379] |
p02695 | u521602455 | 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**5)\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,B,C,D=map(int,input().split())\n a[i]=A;b[i]=B;c[i]=C;d[i]=D\nr=[]\ndef dfs(i,depth,b,h):\n if depth==0:\n b.append(h)\n return\n for j in range(i,M):\... | ['Wrong Answer', 'Accepted'] | ['s251662559', 's748195185'] | [18308.0, 28668.0] | [594.0, 1277.0] | [525, 527] |
p02695 | u528470578 | 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\n\nN, M, Q = map(int, input().split())\nabcd = [list(map(int, input().split())) for _ in range(Q)]\n\nlis = list(range(1, M+1))\nbox = list(combinations(lis, N))\nprint(abcd)\n\nans = []\nfor i in box:\n temp = 0\n for a, b, c, d in abcd:\n if i[b-1] - i[a-1] == c:\n ... | ['Runtime Error', 'Accepted'] | ['s685975428', 's577626313'] | [9148.0, 9076.0] | [25.0, 1013.0] | [360, 364] |
p02695 | u529737989 | 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 = list(map(int,input().split()))\nQ = [list(map(int,input().split())) for i in range(N[2])]\n\n# N = [4, 6, 10]\n# Q = [[2, 4, 1, 86568], [1, 4, 0, 90629], [2, 3, 0, 90310], [3, 4, 1, 29211], [3, 4, 3, 78537], [3, 4, 2, 8580], [1, 2, 1, 96263], [1, 4, 2, 2156], [1, 2, 0, 94325], [1, 4, 3, 94328]]\n\nfrom itertools ... | ['Wrong Answer', 'Accepted'] | ['s294696603', 's504845542'] | [9096.0, 9092.0] | [1363.0, 1455.0] | [571, 565] |
p02695 | u533039576 | 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())\ncond = []\nfor _ in range(q):\n a, b, c, d = map(int, input().split())\n a -= 1\n b -= 1\n cond.append((a, b, c, d))\n\n\ndef calc(l):\n score = 0\n for a, b, c, d in cond:\n if l[b] - l[a] == c:\n ... | ['Runtime Error', 'Accepted'] | ['s669729648', 's704174692'] | [9176.0, 9132.0] | [20.0, 253.0] | [560, 578] |
p02695 | u539367121 | 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 = int(input())\nGACHA=[input() for n in range(N)]\nprint(len(set(GACHA)))', 'N = int(input())\nGACHA=set()\nfor n in range(N):\n GACHA.add(input())\nprint(len(GACHA))', 'import itertools\n\nN, M, Q = map(int, input().split())\nABCD = [[int(x) for x in input().split()] for i in range(Q)]\n\nans=0\nfor A in itertool... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s128120767', 's968409689', 's840368847'] | [9028.0, 9068.0, 9108.0] | [20.0, 28.0, 1088.0] | [73, 86, 307] |
p02695 | u540627185 | 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 ... | [" │➜ typical\nimport sys\nsys.setrecursionlimit(10**7)\ndef input(): return sys.stdin.readline().rstrip()\n\nimport itertools\n\ndef main():\n N, M, Q = map(int, input().split())\n all_num = [i for i in range(1, M+1)]\n q_kumi = []\n fo... | ['Runtime Error', 'Accepted'] | ['s333449282', 's508365125'] | [9004.0, 21488.0] | [24.0, 726.0] | [693, 598] |
p02695 | u548123110 | 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\ndef main():\n n,m,q = map(int,input().split())\n a = [0] * (q+1)\n b = [0] * (q+1)\n c = [0] * (q+1)\n d = [0] * (q+1)\n\n for i in range(1,q+1):\n a[i],b[i],c[i],d[i] = map(int,input().split())\n\n Alist = itertools.combinations_with_replacement(range(1,m+1),n)\n\n ... | ['Wrong Answer', 'Accepted'] | ['s017287888', 's383760634'] | [9176.0, 9096.0] | [716.0, 717.0] | [554, 535] |
p02695 | u548545174 | 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\nimport numpy as np\n\nN, M, Q = map(int, input().split())\n\nG = [list(map(int, input().split())) for _ in range(Q)]\n\nans = 0\n\n\n\n\nA = np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N)))\nscores = np.zeros(len(A))\nfor g in G:\n a, ... | ['Runtime Error', 'Accepted'] | ['s483172582', 's643345846'] | [27128.0, 46812.0] | [110.0, 228.0] | [556, 413] |
p02695 | u548976218 | 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())\nabcd = [list(map(int, input().split())) for _ in range(q)]\n\nA_list = list(itertools.combinations_with_replacement(range(1,m),n))\n\nans = 0\nfor A in A_list:\n sum = 0\n for a,b,c,d in abcd:\n if A[b-1] - A[a-1] == c:\n sum += d\n a... | ['Wrong Answer', 'Accepted'] | ['s734901933', 's203105441'] | [14992.0, 21476.0] | [494.0, 1071.0] | [335, 337] |
p02695 | u549161102 | 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())\ncand = list(itertools.combinations_with_replacement(N+M-1,N))\nfs = [list(map(int, input().split())) for i in range(Q)]\n\ndef calc(fs,As):\n count = 0\n for a,b,c,d in fs:\n if As[b-1] - As[a-1] == a:\n count += d\n\treturn count\nans = 0\nfor As in cand... | ['Runtime Error', 'Accepted'] | ['s218228747', 's649638763'] | [9060.0, 9160.0] | [23.0, 550.0] | [347, 364] |
p02695 | u554926677 | 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 = [int(x) for x in input().split()]\n \ntmp = []\nfor i in range(q):\n a, b, c, d = [int(x) for x in input().split()]\n tmp.append([a, b, c, d])\n\nt = list(itertools.combinations_with_replacement(range(1, m + 1), n))\n\nscore = 0\nfor _t in t:\n _s = 0\n for a, b, c, d in tmp:... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s096319800', 's487648061', 's337318138'] | [21612.0, 9236.0, 21504.0] | [1604.0, 24.0, 982.0] | [465, 434, 403] |
p02695 | u561862393 | 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\ninput = sys.stdin.readline\nimport numpy as np\nimport time\n\n\n\n\n\ndef make_table(n, m):\n Table = [None]*n\n for i in range(n):\n rem = np.random.randint(1,m+1)\n Table[i] = rem\n return Table\n\nt0 = time.time()\nn, m, q = map(int, input().split())\nLis = [[int(e) for e in inp... | ['Time Limit Exceeded', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s020229563', 's159423115', 's223235941', 's349157014', 's361636384', 's476739855', 's531582419', 's641874260', 's828559590', 's841273483', 's857606800'] | [36836.0, 29484.0, 27160.0, 36400.0, 27260.0, 27136.0, 34472.0, 36896.0, 27152.0, 36412.0, 43020.0] | [2012.0, 1995.0, 105.0, 1909.0, 107.0, 101.0, 1913.0, 1987.0, 111.0, 1912.0, 1026.0] | [887, 501, 638, 991, 562, 438, 991, 992, 638, 991, 437] |
p02695 | u562662744 | 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())\nv=[[] for _ in range(Q)]\no=0\nfor i in range(Q):\n v[i]=list(map(int,input().split()))\nl=list(itertools.combinations(range(M+N), N))\nfor x in l:\n s=0\n a=[]\n for i in range(N):\n a.append(x[i]-i)\n for i in range(Q):\n if a[l[i][2]]-a[l[i][1]]-l[i][3]=... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s053455270', 's291987501', 's308821128', 's235693064'] | [9216.0, 34492.0, 9236.0, 21532.0] | [23.0, 2206.0, 25.0, 1617.0] | [365, 592, 484, 390] |
p02695 | u562791958 | 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())\nmylist = [list(map(int, input().split())) for i in range(q)]\n#print(mylist)\n\nkouho = []\nfor i in range(1, m+1):\n kouho.append(i)\n\n\nA = list(itertools.combinations(kouho,n))\n#print(A)\n\npoint = 0\nmaxp = 0\nfor a in A:\n point = 0\n #print(a)\n for my... | ['Wrong Answer', 'Accepted'] | ['s600152689', 's380641292'] | [9172.0, 21484.0] | [24.0, 1062.0] | [528, 638] |
p02695 | u571395477 | 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\n#19 choose 9\n#92378\n\ndef main():\n N, M, Q = map(int, input().split())\n Q = []\n final_score = 0\n for i in range(Q):\n Q.append(list(map(int, input().split())))\n for A in itertools.combinations_with_replacement(range(1, M+1), N):\n score = 0\n for q in Q:\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s008278463', 's440734779', 's337507264'] | [9140.0, 9064.0, 9052.0] | [23.0, 20.0, 1403.0] | [438, 462, 468] |
p02695 | u576917603 | 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 ... | ['vn,m,q=map(int,input().split())\nlis=[]\nfor i in range(q):\n a,b,c,d=map(int,input().split())\n lis.append((a,b,c,d))\n \nfrom itertools import combinations_with_replacement\n\nco=list(combinations_with_replacement(range(1,m+1),n))\n\nans=0\nfor status in co:\n tmp_score=0\n for a,b,c,d in lis:\n ... | ['Runtime Error', 'Accepted'] | ['s424408881', 's485514438'] | [9140.0, 23024.0] | [22.0, 1155.0] | [401, 526] |
p02695 | u580920947 | 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 python\nimport sys\nfrom collections import Counter\nfrom itertools import permutations, combinations_with_replacement\n#from fractions import gcd\nfrom math import gcd\nfrom math import ceil, floor\nimport bisect\nsys.setrecursionlimit(10 ** 6)\ninf = float("inf")\n\ndef input():\n return sys.stdin... | ['Wrong Answer', 'Accepted'] | ['s679675515', 's013958908'] | [22564.0, 21916.0] | [1148.0, 875.0] | [847, 814] |
p02695 | u586639900 | 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 = []\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\n\ndef dfs(nums):\n\n if len(nums) == N + 1:\n score = 0\n for j in range(Q):\n if n... | ['Runtime Error', 'Accepted'] | ['s818293130', 's531338786'] | [9240.0, 9240.0] | [23.0, 697.0] | [572, 583] |
p02695 | u591524911 | 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())\nlst = [list(map(int, input().split())) for _ in range(q)]\nimport itertools\nl = [i+1 for i in range(m)]\nlst2 = [com for com in itertools.combinations_with_replacement(l, n)]\nres = 0\nfor com in lst2:\n score = 0\n for l in lst:\n if com[l[1]-1] - com[l[0]-1] == l[2]:... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s051331315', 's300931594', 's803263583'] | [21920.0, 9144.0, 21616.0] | [1016.0, 24.0, 988.0] | [404, 387, 405] |
p02695 | u593567568 | 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\nimport itertools\n\n\nsys.setrecursionlimit(10 ** 7)\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN, M, Q = map(int, input().split())\nABCD = [list(map(int, input().split())) for _ in range(Q)]\n\n\nans = 0\nfor lst in itertools.combinati... | ['Wrong Answer', 'Accepted'] | ['s777928796', 's790419289'] | [9120.0, 9144.0] | [1063.0, 982.0] | [480, 480] |
p02695 | u595905528 | 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\nN,M,Q=map(int, input().split())\nmatrix=[]\nfor _ in range(Q):\n c=list(map(int, input().split()))\n matrix.append(c)\n#matrix = np.array(matrix)\nimport itertools\nansscore = 0\ncombi = list(combinations_with_replacement(range(1,M+1),N)\nfor i in combi:\n i = list(i)\n i.sort()\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s532616031', 's597397578', 's943697565'] | [9044.0, 9160.0, 21540.0] | [24.0, 20.0, 1484.0] | [513, 514, 524] |
p02695 | u605253462 | 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 = input().split()\nn = int(n)\nm = int(m)\nq = int(q)\nnum_list = []\na = list(range(1, n+1))\nfor i in range(q):\n num_list.append(list(map(int,input().split())))\nnum_list = sorted(num_list, reverse=True, key=lambda x: x[3])\nff = list(itertools.combinations_with_replacement(a, m))\nmax... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s176939209', 's851288966', 's077417252'] | [21616.0, 21616.0, 21496.0] | [1579.0, 1526.0, 1499.0] | [484, 425, 439] |
p02695 | u607563136 | 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 product\n\nn, m, q = map(int,input().split())\na = [list(map(int,input().split())) for _ in range(q)]\n\ntemp = list(combinations([i for i in range(1,m+1)],n))\n\n\nans = 0\n\nfor a_temp in temp:\n ans_temp = 0\n for i in range(q):\n if a_temp[a[i][1]-1] - a_temp[a[i][0]-1] == a[i][... | ['Runtime Error', 'Accepted'] | ['s721658365', 's493171778'] | [9216.0, 21556.0] | [22.0, 1277.0] | [397, 444] |
p02695 | u608007704 | 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\nabcd=[]\nfor i in range(Q):\n abcd.append(list(map(int,input().split())))\n abcd[i][0]-=1\n abcd[i][1]-=1\n\n \ndef calcScore(target):\n score=0\n for i in range(Q):\n if target[abcd[i][1]]-target[abcd[i][0]]==abcd[i][2]:\n score+=abcd[i][3]\n return score\n\ndef makeT... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s513392824', 's552823824', 's246222246'] | [9180.0, 9272.0, 9204.0] | [1097.0, 1106.0, 1007.0] | [676, 665, 665] |
p02695 | u613350811 | 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())\nfor i in range(Q):\n q_list.append(list(map(int, input().split())))\n\nq_list = []\nfinal_score = 0\nfor A in itertools.combinations_with_replacement(range(1,11), N):\n score = 0\n for q in q_list:\n if A[q[1]-1] - A[q[0]-1] == q[2]:\n ... | ['Runtime Error', 'Accepted'] | ['s769781212', 's845950745'] | [9200.0, 9196.0] | [21.0, 1852.0] | [387, 387] |
p02695 | u614162316 | 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=[]\nx=[1]\nfor i in range(q):\n abcd.append(list(map(int,input().split())))\nans=0\ndef dfs(s):\n global ans\n if(len(s)==n):\n t=0\n for a,b,c,d in abcd:\n if(s[b-1]-s[a-1]==c):\n t+=d\n ans=max(t,ans)\n return \n ... | ['Wrong Answer', 'Accepted'] | ['s455296034', 's802623664'] | [9172.0, 9208.0] | [346.0, 304.0] | [412, 399] |
p02695 | u627600101 | 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 for _ in range(Q)]\nb = [0 for _ in range(Q)]\nc = [0 for _ in range(Q)]\nd = [0 for _ in range(Q)]\nfor k in range(Q):\n a[k], b[k], c[k], d[k] = map(int, input().split())\nA = [1 for _ in range(N)]\n\ndef point(A):\n p = 0\n for ai, bi, ci, di in zip(a, b, c, d):\n ... | ['Runtime Error', 'Accepted'] | ['s939454801', 's181962733'] | [9220.0, 9244.0] | [24.0, 698.0] | [660, 644] |
p02695 | u631755487 | 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\nabcd = [list(map(int, input.split())) for _ in range(q)]\nfrom itertools import combinations_with_replacement as cwr\nA = list(cwr(range(1, m+1), n))\n\n\nmaxPoint = 0\nfor item in A:\n point = 0\n for i in range(len(abcd))\n a = abcd[i][0]\n b = abcd[i][1]\n c = abcd[i][2]... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s123412613', 's712523644', 's730516809'] | [9044.0, 21492.0, 21484.0] | [21.0, 2034.0, 1487.0] | [438, 453, 418] |
p02695 | u636251914 | 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(_) for _ in input().split()]\na = [0] * Q\nb = [0] * Q\nc = [0] * Q\nd = [0] * Q\n\nfor i in range(Q):\n xs = [int(_) for _ in input().split()]\n a[i] = xs[0] - 1\n b[i] = xs[1] - 1\n c[i] = xs[2]\n d[i] = xs[3]\n\n\ndef calc_score(A):\n acc = 0\n for i in range(Q):\n if c[i... | ['Wrong Answer', 'Accepted'] | ['s025092683', 's961461913'] | [9168.0, 9356.0] | [29.0, 1484.0] | [687, 715] |
p02695 | u646412443 | 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 = [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\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]] == ... | ['Wrong Answer', 'Accepted'] | ['s254633680', 's324037208'] | [9136.0, 9168.0] | [21.0, 697.0] | [479, 491] |
p02695 | u648901783 | 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())\ntmp = [list(map(int, input().split())) for i in range(Q)]\n\n\n\n\n\nans = [0]\ndef dfs(A):\n if len(A) == N:\n tmp_ans = 0\n for ele in tmp\n if ele[1] - ele[0] == ele[2]:\n tmp_ans += ele[-1]\n ans[0] = max(tmp_ans,ans[0])\n\n ... | ['Runtime Error', 'Accepted'] | ['s907929189', 's429812578'] | [8888.0, 8968.0] | [25.0, 719.0] | [609, 635] |
p02695 | u663767599 | 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())\nts = []\nfor _ in range(Q):\n ts.append(tuple(map(int, input().split())))\nprint(ts)\n\nscores = []\nfor A in combinations_with_replacement(range(1, M + 1), N):\n score = 0\n for t in ts:\n a, b, c, d = t\n ... | ['Wrong Answer', 'Accepted'] | ['s824414342', 's889500683'] | [12516.0, 12636.0] | [1100.0, 1122.0] | [406, 396] |
p02695 | u669812251 | 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 -*-\n\n\nN, M , Q = [int(i) for i in input().split()]\n\nnumbers = []\nfor i in range(Q):\n numbers.append([int(j) for j in input().split()])\n\nnumbers = sorted(numbers , key = lambda x:-x[1])\n#print(numbers)\n\nkouho = ["9"*(N)]\n\nfor a, b , c ,d in numbers:\n for k in kouho:\n i... | ['Runtime Error', 'Accepted'] | ['s342151154', 's270896137'] | [9264.0, 21548.0] | [22.0, 1719.0] | [1114, 407] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.