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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s135009629 | p03745 | u596276291 | 1508181804 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38512 | 1204 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")
def main():
N, M = map(int, input().split())
graph = defaultdic... |
s033881269 | p03745 | u596276291 | 1508181043 | Python | PyPy3 (2.4.0) | py | Runtime Error | 203 | 39664 | 1055 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")
def main():
N, M = map(int, input().split())
graph = defaultdic... |
s158174043 | p03745 | u835482198 | 1500874853 | Python | Python (3.4.3) | py | Runtime Error | 19 | 5132 | 660 | N = int(input())
A = list(map(int, input().split))
# N = 9
# A = [1, 2, 1, 2, 1, 2, 1, 2, 1]
# N = 7
# A = [1, 2, 3, 2, 1, 999999999, 1000000000]
# N = 6
# A = [1, 2, 3, 2, 2, 1]
# N = 2
# A = [1, 1]
A = A + [A[-1]]
d = 0
i = 0
inc = None
while i < N:
if inc is None:
if A[i] < A[i + 1]:
inc = ... |
s555068359 | p03745 | u329749432 | 1500507383 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 773 | n = int(input())
a = [int(i) for i in input().split()]
count = 1
state = 'none'
b = [a[0]]
for i in range(1,n):
if state=='none':
before=b.pop()
now = a[i]
if before<now:
b.append(now)
state='incr'
elif before>now:
b.append(now)
state... |
s512375502 | p03745 | u089230684 | 1500454628 | Python | Python (3.4.3) | py | Runtime Error | 84 | 14436 | 928 | from sys import stdin
def main():
global lista
n = int(stdin.readline())
lista = [int(x) for x in stdin.readline().strip().split()]
inx = 0
inx = cuenta(inx)
flag = lista[inx] >= lista[inx+1];
cont = 0
tempc = 0
while(inx < len(lista)-1):
if flag:
if(lista[inx]... |
s911770383 | p03745 | u994537255 | 1494466612 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 593 | # -*- encoding:uff-8 -*-
inp_N = row_input()
inp_arr = row_input()
N = int(inp_N)
arr = list(map(int, inp_arr.split(" ")))
def no_down(arr):
for i in range(len(arr)-1):
if arr[i] > arr[i+1]:
return False
return True
def no_up(arr):
for i in range(len(arr)-1):
if arr[i] < ... |
s337034460 | p03745 | u254343015 | 1493858721 | Python | Python (2.7.6) | py | Runtime Error | 97 | 11320 | 278 |
N = int(raw_input())
A = map(int,raw_input().split())
count=1
z1=0
for i in range(N-1):
if A[i+1]-A[i]>0:
z2=1
elif A[i+1]-A[i]<0:
z2=-1
elif A[i+1]-A[i]==0:
z=0
if z2*z1<0:
count+=1
if z2!=0:
z1=z2
print str(count) |
s705717600 | p03745 | u254343015 | 1493858556 | Python | Python (2.7.6) | py | Runtime Error | 88 | 11320 | 276 | N = int(raw_input())
A = map(int,raw_input().split())
count=1
z1=0
for i in range(N-1):
if A[i+1]-A[i]>0:
z2=1
elif A[i+1]-A[i]<0:
z=-1
elif A[i+1]-A[i]==0:
z=0
if z2*z1<0:
count+=1
if z2!=0:
z1=z2
print str(count) |
s286960725 | p03745 | u602860891 | 1493246359 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 617 | N, M = list(map(int, input().split()))
line_list = list()
for _ in range(M):
a, b = list(map(int, input().split()))
line_list.append((a, b))
path_points = [ line_list[0][0], line_list[0][1] ]
for i in range(1, M):
if line_list[i][0] not in path_points and line_list[i][1] not in path_points:
break
... |
s567756578 | p03745 | u602860891 | 1493241913 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 898 | N, L, T = list(map(int, input().split()))
X = []
W = []
X_after = []
for _ in range(N):
x, w = list(map(int, input().split()))
if w == 1:
x_after = (x + T) % L
else:
x_after = (x - T) % L
x_after = x_after if x_after >= 0 else L + x_after
X.append(x)
W.append(w)
X_after.... |
s116255364 | p03745 | u341087021 | 1492976396 | Python | Python (3.4.3) | py | Runtime Error | 47 | 15020 | 436 | import sys
n = int(input())
a = [int(x) for x in sys.stdin.readline().split()]
ans = 1
def checker():
if l[0]-l[1]>0:
for i in range(1,n-1):
if a[i]-a[i+1]>=0:
continue
else:
ans += 1
for _ in range(i):
a.pop(0)
elif l[0]-l[1]<0:
for i in range(1,n-1):
if a[i]-a[i+1]<=0:
continue
... |
s287860893 | p03745 | u341087021 | 1492976257 | Python | Python (3.4.3) | py | Runtime Error | 46 | 15020 | 442 | import sys
n = int(input())
a = [int(x) for x in sys.stdin.readline().split()]
ans = 1
def checker():
if l[0]-l[1]>0:
for i in range(1,n-1):
while a[i]-a[i+1]>=0:
continue
else:
ans += 1
for _ in range(i):
a.pop(0)
elif l[0]-l[1]<0:
for i in range(1,n-1):
while a[i]-a[i+1]<=0:
contin... |
s978095115 | p03745 | u855110644 | 1492654039 | Python | Python (2.7.6) | py | Runtime Error | 1818 | 139960 | 717 | def cutter(nums):
if len(nums) < 2:
return []
for i in xrange(1, len(nums)):
if int(nums[i]) != int(nums[i-1]):
pos = i
flag = int(nums[i]) > int(nums[i-1]) # is asc?
# print flag
break
else:
return []
for i in xrange(pos, le... |
s777378107 | p03745 | u908619525 | 1492476135 | Python | Python (2.7.6) | py | Runtime Error | 89 | 14420 | 244 | N = input()
A = map(int, raw_input().split())
ans = 0
tmp2 = 99
for a1, a2 in zip(A, A[1:]):
if a1 < a2:
tmp = 1
elif a1 > a2:
tmp = -1
if tmp != tmp2:
ans = ans + 1
tmp2 = tmp
print ans
|
s400309380 | p03745 | u177756077 | 1492360671 | Python | Python (2.7.6) | py | Runtime Error | 56 | 11320 | 227 | #!/usr/bin/env python
n=int(raw_input().strip())
arr=map(int,raw_input().split())
b=0
cnt=0
for i in xrange(n-1):
diff=arr[i+1]-arr[i]
if b*diff<0:
cnt+=1
b=0
elif d==0:
b=diff
print cnt+1 |
s842030122 | p03745 | u054556734 | 1492317281 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 676 | n,l,t=map(int,input().split())
x=[0 for i in range(n+1)]
w=[0 for i in range(n+1)]
ans=[]
ans2=[0 for i in range(n)]
w1=[]
w2=[]
for i in range(1,n+1):
x[i],w[i]=map(int,input().split())
if w[i]==1: a=(x[i]+t)%l; w1.append(x[i])
if w[i]==2: a=(x[i]-t+l)%l; w2.append(x[i])
ans.append(a)
# kはアリ1がずれ違った数。... |
s300396187 | p03745 | u052746401 | 1492315724 | Python | Python (3.4.3) | py | Runtime Error | 92 | 14228 | 525 | n = int(input())
a = list(map(int, input().split()))
ans = 1
def incr(a,b):
if a>b:
return -1
elif a==b:
return 0
else:
return 1
init = incr(a[0], a[1])
flag = True
for i in range(1, n-1):
tmp = incr(a[i], a[i+1])
#print("a[i]=", a[i]," a[i+1]=", a[i+1], " init=", init, " tmp... |
s398976415 | p03745 | u581309643 | 1492313328 | Python | Python (3.4.3) | py | Runtime Error | 374 | 21792 | 765 | import numpy as np
N, L, T = map(int, input().split())
X = []
W = []
ant = [i for i in range(N)]
for i in range(N):
xi, wi = map(int, input().split())
X.append(xi)
W.append(wi)
npX = np.array(X).astype(np.float)
npW = np.array(W).astype(np.float)
npW[npW == 2] = -1
def swap(ant, i, j):
tmp = ant[i]
... |
s072657047 | p03745 | u391812144 | 1492311915 | Python | Python (3.4.3) | py | Runtime Error | 124 | 15416 | 768 | n = int(input())
aString = str(input())
aStringAry = aString.split(' ')
aIntAry = []
for i in range(n-1):
if aStringAry[i] != aStringAry[i + 1]:
aIntAry.append(int(aStringAry[i]))
aIntAry.append(int(aStringAry[n - 1]))
answer = 0
kioku = 0
for i in range(len(aIntAry)):
if i + 2 <= n:
#print(s... |
s766931579 | p03745 | u391812144 | 1492311728 | Python | Python (3.4.3) | py | Runtime Error | 115 | 15416 | 768 | n = int(input())
aString = str(input())
aStringAry = aString.split(' ')
aIntAry = []
for i in range(n-1):
if aStringAry[i] != aStringAry[i + 1]:
aIntAry.append(int(aStringAry[i]))
aIntAry.append(int(aStringAry[n - 1]))
answer = 0
kioku = 0
for i in range(len(aIntAry)):
if i + 2 <= n:
#print(s... |
s437069937 | p03745 | u054556734 | 1492311244 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 386 | n,l,t=map(int,input().split())
x=[0 for i in range(n+1)]
w=[0 for i in range(n+1)]
ans=[0 for i in range(n+1)]
ans2=[0 for i in range(n)]
for i in range(1,n+1):
x[i],w[i]=map(int,input().split())
if w[i]==1: ans[i]=(x[i]+t)%l
if w[i]==2: ans[i]=(x[i]-t+l)%l
ans.pop(0)
k=min(w.count(1),w.count(2))
for i in... |
s756609733 | p03745 | u054556734 | 1492311080 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 397 | n,l,t=map(int,input().split())
x=[0 for i in range(n+1)]
w=[0 for i in range(n+1)]
ans=[0 for i in range(n+1)]
ans2=[0 for i in range(n)]
for i in range(1,n+1):
x[i],w[i]=map(int,input().split())
if w[i]==1: ans[i]=(x[i]+t)%l
if w[i]==2: ans[i]=(x[i]-t+l)%l
ans.pop(0)
print(ans)
k=min(w.count(1),w.count(2... |
s235356313 | p03745 | u893209854 | 1492309650 | Python | Python (2.7.6) | py | Runtime Error | 2068 | 136916 | 713 | N = int(raw_input())
a = map(int, raw_input().split(" "))
cnt = 0
tmp = []
df = 0
for x in a:
print tmp,
print cnt
if len(tmp) == 0:
tmp.append(x)
df = 0
cnt = cnt + 1
else:
if tmp[-1] == x:
pass
elif tmp[-1] < x:
if df >= 0:
... |
s387951575 | p03745 | u442810826 | 1492309624 | Python | Python (2.7.6) | py | Runtime Error | 340 | 19428 | 303 | import numpy as np
N = map(int,raw_input().split())
N=N[0]
A = map(int,raw_input().split())
A = np.array(A)
r=A[1]-A[0]
count = 0
r = A[1:] -A[:-1]
r = np.array([_ for _ in r if not _ == 0])
r = r[1:] * r[:-1]
count = len([1 for _ in r if _ <0])
if not count==0:
print(count+1)
else:
print(0)
|
s502590616 | p03745 | u829682256 | 1492309567 | Python | Python (3.4.3) | py | Runtime Error | 149 | 13584 | 638 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
f = 0
if a[1]-a[0]>0.0:
sign = 1.0
elif a[1]-a[0]<0.0:
sign = -1.0
else:
sign = 0.0
f = 1
time = 0.0
while time < int(N - 1):
time = time + 1.0
if f == 1:
f = 0
if a[int(time)]-a[int(time-1)]>0.0:
sign = 1.0
elif a[int(time)]-a[int(ti... |
s008909948 | p03745 | u829682256 | 1492309456 | Python | Python (3.4.3) | py | Runtime Error | 149 | 13584 | 606 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
f = 0
if a[1]-a[0]>0.0:
sign = 1.0
elif a[1]-a[0]<0.0:
sign = -1.0
else:
sign = 0.0
f = 1
time = 0.0
while time < int(N - 1):
time = time + 1.0
if f == 1:
f = 0
if a[int(time)]-a[int(time-1)]>0.0:
sign = 1.0
elif a[int(time)]-a[int(ti... |
s147727535 | p03745 | u829682256 | 1492309365 | Python | Python (3.4.3) | py | Runtime Error | 152 | 13584 | 607 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
f = 0
if a[1]-a[0]>0.0:
sign = 1.0
elif a[1]-a[0]<0.0:
sign = -1.0
else:
sign = -1.0
f = 1
time = 0.0
while time < int(N - 1):
time = time + 1.0
if f == 1:
f = 0
if a[int(time)]-a[int(time-1)]>0.0:
sign = 1.0
elif a[int(time)]-a[int(t... |
s677182811 | p03745 | u829682256 | 1492309071 | Python | Python (3.4.3) | py | Runtime Error | 156 | 13584 | 564 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0.0
f = 0
while time < int(N - 1):
time = time + 1
if f == 1:
f = 0
if a[int(time)]-a[int(time-1)]>0.0:
sign = 1.0
elif a[int(time)]-a[int(time-1)]<0.0:
sign = -1.0
if (a[int(time... |
s938589038 | p03745 | u391812144 | 1492309051 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11484 | 1910 | import sys
def check(aStringAry,start,end):
aaa = end - start
e = 0
startc = start
for ii in range(aaa):
if aStringAry[startc + 1 + ii] - aStringAry[startc + ii] != 0:
e = 1
else:
start = startc + 1 + ii
if e == 0:
return('t')
mode = 0
n = 0
... |
s726360348 | p03745 | u829682256 | 1492308910 | Python | Python (3.4.3) | py | Runtime Error | 117 | 13660 | 512 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
f = 0
while time < int(N - 1):
time = time + 1
if f == 1:
f = 0
if a[time]-a[time-1]>0.0:
sign = 1.0
elif a[time]-a[time-1]<0.0:
sign = -1.0
if (a[time]-a[time-1])*sign<0.0:
c... |
s719108599 | p03745 | u829682256 | 1492308811 | Python | Python (3.4.3) | py | Runtime Error | 133 | 13584 | 504 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
f = 0
while time < int(N - 1):
time = time + 1
if f == 1:
if a[time]-a[time-1]>0.0:
sign = 1.0
elif a[time]-a[time-1]<0.0:
sign = -1.0
if (a[time]-a[time-1])*sign<0.0:
count = c... |
s789264030 | p03745 | u829682256 | 1492308676 | Python | Python (3.4.3) | py | Runtime Error | 135 | 13660 | 507 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
while time < int(N - 1):
time = time + 1
if (a[time]-a[time-1])*sign<0.0:
count = count + 1.0
if time < N - 1:
if a[time+1]-a[time]>0.0:
sign = 1.0
elif a[time+1]-a[time]<0.0:
... |
s926923031 | p03745 | u829682256 | 1492308503 | Python | Python (3.4.3) | py | Runtime Error | 139 | 13584 | 487 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
while time < int(N - 1):
time = time + 1
if (a[time]-a[time-1])*sign<0.0:
count = count + 1.0
if time < N - 1:
if a[time+1]-a[time]>0.0:
sign = 1.0
elif a[time+1]-a[time]<0.0:
... |
s184256000 | p03745 | u829682256 | 1492308433 | Python | Python (3.4.3) | py | Runtime Error | 129 | 13584 | 482 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
while time < N - 1:
time = time + 1
if (a[time]-a[time-1])*sign<0.0:
count = count + 1.0
if time < N - 1:
if a[time+1]-a[time]>0.0:
sign = 1.0
elif a[time+1]-a[time]<0.0:
s... |
s151244183 | p03745 | u829682256 | 1492308361 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 481 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
while time < N - 1:
time = time + 1
if (a[time]-a[time-1])*sign<0.0:
count = count + 1.0
if time < N - 1:
if a[time+1]-a[time]>0.0:
sign = 1.0
elif a[time+1]-a[time]<0.0:
s... |
s426675548 | p03745 | u442810826 | 1492308232 | Python | Python (2.7.6) | py | Runtime Error | 85 | 11296 | 210 | N = map(int,raw_input().split())
N=N[0]
A = map(int,raw_input().split())
r=A[1]-A[0]
count = 0
for i in range(1, N-1):
_r = A[i+1] - A[i]
if r*_r<0:
count += 1
r = _r
print(count+1)
|
s348852317 | p03745 | u829682256 | 1492308119 | Python | Python (3.4.3) | py | Runtime Error | 128 | 13584 | 477 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
while time < N - 1:
time = time + 1
if (a[time]-a[time-1])*sign<0.0:
count = count + 1.0
if time < N - 1:
if a[time+1]-a[time]>0.0:
sign = 1.0
elif a[time+1]-a[time]<0.0:
s... |
s285213146 | p03745 | u829682256 | 1492308073 | Python | Python (3.4.3) | py | Runtime Error | 129 | 13660 | 480 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
while time < N - 1:
time = time + 1
if (a[time]-a[time-1])*sign<0.0:
count = count + 1.0
if time < N - 1:
if a[time+1]-a[time]>0.0:
sign = 1.0
elif a[time+1]-a[time]<0.0:
s... |
s260049299 | p03745 | u854685751 | 1492307889 | Python | Python (3.4.3) | py | Runtime Error | 242 | 23440 | 542 | N = int(input())
a = list(map(int, input().split(" ")))
l = [[] for i in range(N)]
c = 0
s = 0
t = a[0]
for i in a[1:]:
if t > i:
l[s].append((c))
s = c+1
c += 1
t = i
else:
l[s].append((c))
c = 0
s = 0
t = a[0]
for i in a[1:]:
if t < i:
l[s].append((c))
s = c+1
c += 1
t = i
else:
l[s].append((c)... |
s686317546 | p03745 | u829682256 | 1492307776 | Python | Python (3.4.3) | py | Runtime Error | 145 | 13484 | 364 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
time = 0
while time < N - 1:
time = time + 1
if (a[time]-a[time-1])*sign<0.0:
count = count + 1.0
print(sign)
if time < N - 1:
if a[time+1]-a[time]>=0.0:
sign = 1.0
else:
sign = -... |
s669430488 | p03745 | u603167064 | 1492307618 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38768 | 991 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
N,M = map(int,input().split())
G = [[] for i in range(N)]
visited = [False for i in range(N)]
for i in range(M):
a,b = map(lambda x:int(x)-1,input().split())
G[a].append(b)
G[b].append(a)
s = 0
t = G[s][0]
path = [s,t]
solved = [False, False]
visited[s] = ... |
s152624147 | p03745 | u052746401 | 1492306835 | Python | Python (3.4.3) | py | Runtime Error | 94 | 14252 | 367 | n = int(input())
a = list(map(int, input().split()))
del_a = [a[i+1]-a[i] for i in range(n-1)]
ans = 1
tmp = 0
before = del_a[0]
length = 1
for i in range(1,n-1):
tmp = del_a[i]
if(before*tmp<0)and(length>1):
length = 1
ans += 1
elif(before*tmp<0)and(i==n-2):
ans+=1
else:
... |
s564461081 | p03745 | u926678805 | 1492306752 | Python | Python (3.4.3) | py | Runtime Error | 107 | 14224 | 567 | # coding: utf-8
n=int(input())
data=list(map(int,input().split()))
ans=1
def check(index,v=0):
global data
global ans
if index+1<len(data):
if data[index]==data[index+1]:
check(index+1,v)
elif data[index]<data[index+1]:
if v==1 or v==0:
check(index+1,1... |
s000306250 | p03745 | u829682256 | 1492306377 | Python | Python (3.4.3) | py | Runtime Error | 78 | 14252 | 224 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>=0.0:
sign = 1.0
else:
sign = -1.0
pre_a = 0.0
for n in a:
if (n-pre_a)*sign<0:
count = count + 1
sign *= -1
pre_a = n
print(count+1)
|
s239310487 | p03745 | u829682256 | 1492306290 | Python | Python (3.4.3) | py | Runtime Error | 75 | 13484 | 221 | N = float(input())
a = list(map(float, input().split()))
count = 0.0
if a[1]-a[0]>0:
sign = 1.0
else:
sign = -1.0
pre_a = 0.0
for n in a:
if (n-pre_a)*sign<0:
count = count + 1
sign *= -1
pre_a = n
print(count+1)
|
s231056924 | p03745 | u829682256 | 1492306191 | Python | Python (3.4.3) | py | Runtime Error | 76 | 13484 | 219 | N = float(input())
a = list(map(float, input().split()))
count = 0
if a[1]-a[0]>0:
sign = 1.0
else:
sign = -1.0
pre_a = 0.0
for n in a:
if (n-pre_a)*sign<0:
count = count + 1
sign *= -1
pre_a = n
print(count+1)
|
s243581090 | p03745 | u829682256 | 1492306082 | Python | Python (3.4.3) | py | Runtime Error | 63 | 13484 | 206 | N = float(input())
a = list(map(float, input().split()))
count = 0
if a[1]-a[0]>0:
sign = 1.0
else:
sign = -1.0
pre_a = 0.0
for n in a:
if (n-pre_a)*sign<0:
count = count + 1
pre_a = n
print(count+1)
|
s503239936 | p03745 | u602860891 | 1492305831 | Python | Python (3.4.3) | py | Runtime Error | 104 | 15020 | 372 | import math
N = int(input())
A_list = list(map(int, input().split()))
num_split = 1
sign = None
len_A_list = len(A_list)
for i in range(len_A_list-1):
if sign == None:
sign = (A_list[i+1] - A_list[i]) / math.fabs(A_list[i+1] - A_list[i])
if (A_list[i+1] - A_list[i]) * sign >= 0:
continue
... |
s041225702 | p03745 | u556160473 | 1492305668 | Python | Python (3.4.3) | py | Runtime Error | 128 | 14436 | 344 | n = int(input())
a_ = list(map(int, input().split(' ')))
a = [-1]
i = 0
while i < n:
if a[-1] != a_[i]:
a.append(a_[i])
i += 1
a = a[1:]
ret = 1
i = 0
while i < n-2:
if (a[i] > a[i+1] and a[i+1] < a[i+2]) or (a[i] < a[i+1] and a[i+1] > a[i+2]):
ret += 1
i += 2
else:
i ... |
s153527626 | p03745 | u471797506 | 1492305475 | Python | Python (2.7.6) | py | Runtime Error | 108 | 11296 | 349 | # -*- coding: utf-8 -*-
N = int(raw_input())
A = map(int, raw_input().split())
B = [A[0]]
for ai in A[1:]:
if B[-1] != ai:
B.append(ai)
A = B[:]
ans = 1
i = 0
while i < N - 2:
if A[i] <= A[i + 1] <= A[i + 2]:
i += 1
elif A[i] >= A[i + 1] >= A[i + 2]:
i += 1
else:
ans +=... |
s391351221 | p03745 | u432042540 | 1492305352 | Python | Python (3.4.3) | py | Runtime Error | 83 | 14252 | 604 | n = int(input())
a = [int(i) for i in input().split()]
if n > 1:
dif = a[1] - a[0]
if dif > 0:
state = 1
elif dif < 0:
state = -1
else:
state = 0
s = 0
if n > 1:
for i in range(1,n):
dif = a[i] - a[i-1]
if state == 1:
if dif < 0:
s += 1
... |
s947922328 | p03745 | u432042540 | 1492305255 | Python | Python (3.4.3) | py | Runtime Error | 81 | 14252 | 511 | n = int(input())
a = [int(i) for i in input().split()]
dif = a[1] - a[0]
if dif > 0:
state = 1
elif dif < 0:
state = -1
else:
state = 0
s = 0
for i in range(1,n):
dif = a[i] - a[i-1]
if state == 1:
if dif < 0:
s += 1
state = 0
elif state == -1:
if dif... |
s130097445 | p03745 | u603167064 | 1492305046 | Python | Python (3.4.3) | py | Runtime Error | 74 | 14252 | 475 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int,input().split()))
tend = 1 if A[0] < A[1] else -1
count = 1
prev = A[1]
for a in A[2:]:
if prev < a and tend < 0:
tend = 0
count += 1
elif prev > a and tend > 0:
tend = 0
count += 1
elif tend =... |
s879078475 | p03746 | u730769327 | 1599807514 | Python | PyPy3 (7.3.0) | py | Runtime Error | 293 | 92604 | 385 | def dfs(now):
vis[now]=1
res=[now]
for to in e[now]:
if vis[to]:continue
else:
res+=dfs(to)
break
return res
n,m=map(int,input().split())
e=[[]for _ in range(n+1)]
vis=[0]*(n+1)
for _ in range(m):
a,b=map(int,input().split())
e[a]+=[b]
e[b]+=[a]
ans=dfs(1)
for i in e[1]:
if vis[i]:
... |
s139146519 | p03746 | u535803878 | 1594267115 | Python | PyPy3 (7.3.0) | py | Runtime Error | 284 | 112680 | 869 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
from collections import defaultdict
n,m = map(int, input().split())
ns = defaultdict(set)
for _ in range(n-1):
u,v = map(int, input().split())
u -= 1
v -= 1
ns[u... |
s663272686 | p03746 | u571969099 | 1584221244 | Python | Python (3.4.3) | py | Runtime Error | 37 | 10364 | 730 | import heapq
n, x = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
tt = [[] for _ in range(10 ** 5 + 1)]
for i in range(n):
tt[t[i]].append(-a[i])
def max_score(time):
q = []
heapq.heapify(q)
for i in range(time, 10 ** 5 + 1):
for... |
s213765034 | p03746 | u644907318 | 1581429533 | Python | PyPy3 (2.4.0) | py | Runtime Error | 724 | 69220 | 450 | def makePath(x):
for y in G[x]:
if hist[y]==0:
A.append(y)
hist[y] = 1
makePath(y)
return
return
N,M = map(int,input().split())
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
a,b = map(int,input().split())
G[a].append(b)
G[b].append(a)
A =... |
s634437963 | p03746 | u644907318 | 1581428701 | Python | PyPy3 (2.4.0) | py | Runtime Error | 766 | 73048 | 487 | def makePath(x):
for y in G[x]:
if hist[y]==0:
A.append(y)
hist[y] = 1
makePath(y)
return
N,M = map(int,input().split())
G = {}
for _ in range(M):
a,b = map(int,input().split())
if a not in G:
G[a] = []
G[a].append(b)
if b not in G:
... |
s563712725 | p03746 | u644907318 | 1581428536 | Python | PyPy3 (2.4.0) | py | Runtime Error | 774 | 73048 | 491 | def makePath(x):
for y in G[x]:
if hist[y]==0:
A.append(y)
hist[y] = 1
makePath(y)
return
N,M = map(int,input().split())
G = {}
for _ in range(M):
a,b = map(int,input().split())
if a not in G:
G[a] = []
G[a].append(b)
if b not in G:
... |
s907490543 | p03746 | u141610915 | 1581126539 | Python | PyPy3 (2.4.0) | py | Runtime Error | 447 | 68828 | 690 | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, M = map(int, input().split())
e = dd(list)
inc = [0] * (N + 1)
for _ in range(M):
u, v = map(int, input().split())
e[u].append(v)
e[v].append(u)
inc[u] += 1
inc[v] += 1
s = 0
inc[0] = float("inf")
for i in range(N):
if inc[i]... |
s320148818 | p03746 | u754022296 | 1578164303 | Python | Python (3.4.3) | py | Runtime Error | 483 | 22924 | 429 | n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
seen = [False]*n
def dfs(v, rep):
seen[v] = True
for nv in G[v]:
if seen[nv]:
continue
rep.append(nv+1)
dfs(nv, rep)
break
els... |
s718378263 | p03746 | u754022296 | 1578164184 | Python | Python (3.4.3) | py | Runtime Error | 703 | 109292 | 470 | import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
seen = [False]*n
def dfs(v, rep):
seen[v] = True
for nv in G[v]:
if seen[nv]:
continue
rep.appe... |
s990120542 | p03746 | u754022296 | 1578164150 | Python | Python (3.4.3) | py | Runtime Error | 463 | 22916 | 429 | n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
seen = [False]*n
def dfs(v, rep):
seen[v] = True
for nv in G[v]:
if seen[nv]:
continue
rep.append(nv+1)
dfs(nv, rep)
break
els... |
s700778558 | p03746 | u263830634 | 1577550393 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 792 | N, M = map(int, input().split())
G = [[] for _ in range(N + 1)]
for _ in range(M):
A, B = map(int, input().split())
G[A].append(B)
G[B].append(A)
check = [0] * (N + 1)
check[1] = 1
ans1 = [1]
stack = [1]
while stack:
tmp = stack.pop()
for next_ in G[tmp]:
if check[next_] == 1:
... |
s134776620 | p03746 | u929569377 | 1572829709 | Python | Python (3.4.3) | py | Runtime Error | 490 | 23284 | 597 | from collections import deque
N, M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
A, B = map(int, input().split())
A -= 1
B -= 1
E[A].append(B)
E[B].append(A)
visited = [False for _ in range(N)]
ans = deque()
def dfs(p, one):
if visited[p]:
return False
... |
s443661661 | p03746 | u619819312 | 1568677604 | Python | Python (3.4.3) | py | Runtime Error | 410 | 22064 | 824 | n,m=map(int,input().split())
s=[[]for i in range(n+1)]
t=[1]*(n+1)
p=0
for i in range(m):
a,b=map(int,input().split())
if i==0:
k=[a,b]
t[a],t[b]=0,0
else:
if a==k[0] and t[b]==1:
k=[b]+k
elif b==k[0] and t[a]==1:
k=[a]+k
elif a==k[1] and t[b]=... |
s309084034 | p03746 | u155024797 | 1568436098 | Python | PyPy3 (2.4.0) | py | Runtime Error | 746 | 77344 | 825 | from collections import deque
def remove(adj, a):
for nxt in adj[a]:
adj[nxt].remove(a)
def main():
N, M = map(int, input().split())
adj = [set() for _ in range(N+1)]
for _ in range(M):
a, b = map(int, input().split())
adj[a].add(b)
adj[b].add(a)
ans = deque([a, b... |
s806800972 | p03746 | u414425367 | 1567533788 | Python | PyPy3 (2.4.0) | py | Runtime Error | 735 | 60448 | 434 | N,M=map(int,input().split())
edges=[[] for _ in range(N)]
for _ in range(M):
A,B=map(int,input().split())
edges[A-1].append(B-1)
edges[B-1].append(A-1)
visited=[False]*N
path=[]
def dfs(curr):
visited[curr] = True
path.append(curr)
for dst in edges[curr]:
if not visited[dst]:
... |
s499480401 | p03746 | u414425367 | 1567533630 | Python | PyPy3 (2.4.0) | py | Runtime Error | 782 | 60448 | 486 | N,M=map(int,input().split())
edges=[[] for _ in range(N)]
for _ in range(M):
A,B=map(int,input().split())
edges[A-1].append(B-1)
edges[B-1].append(A-1)
visited=[False]*N
def dfs(curr, path):
visited[curr] = True
path.append(curr)
for dst in edges[curr]:
if not visited[dst]:
... |
s060048389 | p03746 | u414425367 | 1567533545 | Python | PyPy3 (2.4.0) | py | Runtime Error | 712 | 60448 | 555 | def dfs(curr, path, N, edges, visited):
visited[curr] = True
path.append(curr)
for dst in edges[curr]:
if not visited[dst]:
return dfs(dst, path, N, edges, visited)
return path
N,M=map(int,input().split())
edges=[[] for _ in range(N)]
for _ in range(M):
A,B=map(int,input().split... |
s772345812 | p03746 | u414425367 | 1567533486 | Python | PyPy3 (2.4.0) | py | Runtime Error | 764 | 60448 | 537 | def dfs(curr, path, N, edges, visited):
visited[curr] = True
path.append(curr)
for dst in edges[curr]:
if not visited[dst]:
return dfs(dst, path, N, edges, visited)
return path
N,M=map(int,input().split())
edges=[[] for _ in range(N)]
for _ in range(M):
A,B=map(int,input().split... |
s630076269 | p03746 | u102461423 | 1566519129 | Python | Python (3.4.3) | py | Runtime Error | 380 | 40628 | 830 | import sys
input = sys.stdin.readline
from collections import deque
# 伸ばせる限り伸ばせば答
N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N)]
graph = [[] for _ in range(N+1)]
for a,b in AB:
graph[a].append(b)
graph[b].append(a)
path = deque(AB[0])
visited = set(AB[0])
while T... |
s138174011 | p03746 | u102461423 | 1566518998 | Python | Python (3.4.3) | py | Runtime Error | 435 | 40628 | 807 | import sys
input = sys.stdin.readline
from collections import deque
# 伸ばせる限り伸ばせば答
N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N)]
graph = [[] for _ in range(N+1)]
for a,b in AB:
graph[a].append(b)
graph[b].append(a)
path = deque(AB[0])
visited = set(AB[0])
while T... |
s778881255 | p03746 | u620480037 | 1563630997 | Python | PyPy3 (2.4.0) | py | Runtime Error | 319 | 53936 | 938 | import sys
input=sys.stdin.readline
M,N=map(int,input().split())
R=[1 for i in range(N+1)]
A,B=map(int,input().split())
R[A]=0
R[B]=0
L=[[]for i in range(N+1)]
L[A].append(B)
L[B].append(A)
for i in range(M):
a,b=map(int,input().split())
L[a].append(b)
L[b].append(a)
l=[A]
P=A
#print(L)
for i in range... |
s231317171 | p03746 | u620480037 | 1562948498 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2112 | 143324 | 785 | N,M=map(int,input().split())
a,b=map(int,input().split())
A=[a]
B=[b]
l=[1 for i in range(N+1)]
L=[[]for i in range(N+1)]
for i in range(M-1):
x,y=map(int,input().split())
L[x].append(y)
L[y].append(x)
l[a]=0
l[b]=0
P=a
for i in range(10**5):
for j in L[P]:
if l[j]==0:
pas... |
s300959678 | p03746 | u620480037 | 1562905488 | Python | Python (3.4.3) | py | Runtime Error | 568 | 26052 | 684 | N,M=map(int,input().split())
a,b=map(int,input().split())
A=[a]
B=[b]
L=[1 for i in range(N+1)]
L[a]=0
L[b]=0
l=[[]for i in range(N+1)]
for i in range(M-1):
x,y=map(int,input().split())
l[x].append(y)
l[y].append(x)
def findA(a):
for i in l[a]:
if L[i]==0:
pass
else:
... |
s460595720 | p03746 | u620480037 | 1562905317 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2116 | 142940 | 684 | N,M=map(int,input().split())
a,b=map(int,input().split())
A=[a]
B=[b]
L=[1 for i in range(N+1)]
L[a]=0
L[b]=0
l=[[]for i in range(N+1)]
for i in range(M-1):
x,y=map(int,input().split())
l[x].append(y)
l[y].append(x)
def findA(a):
for i in l[a]:
if L[i]==0:
pass
else:
... |
s665944687 | p03746 | u171366497 | 1560236628 | Python | Python (3.4.3) | py | Runtime Error | 555 | 39592 | 1615 | N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
a,b=map(int,input().split())
branch[a]|={b}
branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
def dfs1(check,visited,P):
while len(check)>0:
now=check.pop()
for nex in bran... |
s018707647 | p03746 | u171366497 | 1560236546 | Python | Python (3.4.3) | py | Runtime Error | 2134 | 410872 | 1604 | N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
a,b=map(int,input().split())
branch[a]|={b}
branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
def dfs1(check,visited,P):
while len(check)>0:
now=check.pop()
for nex in bran... |
s830591085 | p03746 | u171366497 | 1560236464 | Python | Python (3.4.3) | py | Runtime Error | 2128 | 408800 | 1589 | N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
a,b=map(int,input().split())
branch[a]|={b}
branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
print(1)
def dfs1(check,visited,P):
while len(check)>0:
now=check.pop()
for ne... |
s789964455 | p03746 | u171366497 | 1560236386 | Python | Python (3.4.3) | py | Runtime Error | 2128 | 408800 | 1580 | N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
a,b=map(int,input().split())
branch[a]|={b}
branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
def dfs1(check,visited,P):
while len(check)>0:
now=check.pop()
for nex in bran... |
s571019526 | p03746 | u171366497 | 1560236305 | Python | Python (3.4.3) | py | Runtime Error | 2127 | 408824 | 1580 | N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
a,b=map(int,input().split())
branch[a]|={b}
branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
def dfs1(check,visited,P):
while len(check)>0:
now=check.pop()
for nex in bran... |
s074559931 | p03746 | u171366497 | 1560235866 | Python | Python (3.4.3) | py | Runtime Error | 2123 | 314624 | 1443 | N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
a,b=map(int,input().split())
branch[a]|={b}
branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
path=[0]
if jisuu.count(1)>=2:
start=jisuu.index(1)
visited={start}
check=[[start]]
... |
s697430889 | p03746 | u171366497 | 1560235420 | Python | Python (3.4.3) | py | Runtime Error | 2123 | 320384 | 1424 | N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
a,b=map(int,input().split())
branch[a]|={b}
branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
if jisuu.count(1)>=2:
start=jisuu.index(1)
visited={start}
check=[[start]]
while l... |
s952529168 | p03746 | u623819879 | 1558579561 | Python | PyPy3 (2.4.0) | py | Runtime Error | 689 | 69444 | 699 | from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(1+n)]
v=[0]*(1+n)
for i in range(m):
if i==1:
q=[a,b]
v[a]=v[b]=1
a,b=map(int,input().split())
g[a].append(b)
g[b].append(a)
p=[q[-1]]
path=[]
while p:
cur=p.pop()
path.append(cur)
v[cur]=1
f... |
s386159196 | p03746 | u623819879 | 1558579443 | Python | PyPy3 (2.4.0) | py | Runtime Error | 673 | 69408 | 712 | from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(1+n)]
v=[0]*(1+n)
for i in range(m):
if i==1:
q=[a,b]
v[a]=v[b]=1
a,b=map(int,input().split())
g[a].append(b)
g[b].append(a)
p=deque(q[-1:])
path=[]
while p:
cur=p.pop()
path.append(cur)
v[cur]=1... |
s645085796 | p03746 | u633757735 | 1558145420 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 990 | #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
int main(void)
{
LL n, m;
cin >> n >> m;
vector<vector<LL>> a(n+1);
vector<bool> b(n+1, false);
vector<LL> s(1),t(1);
cin... |
s170026273 | p03746 | u729133443 | 1554755172 | Python | PyPy2 (5.6.0) | py | Runtime Error | 35 | 28012 | 377 | import sys
sys.setrecursionlimit(10**6)
def solve(v):
t=[]
for u in e[v]:
if not f[u]:
f[u]=1
t=solve(u)+t
break
return [v]+t
n,m,*t=map(int,open(0).read().split())
e=[[]for _ in range(n+1)]
for a,b in zip(t[::2],t[1::2]):
e[a].append(b)
e[b].append(a)
f=[... |
s441563117 | p03746 | u729133443 | 1554755023 | Python | Python (3.4.3) | py | Runtime Error | 230 | 25252 | 337 | def solve(v):
t=[]
for u in e[v]:
if not f[u]:
f[u]=1
t=solve(u)+t
break
return [v]+t
n,m,*t=map(int,open(0).read().split())
e=[[]for _ in range(n+1)]
for a,b in zip(t[::2],t[1::2]):
e[a].append(b)
e[b].append(a)
f=[0]*-~n
f[1]=1
a=solve(1)[:0:-1]+solve(1)... |
s575585388 | p03746 | u564902833 | 1554247913 | Python | Python (3.4.3) | py | Runtime Error | 570 | 57464 | 705 | # 入力
N, M = map(int, input().split())
A, B = zip(*(map(int, input().split()) for _ in range(M)))
# 隣接リスト表現のグラフに変換
E = [[] for _ in range(N + 1)]
for a, b in zip(A, B):
E[a].append(b)
E[b].append(a)
# 訪れたことがあるかどうかのフラグ
v = [i == 1 for i in range(N + 1)]
# 訪れたことのない頂点を深さ優先探索する
def dfs(i, p):
for j in E[i]:
... |
s730751601 | p03746 | u745087332 | 1552033205 | Python | Python (3.4.3) | py | Runtime Error | 411 | 27996 | 1251 | # coding:utf-8
import sys
from collections import deque, defaultdict
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.r... |
s498556376 | p03746 | u272557899 | 1551843410 | Python | Python (3.4.3) | py | Runtime Error | 864 | 48052 | 600 | n, m = map(int, input().split())
c = []
for i in range(n):#h:高さ
c.append([int(m) for m in input().split()])
graph = {}
for i in range(n):
graph[i + 1] = []
for i in range(n):
graph[c[i][0]] = graph[c[i][0]] + [c[i][1]]
graph[c[i][1]] = graph[c[i][1]] + [c[i][0]]
stack = []
start = 1
i = start
visited ... |
s977661373 | p03746 | u270681687 | 1551368299 | Python | Python (3.4.3) | py | Runtime Error | 556 | 30424 | 1222 | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(m)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
start = -1
for v in range(n):
if len(g[v]) == 0:
continue
start = v
break
memo = [0] * n
m... |
s133301048 | p03746 | u270681687 | 1551368162 | Python | Python (3.4.3) | py | Runtime Error | 524 | 29108 | 1222 | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(m)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
start = -1
for v in range(n):
if len(g[v]) == 0:
continue
start = v
break
memo = [0] * n
m... |
s025025036 | p03746 | u270681687 | 1551368068 | Python | Python (3.4.3) | py | Runtime Error | 544 | 29100 | 1222 | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(m)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
start = -1
for v in range(n):
if len(g[v]) == 0:
continue
start = v
break
memo = [0] * n
m... |
s659438875 | p03746 | u270681687 | 1551367809 | Python | Python (3.4.3) | py | Runtime Error | 567 | 28852 | 1199 | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(m)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
start = -1
for v in range(n):
if len(g[v]) == 0:
continue
start = v
break
memo = [0] * n
m... |
s487285968 | p03746 | u270681687 | 1551367774 | Python | Python (3.4.3) | py | Runtime Error | 556 | 28828 | 1184 | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(m)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
start = -1
for v in range(n):
if len(g[v]) == 0:
continue
start = v
break
memo = [0] * n
m... |
s308152021 | p03746 | u270681687 | 1551367611 | Python | Python (3.4.3) | py | Runtime Error | 616 | 25036 | 1202 | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(m)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
start = -1
for v in range(n):
if len(g[v]) == 0:
continue
start = v
break
memo = [0] * n
m... |
s819926716 | p03746 | u619631862 | 1546102258 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1309 | 77472 | 569 | def i1():
return int(input())
def i2():
return [int(i) for i in input().split()]
[n,m]=i2()
e=[[] for i in range(n+100)]
for i in range(m):
[a,b]=i2()
e[a].append(b)
e[b].append(a)
import sys
sys.setrecursionlimit(10000)
d=[0 for i in range(n+100)]
dd=[]
def dfs1(v):
d[v]=1
for i in e[v]:
if d[... |
s380553075 | p03746 | u619631862 | 1546100148 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1307 | 77088 | 614 | def i1():
return int(input())
def i2():
return [int(i) for i in input().split()]
[n,m]=i2()
e=[[] for i in range(n+100)]
for i in range(m):
[a,b]=i2()
e[a].append(b)
e[b].append(a)
import sys
sys.setrecursionlimit(10000)
d=[0 for i in range(n+100)]
dd=[]
def dfs1(v):
d[v]=1
for i in range(len(e[v])):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.