problem stringclasses 23
values | problem_desc dict | fast_solution stringlengths 3 7 | fast_rank int64 1 6 | fast_norm stringclasses 6
values | fast_input stringclasses 23
values | fast_code stringlengths 28 28.5k | fast_coef float64 0 0.44 | slow_solution stringlengths 3 7 | slow_rank int64 2 7 | slow_norm stringclasses 6
values | slow_input stringclasses 23
values | slow_code stringlengths 46 28.5k | slow_coef float64 0 0.01 | rank_diff int64 1 6 | coef_ratio float64 0 3.13M ⌀ | label int64 1 1 | prompt stringlengths 1.47k 40.8k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_0 | 1 | O(1) | 0000000101
3
| __author__ = 'ratnesh.mishra'
weights = map(int, input())
weights = [cnt for cnt, x in enumerate(weights, 1) if x]
m = int(input())
state = [(0, 0, 0, [])]
res = "NO"
while state:
w, b, k, l = state.pop()
if k == m:
res = 'YES\n' + ' '.join(map(str, l))
break
for wt in weights:
... | 0.000019 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.260558 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_2 | 1 | O(1) | 0000000101
3
| import sys
sys.setrecursionlimit (1000000)
tmp = list (map (int,(list(input()))))
w = [i+1 for i in range (len (tmp)) if tmp[i] == 1]
m = int (input ())
def dfs (b,p,s):
if s == m:
return [p]
for i in w:
if i != p and i > b:
ret = dfs (i-b,i,s+1)
if ret:
ret.append (p)
return r... | 0.000004 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 1.153634 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_4 | 1 | O(1) | 0000000101
3
| # Target - Expert on CF
# Be Humblefool
import sys
# inf = float("inf")
# sys.setrecursionlimit(10000000)
# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19,... | 0.000013 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.37833 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_6 | 1 | O(1) | 0000000101
3
| # import sys
# sys.stdin = open("F:\\Scripts\\input","r")
# sys.stdout = open("F:\\Scripts\\output","w")
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
a=[i for i,j in enumerate(input(),1) if j=='1']
m=int(input())
q=[(-1,0,0,[])]
p='NO'
while q:
x,y,z,t=q.pop()
if z==m:
p='YES\n'+' '.join... | 0.000007 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.747713 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_8 | 1 | O(1) | 0000000101
3
| to_print = []
def dfs(d, ini, s, depth, m):
if depth == m:
return True
else:
for i in range(d+1, len(s)):
if i != ini and s[i] == '1':
ans = dfs(i-d, i, s, depth+1, m)
if ans == True:
to_print.append(i)
return Tr... | 0.000004 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 1.280763 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_10 | 1 | O(1) | 0000000101
3
| import traceback
import math
from collections import defaultdict
from functools import lru_cache
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writab... | 0.000008 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.643483 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_11 | 1 | O(1) | 0000000101
3
| import sys
sys.setrecursionlimit(100000)
l = list(input())
m = int(input())
ans = []
def fun(step, balance, weight):
if (step==m):
return 1
#print("step,m",step,m,balance)
if (balance>0):
for i in range(len(l)):
if (i+1==weight):
continue
if (l[i]=='1'... | 0.000013 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.370099 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_12 | 1 | O(1) | 0000000101
3
| def main(inp):
s = inp()
m = int(input())
weights = {i+1 for i in range(len(s)) if s[i] == '1'}
cache = {}
def put_weight(diff, last_used, depth):
# print("\t" * depth + "Check diff", diff, "last used", last_used)
if (diff, last_used) in cache:
# print("\t" * depth + "ca... | 0.000001 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 5.729849 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_14 | 1 | O(1) | 0000000101
3
| weights = map(int, input())
weights = [cnt for cnt, x in enumerate(weights, 1) if x]
# print(weights)
m = int(input())
state = [(0, 0, 0, [])]
res = "NO"
while state:
w, b, k, l = state.pop()
if k == m:
res = 'YES\n' + ' '.join(map(str, l))
break
for wt in reversed(weights):
... | 0.000019 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.262674 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_15 | 1 | O(1) | 0000000101
3
| from collections import defaultdict
def generate_possibilities(m, possibility_matrix, weights, last = 0, weight_diff = 0):
# print(m, last, weight_diff)
if m == 0:
return True
if (m, last, weight_diff) in possibility_matrix:
return possibility_matrix[(m, last, weight_diff)]
isPossible = False
for i in wei... | 0.000001 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 6.541864 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_16 | 1 | O(1) | 0000000101
3
| def run():
ws = [i for i, j in enumerate(input(), 1) if j == "1"]
m = int(input())
q = [(-1, 0, 0, [])]
while len(q) != 0:
previous, need, index, lst = q.pop()
if index == m:
print("YES")
print(' '.join(list(map(str, lst))))
return
for w in ws:... | 0.000006 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.767319 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_17 | 1 | O(1) | 0000000101
3
| ans=[]
def dfs(bal,m,last,flag):
x=bal
#print(bal,m,last)
if(m==te):
return 1
for i in w:
if(i==last):
continue
if(flag): x+=i
else: x-=i
if((x>0 and flag) or (x<0 and not flag)) and dfs(x,m+1,i,not flag):
ans.append(i)
retu... | 0.000007 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.718587 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_18 | 1 | O(1) | 0000000101
3
| import sys
sys.setrecursionlimit(1500)
strs = input()
n = int(input())
globaln = n
arr = []
for j,i in enumerate(strs):
if i == "1":
arr.append(j + 1)
def dfs(leftsum, rightsum, flag, n, ans):
if n == 0 :
return ans
if flag == 0:
for i in arr:
if len(ans) >= 1 a... | 0.000014 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.355141 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_20 | 1 | O(1) | 0000000101
3
| p, m = [i for i, x in enumerate(input(), 1) if x == '1'], int(input())
r, q = [(-1, 0, 0, [])], 'NO'
while r:
x, d, s, t = r.pop()
if s == m:
q = 'YES\n' + ' '.join(map(str, t))
break
for y in p:
if y != x and y > d: r.append((y, y - d, s + 1, t + [y]))
print(q)
# Made... | 0.000006 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.79026 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_21 | 1 | O(1) | 0000000101
3
| R = lambda: map(int, input().split())
ws = [i + 1 for i, x in enumerate(map(int, input())) if x]
m = int(input())
acc = [0, 0]
seq = []
idx = 0
def dfs(acc, seq, idx):
if len(seq) == m:
print('YES')
print(' '.join(map(str, seq)))
return 1
for w in ws:
if (not seq or w != seq[-1])... | 0.000025 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.195619 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_22 | 1 | O(1) | 0000000101
3
| from sys import setrecursionlimit
setrecursionlimit(2000)
weights = input()
m=int(input())
l = [x+1 for x in range(len(weights)) if weights[x]=='1']
sol = []
def solve(x, m, diff):
if m==0:
return True
for p in l:
if p>diff and p!=x:
sol.append(p)
if solve(p, m-1, p-diff... | 0.000011 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.460708 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_23 | 1 | O(1) | 0000000101
3
| def solve(ans,flag,sum_a,sum_b):
#print(ans,flag,sum_a,sum_b)
if len(ans) == m+1:
return ans
#print(ww)
for w in ww:
if flag == 0:
if sum_a+w > sum_b and ans[-1] != w:
ans.append(w)
sum_a += w
dd = solve(ans,1,sum_a,sum_b)
... | 0.000014 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 0.348952 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_24 | 1 | O(1) | 0000000101
3
| import sys
sys.setrecursionlimit(1500)
ans = []
def main():
w = [int(i) for i in input()]
m = int(input())
dfs(w, 0, 0, 1, m)
print('YES\n' + ' '.join([str(i) for i in ans][::-1]) if len(ans) > 0 else 'NO')
def dfs(w, x, y, k, m):
"""
x: current balance [-10, 10]
y: ... | 0.000001 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 7.140466 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
339_C. Xenia and Weights | {
"text": "Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the th... | 0_25 | 1 | O(1) | 0000000101
3
| import traceback
import math
from collections import defaultdict
from functools import lru_cache
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writab... | 0.000005 | 0_48 | 3 | O(n) | 0000000101
3
| def weights(arr,k):
if arr=="0110100100" and k==1000:
print("YES")
ans=[5,8,5,3]+[5,8,5,2]*(249)
print(*ans)
return ""
if arr=="0110010001" and k==1000:
print("YES")
ans=[6,10,6,3]+[6,10,6,2]*(249)
print(*ans)
return ""
arr=[i for i in arr]
wt=[]
for i in range(len(arr)):
if arr[i]=="1":
wt.ap... | 0.000005 | 2 | 1.028388 | 1 | Pairwise:
The task involves comparing two solutions to a given problem and selecting the one that is more efficient in terms of time complexity.
### TASK
{'text': 'Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. F... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4