s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s361975730 | p02537 | u441575327 | 1601173418 | Python | PyPy3 (7.3.0) | py | Runtime Error | 375 | 94840 | 511 | from collections import deque
N,K = list(map(int,input().split()))
A = [int(input()) for i in range(N)]
if N == 1:
print(1)
exit()
lst = [-1]*(N+1)
queue = deque()
queue.append((A[0],1,1))
ans = 0
while queue:
# print(queue)
r,size,i = queue.popleft()
if i == N:
ans = max(ans,size)
... | Traceback (most recent call last):
File "/tmp/tmp_q5136un/tmpc42rwcvo.py", line 3, in <module>
N,K = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s690566206 | p02537 | u626891113 | 1601173414 | Python | PyPy3 (7.3.0) | py | Runtime Error | 630 | 95896 | 272 | n, k = map(int, input().split())
l = []
for i in range(n):
l.append(int(input()))
root = [1]*n
for i in range(n)[-2::-1]:
num = 0
for j in l[i + 1: i + 100]:
if abs(i - j) <= k:
num = max(num, root[j])
root[i] += num
print(max(root)) | Traceback (most recent call last):
File "/tmp/tmptbrqmhr5/tmp19wxi0fe.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s761553362 | p02537 | u990726146 | 1601173384 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1473 | 160280 | 2516 | N, K = map(int, input().split())
A = [[-1] for i in range(300010)]
d = [0] * N
for i in range(N):
d[i] = int(input())
A[d[i]].append(i)
c = [[0] * 2 for i in range(N)]
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele = -float("INF")
#################
a = [0] * 300010
for i... | Traceback (most recent call last):
File "/tmp/tmpvdygyhaa/tmp0epdk2no.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s042751451 | p02537 | u544587633 | 1601173379 | Python | Python (3.8.2) | py | Runtime Error | 384 | 41056 | 1468 | #!/usr/bin/env python3
import sys
import numpy as np
def func(i,j,k,K, A):
if abs(A[i] - A[j]) <= K:
return i, j
elif abs(A[i] - A[k]) <= K:
return i, k
elif abs(A[j] - A[k]) <= K:
return j, k
else:
return 0,0
def solve(N: int, K: int, A: "List[int]"):
if N == 1... | Traceback (most recent call last):
File "/tmp/tmppo8y6d6m/tmpt__k8ldd.py", line 67, in <module>
main()
File "/tmp/tmppo8y6d6m/tmpt__k8ldd.py", line 61, in main
N = int(next(tokens)) # type: int
^^^^^^^^^^^^
StopIteration
| |
s560789947 | p02537 | u919235786 | 1601173367 | Python | Python (3.8.2) | py | Runtime Error | 421 | 21628 | 242 | n,k=map(int,input().split())
a=[]
for i in range(n):
ai=int(input())
a.append(ai)
def rec(x):
ans=1
for i in range(x+1,n):
if abs(a[i]-a[x])<=k:
ans=max(rec(i)+1,ans)
return ans
print(rec(0)) | Traceback (most recent call last):
File "/tmp/tmpx3lv3cow/tmp293adet3.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s404488739 | p02537 | u642012866 | 1601173327 | Python | PyPy3 (7.3.0) | py | Runtime Error | 742 | 80880 | 691 | N, K = map(int, input().split())
# N: 処理する区間の長さ
N0 = 2**(N-1).bit_length()
INF = 0
data = [INF]*(2*N0)
# a_k の値を x に更新
def update(k, x):
k += N0-1
data[k] = x
while k >= 0:
k = (k - 1) // 2
data[k] = max(data[2*k+1], data[2*k+2])
# 区間[l, r)の最小値
def query(l, r):
L = l + N0; R = r + N0
... | Traceback (most recent call last):
File "/tmp/tmpi9ngyfdy/tmpdx4a4z4z.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s284358878 | p02537 | u441575327 | 1601173312 | Python | PyPy3 (7.3.0) | py | Runtime Error | 375 | 94936 | 489 | from collections import deque
N,K = list(map(int,input().split()))
A = [int(input()) for i in range(N)]
if N == 1:
print(1)
exit()
lst = [-1]*(N+1)
queue = deque()
queue.append((A[0],1,1))
ans = 0
while queue:
# print(queue)
r,size,i = queue.popleft()
if i == N:
ans = max(ans,size)
... | Traceback (most recent call last):
File "/tmp/tmp2pittqc9/tmpz8f4oivi.py", line 3, in <module>
N,K = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s596082207 | p02537 | u354862173 | 1601173310 | Python | PyPy3 (7.3.0) | py | Runtime Error | 98 | 75484 | 1124 | import sys
from math import ceil as C, floor as F, sqrt, gcd as G
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
import heapq as HQ
class Heap:
def __init__(self, data, reverse=False):
self.reverse = -1 if reverse else 1
self.data = [self.reverse * d for d in data]... | Traceback (most recent call last):
File "/tmp/tmpkxhc5xed/tmpjv05c_wp.py", line 26, in <module>
n, k = I()
^^^
File "/tmp/tmpkxhc5xed/tmpjv05c_wp.py", line 22, in I
def I(): return _I(S())
^^^^^^^
File "/tmp/tmpkxhc5xed/tmpjv05c_wp.py", line 21, in _I
def _I(ss): return ... | |
s064467907 | p02537 | u745514010 | 1601173277 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2209 | 118208 | 1888 | import sys
input = sys.stdin.readline
def main():
n, k = map(int, input().split())
alst = [int(input()) for _ in range(n)]
N = 300010
ll = - 10 ** 10
LV = (N-1).bit_length()
N0 = 2**LV
data = [0]*(2*N0)
lazy = [ll]*(2*N0)
def gindex(l, r):
L = (l + N0) >> 1; R ... | Traceback (most recent call last):
File "/tmp/tmpk6ao8i7h/tmpschjegy3.py", line 74, in <module>
main()
File "/tmp/tmpk6ao8i7h/tmpschjegy3.py", line 5, in main
n, k = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s173824691 | p02537 | u441575327 | 1601173243 | Python | PyPy3 (7.3.0) | py | Runtime Error | 379 | 99420 | 489 | from collections import deque
N,K = list(map(int,input().split()))
A = [int(input()) for i in range(N)]
if N == 1:
print(1)
exit()
lst = [-1]*(N+1)
queue = deque()
queue.append((A[0],1,2))
ans = 0
while queue:
# print(queue)
r,size,i = queue.popleft()
if i == N:
ans = max(ans,size)
... | Traceback (most recent call last):
File "/tmp/tmp6n7lu9_l/tmp2czg7svp.py", line 3, in <module>
N,K = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s214629801 | p02537 | u626891113 | 1601173222 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 96920 | 303 | n, k = map(int, input().split())
l = []
for i in range(n):
l.append(int(input()))
root = [1]*n
for i in range(n)[-2::-1]:
num = 0
for j in l[i + 1:]:
if abs(i - j) <= k:
num = max(num, root[j])
root[i] += num
if i < n - 1000:
del l[-1]
print(max(root)) | Traceback (most recent call last):
File "/tmp/tmpg737iikx/tmprk8r4ltg.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s839628049 | p02537 | u589969467 | 1601173177 | Python | PyPy3 (7.3.0) | py | Runtime Error | 395 | 96752 | 401 | def dfs(start):
global myList
if start==n:
return
if len(myList) == 0:
myList.append(a[start])
dfs(start+1)
else:
if abs(myList[-1]-a[start])<=k:
myList.append(a[start])
dfs(start+1)
n,k = map(int,input().split())
a = []
for i in range(n):
a.append(int(input()))
#print(a)
ans = 0
... | Traceback (most recent call last):
File "/tmp/tmp3bwtke7b/tmpi6lxaexb.py", line 13, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s542201598 | p02537 | u745514010 | 1601173050 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1977 | 117948 | 1817 | import sys
input = sys.stdin.readline
def main():
n, k = map(int, input().split())
alst = [int(input()) for _ in range(n)]
N = max(alst) + 1
LV = (N-1).bit_length()
N0 = 2**LV
data = [0]*(2*N0)
lazy = [0]*(2*N0)
def gindex(l, r):
L = (l + N0) >> 1; R = (r + N0) >>... | Traceback (most recent call last):
File "/tmp/tmpzszzpwph/tmpv5i4p6jn.py", line 74, in <module>
main()
File "/tmp/tmpzszzpwph/tmpv5i4p6jn.py", line 5, in main
n, k = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s869729876 | p02537 | u642012866 | 1601173021 | Python | PyPy3 (7.3.0) | py | Runtime Error | 675 | 80944 | 2111 | import sys
sys.setrecursionlimit(10**8)
N, K = map(int, input().split())
#####segfunc#####
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(... | Traceback (most recent call last):
File "/tmp/tmpvn24p53p/tmpazngf894.py", line 4, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s896275578 | p02537 | u970197315 | 1601172949 | Python | PyPy3 (7.3.0) | py | Runtime Error | 403 | 114344 | 564 | n, k = map(int, input().split())
a = [int(input()) for i in range(n)]
b = []
# print(a)
l = 0
r = 1
while l < n:
if l == r and r < n:
r += 1
if l == n-1:
if abs(a[l]-b[-1]) <= k:
b.append(a[l])
break
if len(b) == 0:
if abs(a[r]-a[l]) <= k:
... | Traceback (most recent call last):
File "/tmp/tmpu3tdsx7b/tmpz80l6zyg.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s914462503 | p02537 | u876754484 | 1601172903 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 20856 | 464 | n,k = [int(x) for x in input().split()]
nums = []
absnums = []
for i in range(n):
nums.append(int(input()))
#print(nums)
for i in range(len(nums)-1):
if i == len(nums)-1:
break
if abs(nums[i]-nums[i+1]) > k:
while(abs(nums[i] - nums[i+1]) > k):
del n... | Traceback (most recent call last):
File "/tmp/tmptr72fh59/tmpquji7sbf.py", line 1, in <module>
n,k = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s218574149 | p02537 | u240444124 | 1601172833 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 22036 | 1596 | import sys
z=sys.stdin.readline
class SegmentTree:
def __init__(self, data, default=0, func=max):
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_length()
self.data = [default] * (2 * _size)
self.data[_size... | Traceback (most recent call last):
File "/tmp/tmp2qyp2ebb/tmph652f7ss.py", line 43, in <module>
n,k=map(int,z().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s375393886 | p02537 | u376752722 | 1601172818 | Python | Python (3.8.2) | py | Runtime Error | 1696 | 138648 | 224 | n, k = map(int, input().split())
a = []
index = 0
for i in range(n):
tmp = int(input())
if i > 0:
if abs(a[index-1] - tmp) > k:
continue
index += 1
a.append(tmp)
print(a)
print(len(a)) | Traceback (most recent call last):
File "/tmp/tmpfmc9_3qr/tmpj7yg28fo.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s402816734 | p02537 | u887733878 | 1601172813 | Python | PyPy3 (7.3.0) | py | Runtime Error | 797 | 143764 | 1937 | N,K=map(int,input().split())
A=[]
for i in range(N):
a=int(input())
A.append(a)
#####segfunc#####
def segfunc(x, y):
return max(x,y)
#################
#####ide_ele#####
ide_ele =0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)... | Traceback (most recent call last):
File "/tmp/tmpac0x_nfq/tmpk1tyjpuw.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s651032974 | p02537 | u876754484 | 1601172751 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 32408 | 498 | n,k = [int(x) for x in input().split()]
nums = []
absnums = []
for i in range(n):
nums.append(int(input()))
#print(nums)
for i in range(len(nums)-1):
if i == len(nums)-1:
break
if abs(nums[i]-nums[i+1]) <= k:
absnums.append(abs(nums[i]-nums[i+1]))
else:
... | Traceback (most recent call last):
File "/tmp/tmplcym9hms/tmpyq7k4qx0.py", line 1, in <module>
n,k = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s907964216 | p02537 | u505830998 | 1601172743 | Python | PyPy3 (7.3.0) | py | Runtime Error | 711 | 103808 | 1823 | import sys
input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]
tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007
#+++++
#+++++
isTest=False
def pa(v):
if isTest:
print(v)
def input_clipboard():
import clipboard
input_text=clipboard.g... | Traceback (most recent call last):
File "/tmp/tmpllp_i059/tmppe6s17jv.py", line 88, in <module>
n, k = tin()
^^^^^
File "/tmp/tmpllp_i059/tmppe6s17jv.py", line 7, in <lambda>
tin=lambda : map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s310220440 | p02537 | u952491523 | 1601172647 | Python | PyPy3 (7.3.0) | py | Runtime Error | 715 | 109988 | 2105 | #####segfunc#####
def segfunc(x, y):
return max(x,y)
#################
#####ide_ele#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
def __init__(self, init_val, segfunc, i... | Traceback (most recent call last):
File "/tmp/tmpvyxkwaze/tmpgjktmbe3.py", line 91, in <module>
main()
File "/tmp/tmpvyxkwaze/tmpgjktmbe3.py", line 70, in main
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s701478969 | p02537 | u642012866 | 1601172629 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 20352 | 2070 | N, K = map(int, input().split())
#####segfunc#####
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
... | Traceback (most recent call last):
File "/tmp/tmpaw393vkk/tmpv5tzudxm.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s905588407 | p02537 | u370721525 | 1601172617 | Python | PyPy3 (7.3.0) | py | Runtime Error | 398 | 93120 | 254 | N, K = map(int, input().split())
l = []
for i in range(N):
l.append(int(input()))
cnts = [0] * 20
for i in range(N-1):
tmp = 0
for j in range(max(l[i]-3, 0), min(l[i]+4, 300000)):
tmp = max(tmp, cnts[j])
cnts[l[i]] = tmp+1
print(max(cnts)) | Traceback (most recent call last):
File "/tmp/tmptndehrv5/tmpx_y54fdu.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s927922554 | p02537 | u102655885 | 1601172562 | Python | Python (3.8.2) | py | Runtime Error | 424 | 21816 | 952 | n, k = map(lambda x: int(x), input().split())
list_a = []
for _ in range(n):
list_a.append(int(input()))
memo = dict()
def subilst_max_length(current_value, i):
print(current_value, i)
if (current_value, i) in memo.keys():
print('here')
return memo[(current_value, i)]
if i >... | Traceback (most recent call last):
File "/tmp/tmpdvo_idkr/tmpbevtmp8e.py", line 1, in <module>
n, k = map(lambda x: int(x), input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s651500872 | p02537 | u887733878 | 1601172524 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 34328 | 2170 | N,K=map(int,input().split())
A=[]
for i in range(N):
a=int(input())
A.append(a)
#####segfunc#####
def segfunc(x, y):
return max(x,y)
#################
#####ide_ele#####
ide_ele =0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)... | Traceback (most recent call last):
File "/tmp/tmpfe6lr_2p/tmpydrlun9p.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s513131630 | p02537 | u887733878 | 1601172499 | Python | PyPy3 (7.3.0) | py | Runtime Error | 789 | 142672 | 2170 | N,K=map(int,input().split())
A=[]
for i in range(N):
a=int(input())
A.append(a)
#####segfunc#####
def segfunc(x, y):
return max(x,y)
#################
#####ide_ele#####
ide_ele =0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)... | Traceback (most recent call last):
File "/tmp/tmpffcu7hpu/tmpj3wb8tsn.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s540189058 | p02537 | u366886346 | 1601172494 | Python | PyPy3 (7.3.0) | py | Runtime Error | 601 | 80420 | 1233 | N,K=map(int,input().split())
class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.tree = [ide_ele] * 2 * self.num
for i in range(n):
self.tr... | Traceback (most recent call last):
File "/tmp/tmpy2xhkocx/tmpyf5iibwk.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s993058306 | p02537 | u919235786 | 1601172494 | Python | Python (3.8.2) | py | Runtime Error | 424 | 21464 | 312 | n,k=map(int,input().split())
a=[]
for i in range(n):
ai=int(input())
a.append(ai)
def rec(x):
ans=1
if x==n-1:
return 1
else:
for i in range(x+1,n):
if abs(a[i]-a[x])<=k:
ans=max(rec(i)+1,ans)
return ans
print(rec(0)) | Traceback (most recent call last):
File "/tmp/tmp5gy4rupp/tmpejh41o3m.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s375320795 | p02537 | u952491523 | 1601172442 | Python | PyPy3 (7.3.0) | py | Runtime Error | 672 | 110552 | 2103 | #####segfunc#####
def segfunc(x, y):
return max(x,y)
#################
#####ide_ele#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
def __init__(self, init_val, segfunc, i... | Traceback (most recent call last):
File "/tmp/tmpcczf2h8z/tmp2v1mnoo4.py", line 91, in <module>
main()
File "/tmp/tmpcczf2h8z/tmp2v1mnoo4.py", line 70, in main
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s592521090 | p02537 | u366886346 | 1601172427 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 20444 | 1303 | N,K=map(int,input().split())
class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.tree = [ide_ele] * 2 * self.num
# 配列の値を葉にセット
for i in range(n)... | Traceback (most recent call last):
File "/tmp/tmp2jd7wnoq/tmpvz3syrty.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s671475299 | p02537 | u910358825 | 1601172397 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 20940 | 346 | n,k=map(int, input().split())
a=[int(input()) for i in range(n)]
i=0
maxs=1
#lis=[]
for i in range(n-1):
cnt=1
j=1
while i<=n-2:
if abs(a[i+j]-a[i])<=k:
#lis.append(a[i+j])
#print(lis)
cnt+=1
i+=j
j=1
else:
j+=1
maxs... | Traceback (most recent call last):
File "/tmp/tmp2n2coel2/tmpjahi_4hk.py", line 1, in <module>
n,k=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s447156910 | p02537 | u919235786 | 1601172379 | Python | Python (3.8.2) | py | Runtime Error | 408 | 21512 | 316 | n,k=map(int,input().split())
a=[]
for i in range(n):
ai=int(input())
a.append(ai)
def rec(x):
ans=1
if x==n-1:
return 1
else:
for i in range(x+1,n):
if abs(a[i]-a[x])<=k:
ans=max(rec(i)+1,ans)
return ans
print(rec(0)) | Traceback (most recent call last):
File "/tmp/tmpuh_tveyp/tmp4sednj7w.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s424813475 | p02537 | u240444124 | 1601172254 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 23912 | 1654 | import sys,io,os
z=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
class SegmentTree:
def __init__(self, data, default=0, func=max):
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_length()
self.data = [default... | Traceback (most recent call last):
File "/tmp/tmppdupy09i/tmp0ba82xp0.py", line 43, in <module>
n,k=map(int,z().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s965387564 | p02537 | u366886346 | 1601172239 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 20356 | 1974 | N,K=map(int,input().split())
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
def __init__(self, init_val, segfunc, ide_ele):
"""
init_val: 配列の初期値
segfunc: 区間にしたい操作
id... | Traceback (most recent call last):
File "/tmp/tmpd2fgv9cp/tmp56qv865t.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s760968740 | p02537 | u631521893 | 1601172177 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8980 | 258 | n, k = map(int, input().split())
count = 0
for i in range(n):
a = int(input())
if i == 0:
prev = a
if abs(a - prev) <= k:
if count == 0:
if i != 0:
count += 2
prev = a
else:
count += 1
prev = a
print(count) | File "/tmp/tmpj141dcdq/tmpkv7lqp1c.py", line 14
prev = a
TabError: inconsistent use of tabs and spaces in indentation
| |
s634318566 | p02537 | u738257898 | 1601172172 | Python | Python (3.8.2) | py | Runtime Error | 388 | 21772 | 664 | def recursion(arr, length, idx, value, criteria, counta):
if idx >= length:
return counta
if arr[idx] - value <= criteria:
result_skip = recursion(arr, length, idx + 1, value, criteria, counta)
result_process = recursion(arr, length, idx + 1, arr[idx], criteria, counta+1)
if res... | Traceback (most recent call last):
File "/tmp/tmppp4lmq6m/tmpbj24bgd_.py", line 12, in <module>
n, k = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s542261578 | p02537 | u888092736 | 1601172151 | Python | PyPy3 (7.3.0) | py | Runtime Error | 535 | 122100 | 1036 | class SegmentTree:
def __init__(self, n, op, e):
self.n = 1 << (n - 1).bit_length()
self.op = op
self.e = e
self.data = [e] * (2 * self.n)
def update(self, k, v):
k += self.n
self.data[k] = v
while k > 0:
k >>= 1
self.data[k] = sel... | Traceback (most recent call last):
File "/tmp/tmp_63usg2a/tmpievcz0f_.py", line 32, in <module>
N, K, *A = map(int, open(0).read().split())
^^^^^^^^
ValueError: not enough values to unpack (expected at least 2, got 0)
| |
s002878213 | p02537 | u598296382 | 1601172099 | Python | PyPy3 (7.3.0) | py | Runtime Error | 732 | 92820 | 2148 | # セグ木
# 使う操作
#####segfunc#####
def segfunc1(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele1 = -float('inf')
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
... | Traceback (most recent call last):
File "/tmp/tmpgt0z_3pb/tmpj85d_bbw.py", line 71, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s782148844 | p02537 | u616382321 | 1601172052 | Python | Python (3.8.2) | py | Runtime Error | 1607 | 22968 | 578 | N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]
cnt = 0
for i in range(N):
if abs(A[i] - A[i+1]) <= K:
break
cnt += 1
dq = [A[cnt]]
i = cnt + 1
while i < N:
if abs(A[i] - A[i-1]) <= K and abs(A[i] - dq[-1]) <= K:
dq.append(A[i])
else:
for s in range(1,min(... | Traceback (most recent call last):
File "/tmp/tmpgld_20p4/tmph3miq0qd.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s868643240 | p02537 | u240444124 | 1601172049 | Python | Python (3.8.2) | py | Runtime Error | 211 | 23912 | 1640 | import sys,io,os
z=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
class SegmentTree:
def __init__(self, data, default=0, func=max):
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_length()
self.data = [default... | Traceback (most recent call last):
File "/tmp/tmpt5ooxgco/tmpr7hkgreu.py", line 43, in <module>
n,k=map(int,z().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s598957914 | p02537 | u919235786 | 1601172037 | Python | Python (3.8.2) | py | Runtime Error | 414 | 21648 | 316 | n,k=map(int,input().split())
a=[]
for i in range(n):
ai=int(input())
a.append(ai)
def rec(x):
ans=1
if x==n-1:
return 1
else:
for i in range(x+1,n):
if abs(a[i]-a[x])<=k:
ans=max(rec(i)+1,ans)
return ans
print(rec(0)) | Traceback (most recent call last):
File "/tmp/tmpzqscwby6/tmpil4ycbi6.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s885952444 | p02537 | u347640436 | 1601172028 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9004 | 2317 | package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func min(x, y int) int {
if x < y {
return x
}
return y
}
func max(x, y int) int {
if x > y {
return x
}
return y
}
type segmentTree struct {
offset int
data []int
op func(x, y int) int
e int
}
func newSegmentTree(n int, op func(x, y... | File "/tmp/tmph6i9bv8x/tmppueu80tb.py", line 1
package main
^^^^
SyntaxError: invalid syntax
| |
s313521196 | p02537 | u344030307 | 1601172020 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 11392 | 235 | n,k = map(int, input().split())
b = [0] * (n+1)
ans = 0
for i in range(n):
a = int(input())
m = b[a] + 1
s = max(1, a-k)
u = min(n+1, a+k+1)
for j in range(s, u):
b[j] = max(b[j],m)
if m > ans:
ans = m
print(ans) | Traceback (most recent call last):
File "/tmp/tmpzd67kjq7/tmp851irhgi.py", line 1, in <module>
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s709611947 | p02537 | u334712262 | 1601171995 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1191 | 126260 | 4286 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacem... | Traceback (most recent call last):
File "/tmp/tmpt575cxt3/tmptl2sh2y8.py", line 184, in <module>
main()
File "/tmp/tmpt575cxt3/tmptl2sh2y8.py", line 173, in main
N, K = read_int_n()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s663511416 | p02537 | u325282913 | 1601171929 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2240 | 1208804 | 2803 | import sys
sys.setrecursionlimit(10**8)
class Scc:
def __init__(self,n):
self.n = n
self.edges = []
def add_edge(self,fr,to):
assert 0 <= fr < self.n
assert 0 <= to < self.n
self.edges.append((fr, to))
def scc(self):
csr_start = [0] * (self.n + 1)
cs... | Traceback (most recent call last):
File "/tmp/tmppip2h55b/tmp76ger2wb.py", line 79, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s204327720 | p02537 | u738257898 | 1601171920 | Python | Python (3.8.2) | py | Runtime Error | 394 | 21772 | 716 |
def recursion(arr, idx, value, criteria, counta):
if idx >= len(arr):
return counta
# print(idx, value, arr[idx], 'criteria', criteria)
if arr[idx] - value <= criteria:
result_skip = recursion(arr, idx + 1, value, criteria, counta)
result_process = recursion(arr, idx + 1, arr[idx],... | Traceback (most recent call last):
File "/tmp/tmpz_g2mx6z/tmplrtzwugs.py", line 15, in <module>
n, k = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s304455501 | p02537 | u226849101 | 1601171919 | Python | Python (3.8.2) | py | Runtime Error | 441 | 24004 | 424 | N, K = map(int, input().split())
A = [-1 for i in range(N)]
dp = [-1 for i in range(N)]
for i in range(N):
A[i] = int(input())
def solve(p,a):
global N,K,A,dp
ans = 0
if dp[p] != -1:
ans = dp[p]
elif p==N-1:
ans = 0
elif abs(A[p]-a)>K:
ans = solve(p+1,a)
else:
... | Traceback (most recent call last):
File "/tmp/tmphh8lh1od/tmpvgk48xtm.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s751662296 | p02537 | u201928947 | 1601171890 | Python | PyPy3 (7.3.0) | py | Runtime Error | 813 | 78108 | 1102 | class SegTree:
X_unit = 0
X_f = max
def __init__(self, N):
self.N = N
self.X = [0] * (N + N)
def build(self, seq):
for i, x in enumerate(seq, self.N):
self.X[i] = x
for i in range(self.N - 1, 0, -1):
self.X[i] = self.X_f(self.X[i << 1], self.X[i ... | Traceback (most recent call last):
File "/tmp/tmpsa7l0wa_/tmpl03ijljt.py", line 38, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s816870079 | p02537 | u364774090 | 1601171888 | Python | Python (3.8.2) | py | Runtime Error | 500 | 20856 | 217 | N, K = [int(i) for i in input().split()]
A = [0] * N
for i in range(N):
A[i] = int(input())
ans = 0
i, j = 0, 1
while i < N - 1:
if abs(A[i] - A[j]) <= K:
ans += 1
i = j
j += 1
if ans > 0:
ans += 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp3ad670hz/tmpuuj8gcdg.py", line 1, in <module>
N, K = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s600136166 | p02537 | u321605735 | 1601171858 | Python | Python (3.8.2) | py | Runtime Error | 505 | 77792 | 231 | r=input().split()
N=int(r[0])
Q=int(r[1])
data="1"*N
d=[input().split() for i in range(Q)]
for i in range(Q):
data=data[0:int(d[i][0])-1]+d[i][2]*(int(d[i][1])-int(d[i][0])+1)+data[int(d[i][1]):N]
print(int(data)%998244353) | Traceback (most recent call last):
File "/tmp/tmpa99ddqu4/tmpnhgi1tce.py", line 1, in <module>
r=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s858070404 | p02537 | u528181687 | 1601171855 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 15696 | 211 | def main():
n, k = map(int, input().split())
cnt = [0] * (n+1)
for _ in range(n):
a = int(input())
m = max(cnt[max(a-k,0):min(a+k,n)+1])
cnt[a] = m+1
print(cnt[a])
main() | Traceback (most recent call last):
File "/tmp/tmp64zvlqbt/tmppyjsm2ki.py", line 10, in <module>
main()
File "/tmp/tmp64zvlqbt/tmppyjsm2ki.py", line 2, in main
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s225190432 | p02537 | u376752722 | 1601171839 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8956 | 137 | n, k = map(int, input())
a = []
for i in range(n):
if(i >= 1 and Math.abs(a[i-1] < a[i]) < k):
a.push(int(input()))
print(a.length()) | File "/tmp/tmp6yilr5cm/tmps90mob0q.py", line 5
a.push(int(input()))
^
IndentationError: expected an indented block after 'if' statement on line 4
| |
s106211785 | p02537 | u598296382 | 1601171833 | Python | PyPy3 (7.3.0) | py | Runtime Error | 778 | 92804 | 2144 | # セグ木
# 使う操作
#####segfunc#####
def segfunc1(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele1 = -float('inf')
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
... | Traceback (most recent call last):
File "/tmp/tmpv9avu8bq/tmpinkjic_9.py", line 71, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s876186871 | p02537 | u741579801 | 1601171829 | Python | Python (3.8.2) | py | Runtime Error | 818 | 23372 | 472 | N, K = [int(n) for n in input().split(" ")]
A = []
for _ in range(N):
A.append(int(input()))
D = [-1 for _ in range(300001)]
DD = []
ANS = -1
for n in range(N):
maxd = -1
for s in range(A[n] - K, A[n] + K + 1):
if s < 0 or s > 300001:
continue
d = D[s] + 1
if maxd <= ... | Traceback (most recent call last):
File "/tmp/tmps3z9_npn/tmpdi7pf83c.py", line 1, in <module>
N, K = [int(n) for n in input().split(" ")]
^^^^^^^
EOFError: EOF when reading a line
| |
s753735163 | p02537 | u397496203 | 1601171806 | Python | PyPy3 (7.3.0) | py | Runtime Error | 489 | 76276 | 1425 |
import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(input())
def input_int_list():
return [int(i) for i in input().split()]
class SegTree:
X_unit = 0
X_f = max
def __init__(self, N):
self.N = N
self.X =... | Traceback (most recent call last):
File "/tmp/tmp6y88fcmo/tmpk74ynxlq.py", line 71, in <module>
main()
File "/tmp/tmp6y88fcmo/tmpk74ynxlq.py", line 57, in main
n, k = input_int_list()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s157967957 | p02537 | u415718506 | 1601171770 | Python | Python (3.8.2) | py | Runtime Error | 511 | 54424 | 5944 | import types
_atcoder_code = """
# Python port of AtCoder Library.
__version__ = '0.0.1'
"""
atcoder = types.ModuleType('atcoder')
exec(_atcoder_code, atcoder.__dict__)
_atcoder__bit_code = """
def _ceil_pow2(n: int) -> int:
x = 0
while (1 << x) < n:
x += 1
return x
def _bsf(n: int) -> int:
... | Traceback (most recent call last):
File "/tmp/tmpuea2v7om/tmpo4bjm0mx.py", line 225, in <module>
nrows, k = list(map(int,inp[0].split()))
~~~^^^
IndexError: list index out of range
| |
s360436837 | p02537 | u415718506 | 1601171724 | Python | Python (3.8.2) | py | Runtime Error | 37 | 10616 | 1820 | import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict
# from atcoder.fenwicktree import FenwickTree
# available on Google, not available on Codeforces
# import numpy as np
# import scipy
import typing
from atcoder.segtree import SegTree
LARGE = 3*10**5
... | Traceback (most recent call last):
File "/tmp/tmpmqyad471/tmpaa9qtyjv.py", line 16, in <module>
from atcoder.segtree import SegTree
ModuleNotFoundError: No module named 'atcoder'
| |
s117291303 | p02537 | u910358825 | 1601171665 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 21024 | 338 | n,k=map(int, input().split())
a=[int(input()) for i in range(n)]
i,j=0,1
maxs=0
lis=[]
for i in range(n):
cnt=1
while i<n-1:
if abs(a[i+j]-a[i])<=k:
#lis.append(a[i+j])
#print(lis)
cnt+=1
i+=j
j=1
else:
j+=1
maxs=max(max... | Traceback (most recent call last):
File "/tmp/tmp6vqjemcq/tmpatf0fczh.py", line 1, in <module>
n,k=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s812660771 | p02537 | u201928947 | 1601171642 | Python | PyPy3 (7.3.0) | py | Runtime Error | 102 | 73384 | 1102 | class SegTree:
X_unit = 0
X_f = max
def __init__(self, N):
self.N = N
self.X = [0] * (N + N)
def build(self, seq):
for i, x in enumerate(seq, self.N):
self.X[i] = x
for i in range(self.N - 1, 0, -1):
self.X[i] = self.X_f(self.X[i << 1], self.X[i ... | Traceback (most recent call last):
File "/tmp/tmpz_uxwktr/tmpmezqpug8.py", line 38, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s514763790 | p02537 | u860829879 | 1601171634 | Python | PyPy3 (7.3.0) | py | Runtime Error | 671 | 102420 | 1164 | tmpn,k=map(int,input().split())
a=[int(input()) for _ in range(tmpn)]
n=3*10**5+2
def init_max(init_max_val):
#set_val
for i in range(n):
seg_max[i+num_max-1]=init_max_val[i]
#built
for i in range(num_max-2,-1,-1) :
seg_max[i]=max(seg_max[2*i+1],seg_max[2*i+2])
def update_max(... | Traceback (most recent call last):
File "/tmp/tmpu7qa96hp/tmp8bnpha6m.py", line 1, in <module>
tmpn,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s807699515 | p02537 | u745514010 | 1601171613 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2209 | 136616 | 2063 | import sys
input = sys.stdin.readline
def main():
n, k = map(int, input().split())
alst = [int(input()) for _ in range(n)]
N = max(alst) + 1
INF = 0
LV = (N-1).bit_length()
N0 = 2**LV
data = [INF]*(2*N0)
lazy = [None]*(2*N0)
def gindex(l, r):
L = (l + N0) >> 1... | Traceback (most recent call last):
File "/tmp/tmp4d0exb83/tmp5oaeqfgw.py", line 81, in <module>
main()
File "/tmp/tmp4d0exb83/tmp5oaeqfgw.py", line 5, in main
n, k = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s383141326 | p02537 | u102655885 | 1601171563 | Python | Python (3.8.2) | py | Runtime Error | 434 | 21724 | 902 | n, k = map(lambda x: int(x), input().split())
list_a = []
for _ in range(n):
list_a.append(int(input()))
memo = dict()
def subilst_max_length(current_value, i):
if (current_value, i) in memo.keys():
return memo[(current_value, i)]
if i == n-1:
if (current_value is None) or (abs(... | Traceback (most recent call last):
File "/tmp/tmpaxni9tx7/tmprn7vgvo4.py", line 1, in <module>
n, k = map(lambda x: int(x), input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s247031667 | p02537 | u486094752 | 1601171555 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9072 | 172 | N, K = map(int, input().split())
A = [int(input()) for i in range(5)]
ans = 1
i = 1
while( i <= N-2 ):
if ( abs(A[i]-A[i+1]) <= K ):
ans += 1
i += 1
print(ans) | Traceback (most recent call last):
File "/tmp/tmpytegc3_n/tmp98tiglwf.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s912422081 | p02537 | u152417130 | 1601171519 | Python | PyPy3 (7.3.0) | py | Runtime Error | 110 | 70644 | 3249 | class LazySegmentTree:
def __init__(self, data, default=0, func=max):
"""initialize the lazy segment tree with data"""
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_length()
self._lazy = [0] * (2 * _size... | Traceback (most recent call last):
File "/tmp/tmp03y3x_pk/tmp7oga1rjj.py", line 91, in <module>
n, k = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s803498600 | p02537 | u843135954 | 1601171507 | Python | PyPy3 (7.3.0) | py | Runtime Error | 462 | 78688 | 931 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n,k = na()
N = n
# N: 処理する区間の長さ
N0 = 2**(N-1).bit_length()
INF = 2**31-1
data = [0]*(2*N0)
# a_k の値... | Traceback (most recent call last):
File "/tmp/tmpoyolxh26/tmpyxah7ucf.py", line 9, in <module>
n,k = na()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s935791302 | p02537 | u054514819 | 1601171444 | Python | PyPy3 (7.3.0) | py | Runtime Error | 465 | 78752 | 1587 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, K = mapint()
def segfunc(x, y):
return max(x, y)
ide_ele = -1
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
... | Traceback (most recent call last):
File "/tmp/tmp3gcd292x/tmp0s_byetd.py", line 6, in <module>
N, K = mapint()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s481972572 | p02537 | u531599639 | 1601171431 | Python | PyPy3 (7.3.0) | py | Runtime Error | 154 | 68672 | 284 | n,k = map(int,input().split())
a = [int(input()) for _ in range(10)]
s = set()
ans = 0
for i in range(n):
cnt = 1
tmp = a[i]
for j in range(i+1,n):
if j in s:
break
if abs(a[j]-tmp)<=k:
cnt += 1
tmp = a[j]
s.add(j)
ans = max(ans,cnt)
print(ans) | Traceback (most recent call last):
File "/tmp/tmp_u4sv6f6/tmpymp1k6oh.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s548557052 | p02537 | u562767072 | 1601171403 | Python | Python (3.8.2) | py | Runtime Error | 348 | 38772 | 873 | #!/usr/bin/env python3
import os
import sys
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
def input():
return sys.stdin.readline().rstrip()
def main():
n, k = list(map(int, input().split()))
A = []
for i in range(n):
... | Traceback (most recent call last):
File "/tmp/tmpotybhtqq/tmpbstyy9_1.py", line 52, in <module>
main()
File "/tmp/tmpotybhtqq/tmpbstyy9_1.py", line 19, in main
n, k = list(map(int, input().split()))
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s059884955 | p02537 | u129019798 | 1601171402 | Python | PyPy3 (7.3.0) | py | Runtime Error | 411 | 95412 | 779 | def main():
import sys
from collections import deque
N,M=list(map(int,sys.stdin.readline().split()))
dic=[[] for _ in range(100001)]
sys.setrecursionlimit(100001)
mark=[0]*N
for i in range(M):
A,B=list(map(int,sys.stdin.readline().split()))
dic[A-1].append(B-1)
dic[B... | Traceback (most recent call last):
File "/tmp/tmpoph49ipc/tmps12y7p5r.py", line 35, in <module>
main()
File "/tmp/tmpoph49ipc/tmps12y7p5r.py", line 5, in main
N,M=list(map(int,sys.stdin.readline().split()))
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s051683771 | p02537 | u653026173 | 1601171359 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 15588 | 191 | n,k = map(int, input().split())
#a = list(map(int, input().split()))
cnt = [0]*(n+1)
for _ in range(n):
a = int(input())
cnt[a] = max(cnt[max(0,a-k):min(n,a+k+1)])+1
print(max(cnt)) | Traceback (most recent call last):
File "/tmp/tmp1x6n5an_/tmp5x2_jp96.py", line 1, in <module>
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s314572975 | p02537 | u250218230 | 1601171353 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 21020 | 339 | n,k = map(int,input().split())
a = []
for num in range(n):
a += [int(input())]
if (len(a) == 1):
print(1)
exit()
if (len(a) == 2):
if abs(a[0] - a[1]) > k:
print(1)
else:
print(2)
exit()
ch = 0
while (ch < len(a)):
#print(a,ch)
if abs(a[ch] - a[ch+1]) > k:
a.pop(ch+1)
ch -= 1
ch += ... | Traceback (most recent call last):
File "/tmp/tmpp8el2dbk/tmpzinisnad.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s455576285 | p02537 | u653026173 | 1601171328 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2212 | 173304 | 209 | #k = int(input())
n,k = map(int, input().split())
#a = list(map(int, input().split()))
cnt = [0]*(n+1)
for _ in range(n):
a = int(input())
cnt[a] = max(cnt[max(0,a-k):min(n,a+k+1)])+1
print(max(cnt)) | Traceback (most recent call last):
File "/tmp/tmpxin34lc9/tmps_gec39k.py", line 2, in <module>
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s822792015 | p02537 | u252405453 | 1601171270 | Python | Python (3.8.2) | py | Runtime Error | 393 | 24116 | 516 | def rec(pos, a, dp, n, k):
if dp[pos] != -1:
return dp[pos]
for nxt in range(pos + 1, n):
if abs(a[pos] - a[nxt]) <= k:
dp[pos] = rec(nxt, a, dp, n, k) + 1
return dp[pos]
dp[pos] = 1
return 1
def acl_beginner_d():
n, k = map(int, input().split())
a = []
... | Traceback (most recent call last):
File "/tmp/tmpnl_z_rae/tmps869y9s9.py", line 24, in <module>
acl_beginner_d()
File "/tmp/tmpnl_z_rae/tmps869y9s9.py", line 13, in acl_beginner_d
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s459375242 | p02537 | u627600101 | 1601171183 | Python | PyPy3 (7.3.0) | py | Runtime Error | 811 | 98016 | 2548 | #from collections import deque, Counter
#from heapq import heapify, heappop, heappush
#from bisect import insort
#from math import gcd
#from decimal import Decimal
#mod = 1000000007
#mod = 998244353
#N = int(input())
#####segfunc#####
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele... | Traceback (most recent call last):
File "/tmp/tmphfqg99vh/tmpi3wngb2n.py", line 80, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s591862485 | p02537 | u102655885 | 1601170979 | Python | Python (3.8.2) | py | Runtime Error | 435 | 21728 | 844 | n, k = map(lambda x: int(x), input().split())
list_a = []
for _ in range(n):
list_a.append(int(input()))
memo = dict()
def subilst_max_length(current_value, i):
if (current_value, i) in memo.keys():
return memo[(current_value, i)]
if i == n-1:
if abs(current_value - list_a[i]) <... | Traceback (most recent call last):
File "/tmp/tmpp9n69wdj/tmpairn0p_r.py", line 1, in <module>
n, k = map(lambda x: int(x), input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s379533773 | p02537 | u557714191 | 1601170952 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9156 | 354 | A = []
for i in range(N):
A.append(int(input()))
B = []
for j in range(N):
B.append(1)
for j in range(N):
for k in range(j):
if A[N-j-1] <= A[N-k-1] and A[N-k-1] - A[N-j-1] <= K:
B[N-j-1] = max(B[N-j-1], B[N-k-1] + 1)
elif A[N-k-1] < A[N-j-1] and A[N-j-1] - A[N-k-1] <= K:
B[N-j-1] = max(B[N... | Traceback (most recent call last):
File "/tmp/tmp3tp63wao/tmp2wltxror.py", line 2, in <module>
for i in range(N):
^
NameError: name 'N' is not defined
| |
s664596517 | p02537 | u782685137 | 1601170901 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 51740 | 634 | from functools import lru_cache
import sys
sys.setrecursionlimit(30000)
@lru_cache(maxsize=30000)
def subsolve(i):
a = As[i]
l=None
r=None
for j in range(i, 0, -1):
if a-k <= As[j-1] <= a and l==None:
l = subsolve(j-1)+1
if a < As[j-1] <= a+k and r==None:
r = sub... | Traceback (most recent call last):
File "/tmp/tmpk5rbszxs/tmpc7n2gyet.py", line 24, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s691212276 | p02537 | u631562787 | 1601170861 | Python | PyPy3 (7.3.0) | py | Runtime Error | 407 | 113880 | 425 | n,k=map(int,input().split())
a=list()
b=list()
c=list()
for i in range(0,n):
q=int(input())
a.append(q)
b.append(a[0])
c.append(a[1])
for i in range(1,n):
c=a[i]-a[i-1]
c=abs(c)
#print(c)
if(c<=k):
b.append(a[i])
for i in range(2,n):
c=a[i]-a[i-1]
c=abs(c)
#print(c)
... | Traceback (most recent call last):
File "/tmp/tmpt2fa_ej7/tmpqrpdofxk.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s333299133 | p02537 | u691896522 | 1601170831 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 35544 | 1372 | import sys
sys.setrecursionlimit(10**7)
n,k = map(int, input().split())
a = []
for i in range(n):
a.append(int(input()))
a.reverse()
# dp[i] := i番目の数字から始めたときの最大値
dp = [0 for i in range(n)]
#####segfunc######
def segfunc(x,y):
return max(x,y)
def init(init_val):
#set_val
for i in range(len(init_val)):
... | Traceback (most recent call last):
File "/tmp/tmp_1dvipb9/tmp0yeu8jbo.py", line 3, in <module>
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s692459746 | p02537 | u968846084 | 1601170742 | Python | PyPy3 (7.3.0) | py | Runtime Error | 774 | 82260 | 1043 | n,k=map(int,input().split())
#####segfunc######
def segfunc(x,y):
return max(x,y)
def init(init_val):
#set_val
for i in range(n):
seg[i+num-1]=init_val[i]
#built
for i in range(num-2,-1,-1) :
seg[i]=segfunc(seg[2*i+1],seg[2*i+2])
def update(k,x):
k += num-1
seg[k] ... | Traceback (most recent call last):
File "/tmp/tmpo_guafpz/tmpznto03m_.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s846704650 | p02537 | u252405453 | 1601170683 | Python | PyPy3 (7.3.0) | py | Runtime Error | 415 | 100128 | 500 | def rec(pos, a, dp, n, k):
if dp[pos] != -1:
return dp[pos]
for nxt in range(pos+1, n):
if abs(a[pos]-a[nxt])<=k:
dp[pos] = rec(nxt,a,dp,n,k)+1
return dp[pos]
dp[pos] = 1
return 1
def acl_beginner_d():
n, k = map(int, input().split())
a = []
for _ in r... | Traceback (most recent call last):
File "/tmp/tmpgs5j59w4/tmpcveuv16_.py", line 20, in <module>
acl_beginner_d()
File "/tmp/tmpgs5j59w4/tmpcveuv16_.py", line 11, in acl_beginner_d
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s363088562 | p02537 | u557714191 | 1601170670 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8984 | 249 | A = []
for i in range(N):
A.append(int(input()))
B = []
for j in range(N):
B.append(1)
for j in range(N):
for k in range(j):
if (A[N-j-1] - A[N-k-1])*(A[N-j-1] - A[N-k-1]) <= K*K:
B[N-j-1] = max(B[N-j-1], B[N-k-1] + 1)
print(max(B)) | Traceback (most recent call last):
File "/tmp/tmprzv7en6u/tmp6k8yin05.py", line 2, in <module>
for i in range(N):
^
NameError: name 'N' is not defined
| |
s227122839 | p02537 | u782685137 | 1601170614 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 34468 | 594 | from functools import lru_cache
@lru_cache(maxsize=40000)
def subsolve(i):
a = As[i]
l=None
r=None
for j in range(i, 0, -1):
if a-k <= As[j-1] <= a and l==None:
l = subsolve(j-1)+1
if a < As[j-1] <= a+k and r==None:
r = subsolve(j-1)+1
if l!=None and r!=N... | Traceback (most recent call last):
File "/tmp/tmp0km1krfw/tmphruf4eya.py", line 22, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s679699718 | p02537 | u598296382 | 1601170606 | Python | PyPy3 (7.3.0) | py | Runtime Error | 161 | 78476 | 288 | n,k = map(int,input().split())
low = [0]*(10**5 * 3 + 1) #iで終わる長さ
for i in range(n):
a = int(input())
for j in range(max(0,a-k),a):
low[a] = max(low[a],low[j] + 1)
for j in range(a+1,a+k+1):
low[a] = max(low[a],low[j] + 1)
ans = max(low)
print(ans) | Traceback (most recent call last):
File "/tmp/tmpqsqpw_if/tmpbf83ctf9.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s400407390 | p02537 | u998732100 | 1601170574 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8836 | 838 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000007;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; ret... | File "/tmp/tmpqzxzqo73/tmpp5dkfvo5.py", line 10
const long long INF = 1LL << 60;
^
SyntaxError: invalid decimal literal
| |
s412255882 | p02537 | u054514819 | 1601170573 | Python | PyPy3 (7.3.0) | py | Runtime Error | 430 | 78796 | 1589 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, K = mapint()
def segfunc(x, y):
return max(x, y)
ide_ele = -1
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
... | Traceback (most recent call last):
File "/tmp/tmp58ucbvg6/tmp2m74cpvn.py", line 6, in <module>
N, K = mapint()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s149928920 | p02537 | u923172145 | 1601170373 | Python | PyPy3 (7.3.0) | py | Runtime Error | 417 | 93052 | 2251 | #####segfunc#####
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele = -1
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
def __init__(self, init... | Traceback (most recent call last):
File "/tmp/tmpp89lselo/tmpqk4vcofw.py", line 69, in <module>
N, K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s605120621 | p02537 | u733581231 | 1601170315 | Python | Python (3.8.2) | py | Runtime Error | 362 | 209068 | 1054 | #: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
input = sys.stdin.readline
##########... | Exception in thread Thread-1 (solve):
Traceback (most recent call last):
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **... | |
s380269947 | p02537 | u024340351 | 1601170276 | Python | Python (3.8.2) | py | Runtime Error | 400 | 23304 | 1027 | N, K = map(int, input().split())
A = []
for i in range (0, N):
A.append(int(input()))
def longest_subseq(n, k, a):
# Creating a list with all 0's of size equal to the length of string
dp = [0] * n
# Supporting list with
# all 0's of size 26 since
# the given string consists ... | Traceback (most recent call last):
File "/tmp/tmpyttedf7b/tmpf6uz2y3a.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s763430545 | p02537 | u745514010 | 1601170233 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 134672 | 1487 | N, k = map(int, input().split())
alst = [int(input()) for _ in range(N)]
INF = 0
LV = (N-1).bit_length()
N0 = 2**LV
data = [INF]*(2*N0)
lazy = [None]*(2*N0)
def gindex(l, r):
L = (l + N0) >> 1; R = (r + N0) >> 1
lc = 0 if l & 1 else (L & -L).bit_length()
rc = 0 if r & 1 else (R & -R).bit_length()
for... | Traceback (most recent call last):
File "/tmp/tmp5q6jj4nl/tmpaa6p2t12.py", line 1, in <module>
N, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s407198316 | p02537 | u161701206 | 1601170191 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9220 | 160 | n,k = map(int,input().split())
ans = [int(input())]
for _ in n:
a = int(input())
b = int(input())
if a - b >= 3 or b - a >= 3:
ans.append(b) | Traceback (most recent call last):
File "/tmp/tmpiwv92mwo/tmpnntik7gc.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s190263170 | p02537 | u325227960 | 1601169970 | Python | PyPy3 (7.3.0) | py | Runtime Error | 186 | 83600 | 286 | import sys
input = sys.stdin.readline
n, k = map(int,input().split())
A = [int(input()) for i in range(n)]
from atcoder.segtree import SegTree
l = 3*10**5 + 10
S = SegTree(max, 0, l)
for i in range(n):
S.set(A[i], S.prod(max(0, A[i]-k), min(l, A[i]+k+1)) + 1)
print(S.all_prod()) | Traceback (most recent call last):
File "/tmp/tmped5oegqp/tmpqp5yf7yw.py", line 3, in <module>
n, k = map(int,input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s341947776 | p02537 | u528045862 | 1601169845 | Python | PyPy3 (7.3.0) | py | Runtime Error | 684 | 80328 | 2071 | #####segfunc#####
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
def __init__(self, init... | Traceback (most recent call last):
File "/tmp/tmpkroq8ng5/tmp4d907kzy.py", line 70, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s452628141 | p02537 | u615285493 | 1601169514 | Python | PyPy3 (7.3.0) | py | Runtime Error | 423 | 96272 | 3712 | import os
import sys
from io import BytesIO, IOBase
class SegmentTree:
def __init__(self, data, default=0, func=max):
"""initialize the segment tree with data"""
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_len... | Traceback (most recent call last):
File "/tmp/tmpjc7ut_qs/tmpa93lr9lx.py", line 131, in <module>
main()
File "/tmp/tmpjc7ut_qs/tmpa93lr9lx.py", line 57, in main
n, k = getints()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s755927811 | p02537 | u864197622 | 1601169387 | Python | PyPy3 (7.3.0) | py | Runtime Error | 907 | 119352 | 5118 | import sys
input = lambda: sys.stdin.readline().rstrip()
class SegmentTreeDual():
def __init__(self, init, initX, unitA, g, h):
self.g = g # (X, A, size) -> X
self.h = h # (A, A) -> A
self.unitA = unitA
if type(init) == int:
self.n = init
self.n = 1 << (self.n... | Traceback (most recent call last):
File "/tmp/tmpo16bldwq/tmp5gn_l1uz.py", line 132, in <module>
N, K = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s468345128 | p02537 | u467736898 | 1601169375 | Python | Python (3.8.2) | py | Runtime Error | 1427 | 36564 | 14275 | # TODO: 更新ルールの異なる複数のセグ木を作ったときに正しく動くか検証
# TODO: 引数の順番間違えたりすると黙って落ちるのを何とかする
# 注: PyPy で普通に書いた方が速い
code_segtree = r"""
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "structmember.h"
// >>> AtCoder >>>
#ifndef ATCODER_SEGTREE_HPP
#define ATCODER_SEGTREE_HPP 1
#include <algorithm>
#ifndef ATCODER_INTERNAL_BITO... | atcoder_library_wrapper.cpp: In function ‘int SegTree_init(SegTree*, PyObject*)’:
atcoder_library_wrapper.cpp:251:20: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
251 | while(item = PyIter_Next(iterator)) {
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Traceback (mos... | |
s206695093 | p02537 | u588341295 | 1601169361 | Python | PyPy3 (7.3.0) | py | Runtime Error | 744 | 118220 | 3972 | import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)]... | Traceback (most recent call last):
File "/tmp/tmpdcrt1uk4/tmpmfmnnq3n.py", line 132, in <module>
N, K = MAP()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s312548933 | p02537 | u589969467 | 1601169344 | Python | PyPy3 (7.3.0) | py | Runtime Error | 425 | 96796 | 360 | def dfs(i,ans):
if i == n:
return
if len(ans) == 0:
ans.append(a[i])
dfs(i+1,ans)
else:
if abs(ans[-1]-a[i])<=k:
ans.append(a[i])
dfs(i+1,ans)
n,k = map(int,input().split())
ans = []
a = []
for i in range(n):
a.append(int(input()))
#print(a)
mx = 0
for i in range(n):
tmp = []
dfs(... | Traceback (most recent call last):
File "/tmp/tmpxbiv7cfp/tmpivu8f3le.py", line 12, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s041904597 | p02537 | u875291233 | 1601169208 | Python | PyPy3 (7.3.0) | py | Runtime Error | 515 | 97776 | 3287 | class segment_tree:
__slots__ = ["op_M", "e_M","N","N0","dat"]
def __init__(self, N, operator_M, e_M):
self.op_M = operator_M
self.e_M = e_M
self.N = N
self.N0 = 1<<(N-1).bit_length()
self.dat = [self.e_M]*(2*self.N0)
# 長さNの配列 initial で初期化
def build(self, ini... | Traceback (most recent call last):
File "/tmp/tmpqwh167if/tmpuxdmgx3i.py", line 105, in <module>
n,k = map(int, readline().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.