message stringlengths 2 39.6k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 450 109k | cluster float64 2 2 | __index_level_0__ int64 900 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.
Roma has a choice to buy exactly one of n different weapons and exactly one of m different armor sets. Weapon... | instruction | 0 | 96,253 | 2 | 192,506 |
Tags: brute force, data structures, sortings
Correct Solution:
```
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
dp = []
add = []
am = []
def build(pos, l,r):
global dp
global am
if l == r - 1:
dp[pos] = -am[l][1]
return
mid = int((l+r)/2)
build (pos*2+... | output | 1 | 96,253 | 2 | 192,507 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.
Roma has a choice to buy exactly one of n different weapons and exactly one of m different armor sets. Weapon... | instruction | 0 | 96,254 | 2 | 192,508 |
Tags: brute force, data structures, sortings
Correct Solution:
```
from bisect import bisect_right
from operator import itemgetter
# quick input by @pajenegod
import io,os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
class SegmTree:
def __init__(self, size):
N = 1
h = 0
whi... | output | 1 | 96,254 | 2 | 192,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.
Roma has a choice to buy exactly one of n different weapons and exactly one of m different armor sets. Weapon... | instruction | 0 | 96,255 | 2 | 192,510 |
Tags: brute force, data structures, sortings
Correct Solution:
```
# quick input by @c1729 and @pajenegod
import io,os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
from bisect import bisect_right
from operator import itemgetter
class SegmTree:
'''
- increment on interval
- get max on inter... | output | 1 | 96,255 | 2 | 192,511 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.
Roma has a choice to buy exactly one of n different weapons an... | instruction | 0 | 96,256 | 2 | 192,512 |
No | output | 1 | 96,256 | 2 | 192,513 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.
Roma has a choice to buy exactly one of n different weapons an... | instruction | 0 | 96,257 | 2 | 192,514 |
No | output | 1 | 96,257 | 2 | 192,515 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.
Roma has a choice to buy exactly one of n different weapons an... | instruction | 0 | 96,258 | 2 | 192,516 |
No | output | 1 | 96,258 | 2 | 192,517 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.
Roma has a choice to buy exactly one of n different weapons an... | instruction | 0 | 96,259 | 2 | 192,518 |
No | output | 1 | 96,259 | 2 | 192,519 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,711 | 2 | 193,422 |
Tags: greedy, sortings
Correct Solution:
```
# python3
from sys import stdin
def main():
def parseints(line): return tuple(map(int, line.split()))
def bdiff(creature): return max(0, creature[0] - creature[1])
n, a, b = parseints(input())
hand = list(map(parseints, stdin.readlines()))
ans = sum(cr... | output | 1 | 96,711 | 2 | 193,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,712 | 2 | 193,424 |
Tags: greedy, sortings
Correct Solution:
```
# coding=utf-8
from sys import stdin
rd = lambda l: tuple(map(int, l.split()))
n, a, b = rd(input())
b = min(n, b)
s = list(map(rd, stdin.readlines()))
f = lambda x:max(0, x[0]-x[1])
g = lambda x:(x[0]<<a)-x[1]
ans = sum(x[1] for x in s)
mid = 0
if b:
s.sort(key=f, reve... | output | 1 | 96,712 | 2 | 193,425 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,713 | 2 | 193,426 |
Tags: greedy, sortings
Correct Solution:
```
# python3
from sys import stdin
from collections import namedtuple
def readline(): return tuple(map(int, input().split()))
n, a, b = readline()
hand = [tuple(map(int, line.split())) for line in stdin.readlines()]
if not b:
print(sum(creature[1] for creature in hand)... | output | 1 | 96,713 | 2 | 193,427 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,714 | 2 | 193,428 |
Tags: greedy, sortings
Correct Solution:
```
import sys
n, a, b = map(int, sys.stdin.buffer.readline().decode('utf-8').split())
creature = [list(map(int, line.decode('utf-8').split()))
for line in sys.stdin.buffer]
creature.sort(key=lambda x: -x[0]+x[1])
if b == 0:
print(sum(x for _, x in creature))
... | output | 1 | 96,714 | 2 | 193,429 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,715 | 2 | 193,430 |
Tags: greedy, sortings
Correct Solution:
```
def well_played():
n,a,b = [int(x) for x in input().split()]
p = [(0,0)] * n
b= min(b,n)
for i in range(n):
h,d =[int(x) for x in input().split()]
p[i] =(h,d)
p.sort(key=lambda x:x[0]-x[1],reverse=True)
s=0
for i in range(b):... | output | 1 | 96,715 | 2 | 193,431 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,716 | 2 | 193,432 |
Tags: greedy, sortings
Correct Solution:
```
import sys
read=lambda:map(int,sys.stdin.buffer.readline().split())
n,a,b=read()
v=[tuple(read()) for _ in range(n)]
ans=0
if b>0:
c=[v[x][0]-v[x][1] for x in range(n)]
w,r=list(range(n)),[0]*n
w.sort(key=lambda x:c[x],reverse=True)
for i in range(n): r[w[i]]=i
f=True;s... | output | 1 | 96,716 | 2 | 193,433 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,717 | 2 | 193,434 |
Tags: greedy, sortings
Correct Solution:
```
def main():
n, a, b = map(int, input().split())
arr = [0 for _ in range(n)]
brr = [0 for _ in range(n)]
for i in range(n):
arr[i], brr[i] = map(int,input().split())
p = [i for i in range(n)]
p.sort(key=lambda x: arr[x]-brr[x], reverse=True)
... | output | 1 | 96,717 | 2 | 193,435 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described... | instruction | 0 | 96,718 | 2 | 193,436 |
Tags: greedy, sortings
Correct Solution:
```
# python3
from sys import stdin
def readline(): return tuple(map(int, input().split()))
def bdiff(creature): return max(0, creature[0] - creature[1])
n, a, b = readline()
hand = [tuple(map(int, line.split())) for line in stdin.readlines()]
ans = sum(creature[1] for cr... | output | 1 | 96,718 | 2 | 193,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max ... | instruction | 0 | 96,719 | 2 | 193,438 |
Yes | output | 1 | 96,719 | 2 | 193,439 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max ... | instruction | 0 | 96,720 | 2 | 193,440 |
Yes | output | 1 | 96,720 | 2 | 193,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max ... | instruction | 0 | 96,721 | 2 | 193,442 |
No | output | 1 | 96,721 | 2 | 193,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max ... | instruction | 0 | 96,722 | 2 | 193,444 |
No | output | 1 | 96,722 | 2 | 193,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max ... | instruction | 0 | 96,723 | 2 | 193,446 |
No | output | 1 | 96,723 | 2 | 193,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max ... | instruction | 0 | 96,724 | 2 | 193,448 |
No | output | 1 | 96,724 | 2 | 193,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,314 | 2 | 194,628 |
Tags: dp, flows, greedy
Correct Solution:
```
n, m = map(int, input().split())
(a, d) = ([], [])
for i in range(n):
t, val = input().split()
(a if t == 'ATK' else d).append(int(val))
my = sorted([int(input()) for i in range(m)])
a.sort()
d.sort()
def solve1():
ret = 0
used = [False] * m
for val in ... | output | 1 | 97,314 | 2 | 194,629 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,315 | 2 | 194,630 |
Tags: dp, flows, greedy
Correct Solution:
```
import sys
n, m = map(int, input().split())
atk = []
dfs = []
for _ in range(n):
t, s = input().split()
(atk if t == "ATK" else dfs).append(int(s))
atk = sorted(atk)
dfs = sorted(dfs)
mine = sorted([int(input()) for _ in range(m)])
def s1():
ret = 0
done ... | output | 1 | 97,315 | 2 | 194,631 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,316 | 2 | 194,632 |
Tags: dp, flows, greedy
Correct Solution:
```
n, m = map(int, input().split())
u = [[], []]
for q in range(n):
p, s = input().split()
u[p == 'ATK'].append(int(s))
d, a = [sorted(q) for q in u]
v = sorted(int(input()) for q in range(m))
k, s = 0, sum(v)
i = j = 0
for q in v:
if i < len(d) and q > d[i]:
... | output | 1 | 97,316 | 2 | 194,633 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,317 | 2 | 194,634 |
Tags: dp, flows, greedy
Correct Solution:
```
n , m = map(int , input().split())
a , d = [1e9] , [1e9]
for x in range(n) :
p , s = input().split()
[d , a][p < 'B'].append(int(s))
v = [int(input()) for y in range(m) ]
for q in [a , d , v] : q.sort()
s = sum(v)
i = j = 0
for t in v :
if t > d[i] : s , i = s ... | output | 1 | 97,317 | 2 | 194,635 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,318 | 2 | 194,636 |
Tags: dp, flows, greedy
Correct Solution:
```
n, m = map(int, input().split())
(a, d) = ([], [])
for i in range(n):
t, val = input().split()
(a if t == 'ATK' else d).append(int(val))
my = sorted([int(input()) for i in range(m)])
a.sort()
d.sort()
def solve1():
ret = 0
used = [False] * m
for val in ... | output | 1 | 97,318 | 2 | 194,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,319 | 2 | 194,638 |
Tags: dp, flows, greedy
Correct Solution:
```
n, m = map(int, input().split())
(a, d, my) = ([], [], [])
for i in range(n):
t, val = input().split()
(a if t == 'ATK' else d).append(int(val))
my = sorted([int(input()) for i in range(m)])
a.sort()
d.sort()
def solve1():
ret = 0
used = [False] * m
... | output | 1 | 97,319 | 2 | 194,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,320 | 2 | 194,640 |
Tags: dp, flows, greedy
Correct Solution:
```
n, m = map(int, input().split())
(a, d) = ([], [])
for i in range(n):
t, val = input().split()
(a if t == 'ATK' else d).append(int(val))
my = sorted([int(input()) for i in range(m)])
a.sort()
d.sort()
def solve1():
ret = 0
used = [False] * m
... | output | 1 | 97,320 | 2 | 194,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Cie... | instruction | 0 | 97,321 | 2 | 194,642 |
Tags: dp, flows, greedy
Correct Solution:
```
def avoiddef(a,b):
b.reverse()
x = 0
i = 0
n = min(len(a),len(b))
while i<n and b[i]>a[i]:
x += b[i]-a[i]
i += 1
return x
def killdefs(d,a,b):
i = 0
n = len(b)
b2 = [bb for bb in b]
for dd in d:
while i<n... | output | 1 | 97,321 | 2 | 194,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attr... | instruction | 0 | 97,322 | 2 | 194,644 |
No | output | 1 | 97,322 | 2 | 194,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attr... | instruction | 0 | 97,323 | 2 | 194,646 |
No | output | 1 | 97,323 | 2 | 194,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attr... | instruction | 0 | 97,324 | 2 | 194,648 |
No | output | 1 | 97,324 | 2 | 194,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attr... | instruction | 0 | 97,325 | 2 | 194,650 |
No | output | 1 | 97,325 | 2 | 194,651 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,440 | 2 | 194,880 |
Tags: binary search, dp
Correct Solution:
```
n = int(input())
lis=[0]*(1000000+2)
dp=[0]*(1000000+2)
t=c=s=lef=0
for i in range(n):
a,b = map(int,input().split())
lis[a]=b
if lis[0]>0:
dp[0]=1
for i in range(1,1000000+1):
if lis[i]==0:
dp[i]=dp[i-1]
else:
if lis[i]>=i:
d... | output | 1 | 97,440 | 2 | 194,881 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,441 | 2 | 194,882 |
Tags: binary search, dp
Correct Solution:
```
def bin(mas,x):
l = 0
r = len(mas)
while (r > l + 1):
m = (r + l) // 2;
if (x < mas[m]):
r = m;
else:
l = m
return l
n = int(input())
a = [-9999999]
b = [9999999]
dp = [0] * (n + 1)
for i in range(n):
x,y=... | output | 1 | 97,441 | 2 | 194,883 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,442 | 2 | 194,884 |
Tags: binary search, dp
Correct Solution:
```
# your code goes here
n = int(input())
bb = [0] * 1000001
for i in range(n):
a, b = map(int, input().split())
bb[a] = b
a = 0
m = 0
for index, value in enumerate(bb):
if value > 0:
if (index - value) > 0:
a = (1 + bb[index - valu... | output | 1 | 97,442 | 2 | 194,885 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,443 | 2 | 194,886 |
Tags: binary search, dp
Correct Solution:
```
import bisect
from math import inf
a=[]
b=[]
maxi=10**6
ind=[-1]*(maxi+1)
n=int(input())
for _ in range(n):
x,y=map(int,input().split())
a.append([x,y])
b.append(x)
a.sort()
b.sort()
for i in range(len(b)):
ind[b[i]]=i
dp=[0]*(n)
dp[0]=0
##print(b)
for i in ... | output | 1 | 97,443 | 2 | 194,887 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,444 | 2 | 194,888 |
Tags: binary search, dp
Correct Solution:
```
N = int(input())
d = [0 for i in range(1000001)]
Memo = [0 for i in range(1000001)]
max_pos = 0
for i in range(N):
subList = input().split()
index = int(subList[0])
d[index] = int(subList[1])
max_pos = max(index, max_pos)
if (d[0] != 0):
Memo[0] = 1
res... | output | 1 | 97,444 | 2 | 194,889 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,445 | 2 | 194,890 |
Tags: binary search, dp
Correct Solution:
```
import bisect
n = int(input())
data = []
for _ in range(n):
data.append(list(map(int, input().split())))
data.sort(key=lambda x: x[0])
a = [x[0] for x in data]
b = [x[1] for x in data]
dp = [0] * n
dp[0] = 1
for i in range(1, n):
ind = bisect.bisect_left(a, a[i] - ... | output | 1 | 97,445 | 2 | 194,891 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,446 | 2 | 194,892 |
Tags: binary search, dp
Correct Solution:
```
from operator import itemgetter
n = int(input())
abi = [[-10**9,0]] + [list(map(int,input().split())) for i in range(n)]
abi.sort(key = itemgetter(0))
ar = [0] * (n+1)
ar[0] = 0
def check(pos,num):
#print(pos,num)
if abi[pos][0] < num:
return True
else:
... | output | 1 | 97,446 | 2 | 194,893 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dista... | instruction | 0 | 97,447 | 2 | 194,894 |
Tags: binary search, dp
Correct Solution:
```
from bisect import bisect_left as bl
n = int(input());l = []
for i in range(n):
l.append(tuple(list(map(int,input().split()))))
l.sort();DP = [0]*(n)
for i in range(n):
x = bl(l,(l[i][0]-l[i][1],0))
if x==0:
DP[i]=1
else:
DP[i]=DP[x-1]+1
prin... | output | 1 | 97,447 | 2 | 194,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di... | instruction | 0 | 97,448 | 2 | 194,896 |
Yes | output | 1 | 97,448 | 2 | 194,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di... | instruction | 0 | 97,450 | 2 | 194,900 |
Yes | output | 1 | 97,450 | 2 | 194,901 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di... | instruction | 0 | 97,451 | 2 | 194,902 |
Yes | output | 1 | 97,451 | 2 | 194,903 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di... | instruction | 0 | 97,452 | 2 | 194,904 |
No | output | 1 | 97,452 | 2 | 194,905 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di... | instruction | 0 | 97,453 | 2 | 194,906 |
No | output | 1 | 97,453 | 2 | 194,907 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di... | instruction | 0 | 97,454 | 2 | 194,908 |
No | output | 1 | 97,454 | 2 | 194,909 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di... | instruction | 0 | 97,455 | 2 | 194,910 |
No | output | 1 | 97,455 | 2 | 194,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The rules of Sith Tournament are well known to everyone. n Sith take part in the Tournament. The Tournament starts with the random choice of two Sith who will fight in the first battle. As one of them loses, his place is taken by the next ra... | instruction | 0 | 97,473 | 2 | 194,946 |
Tags: bitmasks, dp, math, probabilities
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def main():
n = int(input())
p = [list(map(float,input().split())) for _ in range(n)]
y = 1<<n
dp = [[0]*y for _ in range(n)]
# dp... | output | 1 | 97,473 | 2 | 194,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The rules of Sith Tournament are well known to everyone. n Sith take part in the Tournament. The Tournament starts with the random choice of two Sith who will fight in the first battle. As one o... | instruction | 0 | 97,476 | 2 | 194,952 |
No | output | 1 | 97,476 | 2 | 194,953 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.