s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s634590320 | p02345 | u728992264 | 1490387669 | Python | Python3 | py | Runtime Error | 30 | 7628 | 717 | dat = []
def init(n):
global dat
k = 1
while (k < n):
k = k * 2
dat = [2**31 - 1 for i in range(2 * k - 1)]
def update(k, y):
global dat
k += len(dat) - 1
dat[k] = y;
while (k > 0):
k = int((k - 1) / 2)
dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2])
def query(a, b, k, l, r):
if (r <= a or... |
s340858880 | p02345 | u362104929 | 1495377070 | Python | Python3 | py | Runtime Error | 0 | 0 | 407 | def updt(lst, i, x):
lst[i] = x
def fnd(lst, s, t):
return min(lst[s:t])
def rmq():
n, q = map(int, input().split())
A = [x for x in range(n)]
ans = []
for _ in range(q):
cmd, x, y = map(int, input().split())
if cmd == 0:
updt(A, x, y)
else:
an... |
s099513772 | p02345 | u362104929 | 1495380883 | Python | Python3 | py | Runtime Error | 0 | 0 | 750 | import sys
def updt(lstv, lstk, i, x):
lstv[i] = x
lstk[i] = i
def fnd(lstv, lstk, s, t):
if max(lstk[s:t+1]) == -1:
return 2**31 -1
else:
m = 2**31 -1
for k in lstk[s:t+1]:
if k >= 0:
if m > lstv[k]:
... |
s316939174 | p02345 | u603049633 | 1496735541 | Python | Python3 | py | Runtime Error | 0 | 0 | 260 | import numpy as np
n,q = map(int, input().split())
A = np.array([float("inf")] * n)
for i in range(q):
c,x,y = map(int,input().split())
if c == 0:
A[x] = y
else:
a = np.min(A[x:y+1])
if a == float("inf"): a = "2147483647"
else: a = str(a)
print(a) |
s022541281 | p02345 | u603049633 | 1496735607 | Python | Python3 | py | Runtime Error | 0 | 0 | 244 | import numpy as np
n,q = map(int, input().split())
A = np.array([None] * n)
for i in range(q):
c,x,y = map(int,input().split())
if c == 0:
A[x] = y
else:
a = np.min(A[x:y+1])
if a is None: a = "2147483647"
else: a = str(a)
print(a) |
s872376478 | p02345 | u603049633 | 1496735656 | Python | Python3 | py | Runtime Error | 20 | 7464 | 212 | n,q = map(int, input().split())
A = [None] * n
for i in range(q):
c,x,y = map(int,input().split())
if c == 0:
A[x] = y
else:
a = min(A[x:y+1])
if a is None: a = "2147483647"
else: a = str(a)
print(a) |
s475968115 | p02345 | u798803522 | 1511615555 | Python | Python3 | py | Runtime Error | 0 | 0 | 1040 | class RMQ:
import math
def __init__(self, length):
self.length = 2 ** math.ceil(math.log(length, 2))
self.segtree = [float("inf")] * (2 ** (self.length + 1) - 1)
def update(self, index, n):
leaf_index = index + self.length - 1
self.segtree[leaf_index] = n
while leaf... |
s366208168 | p02345 | u798803522 | 1511618296 | Python | Python3 | py | Runtime Error | 0 | 0 | 1080 | class RMQ:
def __init__(self, length, ini_num = float("inf")):
self.length = 1
while self.length <= n:
self.length <<= 1
self.segtree = [ini_num] * (2 * self.length - 1)
def update(self, index, n):
leaf_index = index + self.length - 1
self.segtree[leaf_index]... |
s618663410 | p02345 | u798803522 | 1511618330 | Python | Python3 | py | Runtime Error | 0 | 0 | 1085 | class RMQ:
def __init__(self, length, ini_num = float("inf")):
self.length = 1
while self.length <= n:
self.length <<= 1
self.segtree = [ini_num] * (2 * self.length - 1)
def update(self, index, n):
leaf_index = index + self.length - 1
self.segtree[leaf_index]... |
s628806714 | p02345 | u798803522 | 1511618437 | Python | Python3 | py | Runtime Error | 0 | 0 | 1085 | class RMQ:
def __init__(self, length, ini_num = float("inf")):
self.length = 1
while self.length <= n:
self.length <<= 1
self.segtree = [ini_num] * (2 * self.length - 1)
def update(self, index, n):
leaf_index = index + self.length - 1
self.segtree[leaf_index]... |
s887803083 | p02345 | u798087532 | 1511849201 | Python | Python3 | py | Runtime Error | 20 | 5620 | 1769 | class SegmentTree():
def __init__(self,n):
self.dat = [INF for _ in range(n*2-1)]
#index n???????????????????????¢?????????:
#???????????? : (n-1)//2
#???????????? : (2n+1) , (2n+2)
self.n = n
def update (self,node_index,value):
""" index?????????value????????´?????? """
index = node_index + (self.n-1)... |
s777505396 | p02345 | u045830275 | 1512172690 | Python | Python3 | py | Runtime Error | 0 | 0 | 667 | import numpy as np
def update(a, i, x) :
a[i] = x
def find(a, s, t) :
return a[s:t+1].min()
def main() :
n, q = [int(i) for i in input().split()]
a = np.ones(n, dtype=int) * (2**31 - 1)
com = np.array([], dtype=int)
x = np.array([], dtype=int)
y= np.array([], dtype=int)
for _ in ran... |
s265657852 | p02345 | u045830275 | 1512172731 | Python | Python3 | py | Runtime Error | 0 | 0 | 667 | import numpy as np
def update(a, i, x) :
a[i] = x
def find(a, s, t) :
return a[s:t+1].min()
def main() :
n, q = [int(i) for i in input().split()]
a = np.ones(n, dtype=int) * (2**31 - 1)
com = np.array([], dtype=int)
x = np.array([], dtype=int)
y= np.array([], dtype=int)
for _ in ran... |
s688292012 | p02345 | u045830275 | 1512172824 | Python | Python3 | py | Runtime Error | 0 | 0 | 667 | import numpy as np
def update(a, i, x) :
a[i] = x
def find(a, s, t) :
return a[s:t+1].min()
def main() :
n, q = [int(i) for i in input().split()]
a = np.ones(n, dtype=int) * (2**31 - 1)
com = np.array([], dtype=int)
x = np.array([], dtype=int)
y= np.array([], dtype=int)
for _ in ran... |
s778196395 | p02345 | u045830275 | 1512173230 | Python | Python3 | py | Runtime Error | 0 | 0 | 682 | import numpy
def update(a, i, x) :
a[i] = x
def find(a, s, t) :
return a[s:t+1].min()
def main() :
n, q = [int(i) for i in input().split()]
a = numpy.ones(n, dtype=int) * (2**31 - 1)
com = numpy.array([], dtype=int)
x = numpy.array([], dtype=int)
y= numpy.array([], dtype=int)
for _ ... |
s426657145 | p02345 | u011621222 | 1513253028 | Python | Python3 | py | Runtime Error | 0 | 0 | 2195 | # -*- coding: utf-8 -*-
# !/bin/python
import math
import itertools
INITER = 2**32-1
class sqrt_deco(object):
"""
>>> data = sqrt_deco(5, min)
>>> data.update(1, 2)
>>> data.raw_data
[INF, 2, INF]
>>> data.query(0, 2)
2
"""
def __init__(self, len_element: int, op=min):
se... |
s726144582 | p02345 | u167493070 | 1524464346 | Python | Python3 | py | Runtime Error | 0 | 0 | 898 | import sys;
def init(n_):
length = 1;
while(length < n_):
length*=2
element=[0]*(2*length-1)
for i in range(2*length-1):
element[i] = initial
return element
def update(k,a,element):
k+=n
element[k]=a
while(k > 0):
k = (int)((k-1)/2)
element[k] = min(elem... |
s039883523 | p02345 | u408284582 | 1524715844 | Python | Python3 | py | Runtime Error | 20 | 5612 | 909 | import sys
def initRMQ(n, D):
n_ = 1
while n_ < n:
n_ *= 2
for i in range(2*n_ - 1):
D.append(2147483647)
return n_
def update(k, a):
k += n_ - 1
D[k] = a
while k > 0:
k = int((k - 1) / 2)
D[k] = min(D[k*2 + 1], D[k*2 + 2])
def findMin(a, b):
retur... |
s910351999 | p02345 | u408284582 | 1524716099 | Python | Python3 | py | Runtime Error | 20 | 5608 | 939 | import sys
sys.setrecursionlimit(10000)
def initRMQ(n, D):
n_ = 1
while n_ < n:
n_ *= 2
for i in range(2*n_ - 1):
D.append(2147483647)
return n_
def update(k, a):
k += n_ - 1
D[k] = a
while k > 0:
k = int((k - 1) / 2)
D[k] = min(D[k*2 + 1], D[k*2 + 2])
... |
s884557689 | p02346 | u209989098 | 1531356990 | Python | Python3 | py | Runtime Error | 0 | 0 | 329 | a = list(map(int,input().split()))
b = []
ss = 1
f = 0
for i in range(a[0]):
k = int(input())
ss*= k
b.append(ss)
if k == 0:
print(a[0])
f = 1
break
k = 0
ss = 0
if f == 0:
for i in range(a[0]):
for j in range(a[0]-i):
k = b[a[0]-1-j] / b[i]
if k <= a[1]:
if a[0]-j-i >= ss:
ss = a[0]-i-j
p... |
s430855593 | p02346 | u209989098 | 1531358629 | Python | Python3 | py | Runtime Error | 0 | 0 | 251 | a = list(map(int,input().split()))
b = [0]*a[0]
for i in range(a[1]):
c = list(map(int,input().split()))
if c[0] == 0:
for j in range(a[0]-c[1]):
b[c[1]+j] += c[2]
else:
if c[1] == 1:
print(b[c[2]])
else:
print(b[c[2]]-b[c[1]-1])
|
s512387371 | p02346 | u938878704 | 1531659908 | Python | Python3 | py | Runtime Error | 20 | 5612 | 930 | n, q = map(int, input().split())
answer = []
# create segtree
size = 1
while size < n :
size *= 2
size = size * 2 - 1
segtree = [0 for x in range(size)]
# update query
def update(i, x) :
ind = size // 2 + i
segtree[ind] += x
while ind :
ind = (ind - 1) // 2 # parent
ch1 = se... |
s029476330 | p02346 | u197615397 | 1545375923 | Python | Python3 | py | Runtime Error | 0 | 0 | 934 | import sys
class BinaryIndexedTree(object):
__slots__ = ["tree"]
def __init__(self, size: int):
self.tree = [0]*(size+1)
def add(self, index: int, value: int) -> None:
tree = self.tree
next_index = index + 1
while next_index < len(tree):
tree[next_index] += v... |
s572644725 | p02346 | u165578704 | 1556452780 | Python | Python3 | py | Runtime Error | 20 | 5612 | 1144 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=2**31-1
class BIT:
def __init__(self, n):
# 0-indexed
... |
s461155780 | p02346 | u284474275 | 1423980547 | Python | Python | py | Runtime Error | 20 | 4428 | 1209 | import sys
import itertools
class RSQ:
def __init__(self, n):
self.sz = 1
self.inf = (1 << 31) - 1
while self.sz < n: self.sz = self.sz << 1
self.dat = [0] * (2 * self.sz - 1)
def update(self, idx, x):
idx += self.sz - 1
self.dat[idx] += x
while idx ... |
s900774801 | p02346 | u633068244 | 1432618207 | Python | Python | py | Runtime Error | 0 | 0 | 644 | class BIT:
def __init__(self, size):
self.size = size
self.bit = [0] * (size + 1)
# sum [0, i)
def sum(self, i):
s = 0
while (i > 0):
s += self.bit[i]
i -= i & -i
return s
# sum [i, j)
def sum_sec(self, i, j):
return self.sum(... |
s253338269 | p02346 | u797673668 | 1455599225 | Python | Python3 | py | Runtime Error | 30 | 7772 | 626 | from math import sqrt, ceil
n, q = map(int, input().split())
unit = ceil(sqrt(n))
l = [(0, [0] * unit) for _ in range(unit)]
while q:
op, s, t = map(int, input().split())
sd, sm = s // unit, s % unit
if op:
td, tm = t // unit, t % unit
if sd == td:
print(sum(l[sd][1][sm:tm + 1... |
s827206961 | p02346 | u603049633 | 1497056324 | Python | Python3 | py | Runtime Error | 30 | 7796 | 1331 | import math, sys
#??°????????????????????§????¨????????????¨???????????°??????????????????????§????
class SegmentTree():
def __init__(self, n):
self.TreeRange = pow(2, math.ceil(math.log2(n)))
self.List = [0] * (2 * self.TreeRange - 1)
def add(self, i, x):
i += self.TreeRange - 1
... |
s189068407 | p02346 | u811733736 | 1506786549 | Python | Python3 | py | Runtime Error | 20 | 7804 | 2193 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class RSQ(object):
INT_MAX = 2**31 - 1
def __init__(self, nn, init_val=0):
self.val = [init_val] * (nn+1)
self.n = 1
while ... |
s137982959 | p02346 | u798803522 | 1511706858 | Python | Python3 | py | Runtime Error | 30 | 7748 | 1515 | class RSQ:
def __init__(self, length, ini_num = float("inf")):
self.length = 1
self.ini_num = ini_num
while self.length < length:
self.length <<= 1
self.segtree = [ini_num] * (2 * self.length - 1)
def update(self, index, num):
leaf_index = index + self.length... |
s847665316 | p02346 | u798803522 | 1511707049 | Python | Python3 | py | Runtime Error | 20 | 7788 | 1550 | class RSQ:
def __init__(self, length, ini_num = float("inf")):
self.length = 1
self.ini_num = ini_num
if length == 1:
length = 2
while self.length < length:
self.length <<= 1
self.segtree = [ini_num] * (2 * self.length - 1)
def update(self, index,... |
s811996675 | p02346 | u798087532 | 1511850895 | Python | Python3 | py | Runtime Error | 20 | 5612 | 1717 | class SegmentTree():
def __init__(self,n):
self.dat = [0 for _ in range(n*2-1)]
#index n???????????????????????¢?????????:
#???????????? : (n-1)//2
#???????????? : (2n+1) , (2n+2)
self.n = n
def update (self,node_index,value):
""" index?????????value????????´?????? """
index = node_index + (self.n-1) #... |
s979840201 | p02346 | u167493070 | 1524466002 | Python | Python3 | py | Runtime Error | 20 | 5620 | 866 | import sys;
def init(n_):
length = 1;
while(length < n_):
length*=2
element=[0]*(2*length-1)
for i in range(2*length-1):
element[i] = 0
return element,length
def update(k,a,element):
k+=n-1
element[k]+=a
while(k > 0):
k = (int)((k-1)/2)
element[k] = elem... |
s872125585 | p02346 | u167493070 | 1524466783 | Python | Python3 | py | Runtime Error | 20 | 5620 | 866 | import sys;
def init(n_):
length = 1;
while(length < n_):
length*=2
element=[0]*(2*length-1)
for i in range(2*length-1):
element[i] = 0
return element,length
def update(k,a,element):
k+=n-1
element[k]+=a
while(k > 0):
k = (int)((k-1)/2)
element[k] = elem... |
s806848069 | p02346 | u167493070 | 1524467156 | Python | Python3 | py | Runtime Error | 20 | 5620 | 995 | import sys;
def init(n_):
length = 1;
while(length < n_):
length*=2
length2 = (2*length-2)
if(length2 == 0):
length2 = 1
element=[0]*length2
for i in range(length2):
element[i] = 0
return element,length
def update(k,a,element):
k+=n-1
if(n == 1):
k =... |
s714510095 | p02346 | u167493070 | 1524467187 | Python | Python3 | py | Runtime Error | 20 | 5624 | 995 | import sys;
def init(n_):
length = 1;
while(length < n_):
length*=2
length2 = (2*length-1)
if(length2 == 0):
length2 = 1
element=[0]*length2
for i in range(length2):
element[i] = 0
return element,length
def update(k,a,element):
k+=n-1
if(n == 1):
k =... |
s212959065 | p02346 | u265136581 | 1524566275 | Python | Python3 | py | Runtime Error | 20 | 5612 | 784 |
n, q = map(int, input().split())
n_ = 1 # 実際に確保した配列のサイズ
while n_ < n:
n_ *= 2
seg_tree = [0 for i in range(2*n_-1)]
def add(i, x):
i += n_ - 1
seg_tree[i] += x
while i > 0 :
i = int((i - 1)/2)
#seg_tree[i] = seg_tree[i*2+1] + seg_tree[i*2+2]
seg_tree[i] += x
def getSum(s, t):
return query(s, ... |
s517603430 | p02346 | u408284582 | 1524716955 | Python | Python3 | py | Runtime Error | 20 | 5612 | 879 | import sys
sys.setrecursionlimit(10000)
def initRMQ(n):
n_ = 1
while n_ < n:
n_ *= 2
D = [0] * (2*n_ - 1)
return n_, D
def update(k, a):
k += n_ - 1
D[k] += a
while k > 0:
k = int((k - 1) / 2)
D[k] = D[k*2 + 1] + D[k*2 + 2]
def findSum(a, b):
return query... |
s213975908 | p02346 | u408284582 | 1524717281 | Python | Python3 | py | Runtime Error | 20 | 5608 | 915 | import sys
sys.setrecursionlimit(10000)
def initRMQ(n):
n_ = 1
while n_ < n:
n_ *= 2
D = []
for _ in range(2*n_ - 1):
D.append(0)
return n_, D
def update(k, a):
k += n_ - 1
D[k] += a
while k > 0:
k = int((k - 1) / 2)
D[k] = D[k*2 + 1] + D[k*2 + 2]
... |
s782078099 | p02346 | u126478680 | 1528113373 | Python | Python3 | py | Runtime Error | 20 | 5696 | 1277 | import math
class SegmentTree():
def __init__(self, n):
self.n = n
self.height = math.ceil(math.log2(n))
self.nodes = [0 for i in range(pow(2, self.height+1)-1)]
self.leaf_start = pow(2, self.height)-1
def update(self, i, x):
pntr = self.leaf_start + i
self.node... |
s812701358 | p02347 | u567380442 | 1427618547 | Python | Python3 | py | Runtime Error | 0 | 0 | 2370 | #???????????£?????§????????????????±???¨????????¢?????´?????????
def partition(data, l, r, pivotIndex, key):
pivotValue = key(data[pivotIndex])
data[pivotIndex], data[r] = data[r], data[pivotIndex]
storeIndex = l
for i in range(l, r):
if key(data[i]) < pivotValue:
data[storeIndex], ... |
s940418566 | p02347 | u797673668 | 1455715739 | Python | Python3 | py | Runtime Error | 0 | 0 | 2890 | n = int(input())
def memoize(f):
global n
memo = [-1] * n
def main(x):
result = memo[x]
if result == -1:
result = memo[x] = f(x)
return result
return main
class Bound:
def __init__(self, sx, tx, sy, ty):
self.sx = sx
self.tx = tx
self... |
s152411244 | p02347 | u669284080 | 1466693547 | Python | Python3 | py | Runtime Error | 0 | 0 | 953 | import sys
import stdin
import math
from operator import itemgetter
from bisect import bisect_left, bisect_right
readline = stdin.readline
# main
n = int(readline())
xy = [tuple(map(int, readline().split())) + (i,) for i in range(n)]
# [..., (x_i, y_i, i), ...]
# sort by x
xy.sort()
root = int(math.sqrt(len(xy)))
lo... |
s308356622 | p02347 | u072053884 | 1468811852 | Python | Python3 | py | Runtime Error | 0 | 0 | 1427 | import sys
i_f = sys.stdin
n = int(i_f.readline())
T = [[i, *map(int, i_f.readline().split()), None, None] for i in range(n)]
def make2DTree(l, r, depth):
if l >= r:
return None
mid = (l + r) // 2
if depth % 2 == 0:
T[l:r] = sorted(T[l:r], key=lambda n: n[1])
else:
T[l:r] =... |
s272670205 | p02347 | u072053884 | 1468811894 | Python | Python3 | py | Runtime Error | 0 | 0 | 1427 | import sys
i_f = sys.stdin
n = int(i_f.readline())
T = [[i, *map(int, i_f.readline().split()), None, None] for i in range(n)]
def make2DTree(l, r, depth):
if l >= r:
return None
mid = (l + r) // 2
if depth % 2 == 0:
T[l:r] = sorted(T[l:r], key=lambda n: n[1])
else:
T[l:r] =... |
s454826044 | p02347 | u072053884 | 1468812982 | Python | Python3 | py | Runtime Error | 0 | 0 | 1427 | import sys
i_f = sys.stdin
n = int(i_f.readline())
T = [[i, *map(int, i_f.readline().split()), None, None] for i in range(n)]
def make2DTree(l, r, depth):
if l >= r:
return None
mid = (l + r) // 2
if depth % 2 == 0:
T[l:r] = sorted(T[l:r], key=lambda n: n[1])
else:
T[l:r] =... |
s453928793 | p02347 | u072053884 | 1468813452 | Python | Python3 | py | Runtime Error | 0 | 0 | 1426 | import sys
i_f = sys.stdin
n = int(i_f.readline())
T = [[i, map(int, i_f.readline().split()), None, None] for i in range(n)]
def make2DTree(l, r, depth):
if l >= r:
return None
mid = (l + r) // 2
if depth % 2 == 0:
T[l:r] = sorted(T[l:r], key=lambda n: n[1])
else:
T[l:r] = ... |
s483124363 | p02347 | u072053884 | 1469002305 | Python | Python3 | py | Runtime Error | 4330 | 93472 | 1734 | import sys
i_f = sys.stdin
n = int(i_f.readline())
T = []
for i in range(n):
x, y = map(int, i_f.readline().split())
# [0] is input number.
# [3] is left node, and [4] is right node.
T.append([i, x, y, None, None])
def partition(A, l, r, key):
x = A[r][key]
i = l - 1
for j in range(l, r)... |
s693126703 | p02347 | u022407960 | 1480097982 | Python | Python3 | py | Runtime Error | 30 | 8076 | 2312 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import stdin
from operator import attrgetter
from collections import namedtuple
class Node(object):
__slots__ = ('location', 'left', 'right')
def __init__(self):
self.location = -1
self.left, self.right = None, None
def make2DTree(left... |
s454903032 | p02347 | u848688448 | 1488113691 | Python | Python3 | py | Runtime Error | 0 | 0 | 1625 | import sys
readline = sys.stdin.readline
from bisect import bisect, bisect_right
from itertools import chain
n = input()
n0 = 2**n.bit_length()
data = [None]*(n0*2)
# ?????°???????????¨????§????
def init(k, l, r):
if r - l == 1:
data[k] = [ys[l]]
else:
le = 2*k+1; ri = 2*k+2
init(le, l, ... |
s633520713 | p02347 | u796784914 | 1509168203 | Python | Python | py | Runtime Error | 10 | 6444 | 849 | from operator import itemgetter
from bisect import bisect_left, bisect_right
import sys
def main():
n = int(sys.stdin.readline())
keys = map(lambda i:map(int,sys.stdin.readline().split())+[i],xrange(n))
keys.sort()
q = int(sys.stdin.readline())
for i in xrange(q):
x0,x1,y0,y1 = map(int,sys... |
s572414264 | p02347 | u526040679 | 1518504678 | Python | Python3 | py | Runtime Error | 0 | 0 | 1693 | import numpy as np
n = int(input())
xy = []
for i in range(n):
x,y = [int(i) for i in input().split()]
xy.append([x,y,i])
xy = np.array(sorted(xy))
q = int(input())
for i in range(q):
sx,tx,sy,ty = [int(i) for i in input().split()]
ans = kdtree(xy,sx,tx,sy,ty)
for i in ans:
print(... |
s116214593 | p02347 | u526040679 | 1518505560 | Python | Python3 | py | Runtime Error | 0 | 0 | 1696 | import numpy as np
def kdtree(xy,sx,tx,sy,ty):
x_i = np.array(binary_search(xy[0:,0],sx,0))
x_i = min(x_i)
print(x_i)
x_j = np.array(binary_search(xy[x_i:,0],tx,1))
x_j += x_i
x_j = max(x_j)
print(x_j)
ans = []
for k in range(x_i,x_j+1):
if sy <= xy[k,1] <= ty:
a... |
s933389403 | p02347 | u662418022 | 1518936903 | Python | Python3 | py | Runtime Error | 0 | 0 | 1821 | # -*- coding: utf-8 -*-
from IPython import embed
class Node():
def __init__(self, loc=None, left=None, right=None):
self.loc = loc
self.l = left
self.r = right
class Point():
def __init__(self, id, xy):
self.id = int(id)
self.x = int(xy[0])
self.y = int(xy[1])
... |
s495367618 | p02347 | u662418022 | 1518938878 | Python | Python3 | py | Runtime Error | 0 | 0 | 1850 | # -*- coding: utf-8 -*-
class Node():
def __init__(self, loc=None, left=None, right=None):
self.loc = loc
self.l = left
self.r = right
class Point():
def __init__(self, id, xy):
self.id = int(id)
self.x = int(xy[0])
self.y = int(xy[1])
if __name__ == '__main__... |
s533935115 | p02348 | u241923784 | 1556441436 | Python | Python3 | py | Runtime Error | 20 | 5680 | 801 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),min(n-1,(x+1)*b)):a[i]=lazy[x]
l[x]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
for i in ... |
s049172387 | p02348 | u241923784 | 1556441499 | Python | Python3 | py | Runtime Error | 20 | 5684 | 806 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),min(n-1,(x+1)*b)):a[i]=lazy[x]
l[x]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
for i in ... |
s873325607 | p02348 | u241923784 | 1556441551 | Python | Python3 | py | Runtime Error | 20 | 5684 | 808 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),int(min(n-1,(x+1)*b))):a[i]=l[x]
l[x]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
for i i... |
s230834586 | p02348 | u241923784 | 1556441580 | Python | Python3 | py | Runtime Error | 0 | 0 | 804 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),(min(n-1,(x+1)*b)):a[i]=l[x]
l[x]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
for i in ra... |
s566397696 | p02348 | u241923784 | 1556441610 | Python | Python3 | py | Runtime Error | 20 | 5684 | 803 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),min(n-1,(x+1)*b)):a[i]=l[x]
l[x]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
for i in ran... |
s696016686 | p02348 | u241923784 | 1556441648 | Python | Python3 | py | Runtime Error | 20 | 5684 | 808 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),min(n-1,(x+1)*b)):a[int(i)]=l[x]
l[x]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
for i i... |
s886145806 | p02348 | u241923784 | 1556441690 | Python | Python3 | py | Runtime Error | 20 | 5688 | 808 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),min(n-1,(x+1)*b)):a[i]=l[int(x)]
l[x]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
for i i... |
s597574674 | p02348 | u241923784 | 1556441723 | Python | Python3 | py | Runtime Error | 20 | 5688 | 813 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def update(x):
for i in range(int(x*b),min(n-1,(x+1)*b)):a[i]=l[int(x)]
l[int(x)]=-1;
return;
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range(n)]
fo... |
s125126883 | p02348 | u241923784 | 1556442123 | Python | Python3 | py | Runtime Error | 0 | 0 | 969 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def judge_max(x,y):
if x > y :return x
else:return y
def judge_min(x,y):
if x > y :return y
else return x
def update(x):
for i in range(int(x*b),int(judge_min(n-1,(x+1)*b))):a[i]=l[int(... |
s547663254 | p02348 | u241923784 | 1556442371 | Python | Python3 | py | Runtime Error | 0 | 0 | 967 | import math
INT_MAX = 2147483647
MAX = 100003
n,q=(int(x) for x in input().split())
b= math.sqrt(n)
def judge_max(x,y):
if x > y :return x
else:return y
def judge_min(x,y):
if x > y :return y
else :return x
def update(x):
for i in range(int(x*b),int(judge_min(n-1,(x+1)*b))):a[i]=l[int... |
s133771397 | p02348 | u241923784 | 1556448467 | Python | Python | py | Runtime Error | 0 | 0 | 833 | import math
INT_MAX = 2147483647
n,q=(int(x) for x in input().split())
b= int(math.sqrt(n))
def update(x_f):
x = int(x_f)
for i in range(int(x*b),min(n-1,int((x+1)*b-1))+1):a[i]=l[x]
l[x]=-1
return
if __name__=='__main__':
a = [INT_MAX for i in range(n)]
l = [-1 for i in range... |
s532132769 | p02350 | u464454066 | 1556165338 | Python | Python | py | Runtime Error | 0 | 0 | 2000 | import sys
import math
import time
sys.setrecursionlimit(20000)
INT_MAX = 2**31 - 1
def lazy_tree_merge(lazy,tree,i,N):
if(lazy[i] is not None):
tree[i] = lazy[i]
if(i < N-1):
lazy[i*2+1] = lazy[i]
lazy[i*2+2] = lazy[i]
lazy[i] = None
def update(tree,lazy,x,y,k,l,r,i... |
s095827480 | p02350 | u197615397 | 1499912203 | Python | Python3 | py | Runtime Error | 30 | 7964 | 3953 | import math
class SegmentTree:
__slots__ = ["elem_size", "tree_size", "tree", "lazy"]
def __init__(self, a: list, default: int):
real_size = len(a)
self.elem_size = 1 << math.ceil(math.log2(real_size))
self.tree_size = 2 * self.elem_size
self.tree = [default]*self.elem_size + ... |
s898550138 | p02354 | u176732165 | 1476548586 | Python | Python | py | Runtime Error | 0 | 0 | 453 | import sys
INF = (sys.maxint)/3
def SmallestWindow(S, a_list):
i = 0
j = 0
tmpS = 0
res = INF
while 1 :
while tmpS < S and i <len(a_list):
i +=1
tmpS += a_list[i]
if (tmpS <S):
break
res = min (res, i-j)
j += 1
tmpS -=a_list[j]
if res == INF:
res = 0
return res
def main():
N, S = map(i... |
s663983628 | p02354 | u728137020 | 1525817079 | Python | Python3 | py | Runtime Error | 0 | 0 | 277 | A=map(int,raw_input().split())
list=[]
sum=0
S=1e6+1
for i in map(int,raw_input().split()):
list.append(i)
sum+=i
if sum>A[1]:
while sum>=A[1]:
sum-=list.popleft()
S=min(S,len(list)+1)
if S==1e6+1:
print("0")
else:
print(S)
|
s011332754 | p02354 | u728137020 | 1525817115 | Python | Python3 | py | Runtime Error | 0 | 0 | 273 | A=map(int,raw_input().split())
list=[]
sum=0
S=1e6
for i in map(int,raw_input().split()):
list.append(i)
sum+=i
if sum>A[1]:
while sum>=A[1]:
sum-=list.popleft()
S=min(S,len(list)+1)
if S==1e6:
print("0")
else:
print(S)
|
s555550112 | p02354 | u011621222 | 1530151373 | Python | Python3 | py | Runtime Error | 0 | 0 | 421 | N,S = map(int, input().split())
As = list(map(int, input().split()))
i = 0
j = 0
sum = 0
m_l = float('inf')
"""
while True:
while j < N and sum < S:
sum += As[j]
j += 1
if sum < S:
break
m_l = min(j-i, m_l)
sum -= As[i]
i += 1
"""
while j < N:
sum += As[j]
j += 1
if sum < s:
continue
while i <= j a... |
s071502308 | p02356 | u136916346 | 1532062729 | Python | Python3 | py | Runtime Error | 0 | 0 | 372 | N,Q=map(int,input().split())
A=map(int,input().split())
X=map(int,input().split())
for x in X:
r=0
s=0
cnt=0
for l in range(N):
while r<N and s<=x:
s+=A[r]
r+=1
if s>x:
cnt+=r-1-l
else:
cnt+=r-l
if r==l:
r+=1
... |
s929880285 | p02356 | u938878704 | 1530599399 | Python | Python3 | py | Runtime Error | 0 | 0 | 335 | for plc in x:
cursum = 0
cnt = 0
right = 0
left = 0
for left in range(N) :
while right < N and cursum + a[right] <= plc :
cursum += a[right]
right += 1
cnt += right - left
cursum -= a[left]
# print("DBG : ", left, right)
... |
s184353939 | p02357 | u890713354 | 1559551884 | Python | Python3 | py | Runtime Error | 0 | 0 | 903 | answer=[]
element=[]
D=[]
def initRMQ(nn):
global n
n = 1
while n < nn:
n*=2
for i in range(2*n-1):
D.append(2147483647)
def update(k,a):
k += n-1
D[k] = a
while k>0:
k = (k-1)//2
D[k] = min(D[k*2+1] , D[k*2+2])
def findMin(a,b):
return query(a,b... |
s959875369 | p02357 | u279605379 | 1504601331 | Python | Python3 | py | Runtime Error | 0 | 0 | 861 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(left == right):
if(x[0]<A[left][0]):
A.insert(left,x)
break
else :
A.insert(left+1,x)
break
else:
if(x[0] < A[cen... |
s510416904 | p02357 | u279605379 | 1504601354 | Python | Python3 | py | Runtime Error | 0 | 0 | 859 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(left == right):
if(x[0]<A[left][0]):
A.insert(left,x)
break
else :
A.insert(left+1,x)
break
else:
if(x[0] < A[cen... |
s266446889 | p02357 | u279605379 | 1504601545 | Python | Python3 | py | Runtime Error | 0 | 0 | 993 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):
A.insert(left,x)
break
else :
A.insert(left+1,x)
break
else:
if(x[0] < A[... |
s505780071 | p02357 | u279605379 | 1504601720 | Python | Python3 | py | Runtime Error | 0 | 0 | 878 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right[0]]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s076310433 | p02357 | u279605379 | 1504601754 | Python | Python3 | py | Runtime Error | 20 | 7760 | 878 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s162011426 | p02357 | u279605379 | 1504659989 | Python | Python3 | py | Runtime Error | 0 | 0 | 1756 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s145102057 | p02357 | u279605379 | 1504660010 | Python | Python3 | py | Runtime Error | 0 | 0 | 1758 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s692797241 | p02357 | u279605379 | 1504660027 | Python | Python3 | py | Runtime Error | 30 | 7852 | 878 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s850609153 | p02357 | u279605379 | 1504660200 | Python | Python3 | py | Runtime Error | 20 | 7852 | 882 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = 1 + len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s700796866 | p02357 | u279605379 | 1504660389 | Python | Python3 | py | Runtime Error | 30 | 7768 | 886 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = 1 + len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s039162423 | p02357 | u279605379 | 1504660400 | Python | Python3 | py | Runtime Error | 20 | 7832 | 886 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = 1 + len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s663803669 | p02357 | u279605379 | 1504660658 | Python | Python3 | py | Runtime Error | 60 | 7764 | 880 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s036547518 | p02357 | u279605379 | 1504660832 | Python | Python3 | py | Runtime Error | 50 | 7836 | 872 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s382653998 | p02357 | u279605379 | 1504662017 | Python | Python3 | py | Runtime Error | 0 | 0 | 842 | def binaryinsertion(A,x):
left=0;right=len(A)-1
while(True):
center = math.floor((low + high) / 2)
if(right == left):
if(x[0]<A[left][0]):
A.insert(left,x)
break
else :
A.insert(left + 1,x)
break
else... |
s007611275 | p02357 | u279605379 | 1504662037 | Python | Python3 | py | Runtime Error | 0 | 0 | 855 | import math
def binaryinsertion(A,x):
left=0;right=len(A)-1
while(True):
center = math.floor((low + high) / 2)
if(right == left):
if(x[0]<A[left][0]):
A.insert(left,x)
break
else :
A.insert(left + 1,x)
break... |
s646405522 | p02357 | u279605379 | 1504662077 | Python | Python3 | py | Runtime Error | 0 | 0 | 857 | import math
def binaryinsertion(A,x):
left=0;right=len(A)-1
while(True):
center = math.floor((left + right) / 2)
if(right == left):
if(x[0]<A[left][0]):
A.insert(left,x)
break
else :
A.insert(left + 1,x)
bre... |
s546679635 | p02357 | u279605379 | 1504662292 | Python | Python3 | py | Runtime Error | 30 | 7752 | 886 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = 1 + len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s273802423 | p02357 | u279605379 | 1504662301 | Python | Python3 | py | Runtime Error | 30 | 7708 | 890 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = 1 + len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s529702238 | p02357 | u279605379 | 1504662317 | Python | Python3 | py | Runtime Error | 20 | 7832 | 886 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s980761244 | p02357 | u279605379 | 1504662328 | Python | Python3 | py | Runtime Error | 50 | 7768 | 882 | def binaryinsertion(A,x):
left=0;right=len(A)-1;centre = len(A)//2
while(True):
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break
else:
... |
s531543662 | p02357 | u279605379 | 1504662424 | Python | Python3 | py | Runtime Error | 20 | 7832 | 855 | def binaryinsertion(A,x):
left=0;right=len(A)-1
while(True):
centre = left + (right-left)//2
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
break... |
s173136135 | p02357 | u279605379 | 1504662511 | Python | Python3 | py | Runtime Error | 20 | 7764 | 859 | def binaryinsertion(A,x):
left=0;right=len(A)-1
while(True):
centre = left + (right-left)//2 - 1
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
b... |
s837250445 | p02357 | u279605379 | 1504662517 | Python | Python3 | py | Runtime Error | 30 | 7792 | 859 | def binaryinsertion(A,x):
left=0;right=len(A)-1
while(True):
centre = left + (right-left)//2 + 1
if(right - left < 2):
if(x[0]<A[left][0]):A.insert(left,x)
else :
if(x[0]<A[right][0]):A.insert(right,x)
else:A.insert(right+1,x)
b... |
s330529757 | p02357 | u279605379 | 1504684057 | Python | Python3 | py | Runtime Error | 0 | 0 | 6902 | class Node:
def __init__(self, x):
self.data = x
self.left = None
self.right = None
self.balance = 0 # ?????????
# ????????¢
def rotate_right(node):
lnode = node.left
node.left = lnode.right
lnode.right = node
return lnode
# ????????¢
def rotate_left(node):
r... |
s268357681 | p02357 | u279605379 | 1504684172 | Python | Python3 | py | Runtime Error | 0 | 0 | 5677 | class Node:
def __init__(self, x):
self.data = x
self.left = None
self.right = None
self.balance = 0
def rotate_right(node):
lnode = node.left
node.left = lnode.right
lnode.right = node
return lnode
def rotate_left(node):
rnode = node.right
node.right = rnod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.