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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s825983096 | p03745 | u798818115 | 1571447019 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14252 | 254 | N=int(input())
A=list(map(int,input().split()))
ans=0
pre=A[1]-A[0]
cool=True
for i in range(N-2):
temp=A[i+2]-A[i+1]
if pre*temp<0 and cool:
ans+=1
cool=False
else:
cool=True
pre=temp
print(ans+1)
|
s545867742 | p03745 | u325227960 | 1571301681 | Python | PyPy3 (2.4.0) | py | Runtime Error | 231 | 62704 | 396 | n = int(input())
A = list(map(int,input().split()))
i = 0
def w(i):
# print(i)
if A[i] - A[i-1] == 0:
return 0
else:
return (A[i]-A[i-1]) / abs(A[i]-A[i-1])
v = w(1)
ans = 1
i = 2
while i < n:
nv = w(i)
if nv * v < 0:
ans += 1
i += 2
if i == n+1:
... |
s772794574 | p03745 | u325227960 | 1571300326 | Python | PyPy3 (2.4.0) | py | Runtime Error | 227 | 62832 | 270 | n = int(input())
A = list(map(int,input().split()))
v = (A[1]-A[0]) / abs(A[1]-A[0])
ans = 1
i = 2
while i < n:
if (A[i] - A[i-1]) * v < 0:
v *= -1
ans += 1
i += 2
if i == n+1:
ans += 1
else:
i += 1
print(ans) |
s034917764 | p03745 | u035431655 | 1570566971 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 453 | N, L, T = list(map(int, input().split()))
data = [list(map(int, input().split())) for _ in range(N)]
d = {1: 1, 2: -1}
# ่ปใๅ็นใ้้ใใๅๆฐ
n_origins = 0
positions = []
for i, (x, w) in enumerate(data):
_x = (x + d[w] * T) % L
n_origin = int((x + d[w] * T) // L)
n_origins += n_origin
positions.append(_x)
p... |
s851201597 | p03745 | u035431655 | 1570566830 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 432 | N, L, T = list(map(int, input().split()))
data = [list(map(int, input().split())) for _ in range(N)]
d = {1: 1, 2: -1}
# ่ปใๅ็นใ้้ใใๅๆฐ
n_origins = 0
positions = []
for i, (x, w) in enumerate(data):
_x = (x + d[w] * T) % L
n_origin = int((x + d[w] * T) // L)
n_origins += n_origin
positions.append(_x)
p... |
s608225053 | p03745 | u035431655 | 1570565298 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 792 | N, L, T = list(map(int, input().split()))
data = [list(map(int, input().split())) for _ in range(N)]
d = {1: 1, 2: -1}
x0, w0 = data[0]
d0 = d[w0]
# 0็ช็ฎใฎ่ปใๅๆ่จๅใใฎๅ ดๅใๅจๅใใฆใใ่ก็ชใใใใใ`ๅ
จ้ท + ็พๅจไฝ็ฝฎ`ใๅๆๅคใงใใใจ่ใใ
if w0 == 2:
x0 += L
# 0็ช็ฎใฎ่ปใ่ก็ชใใๅๆฐ
n_collisions = 0
positions = []
for i, (x, w) in enumerate(data):
_x = (x +... |
s530257570 | p03745 | u204616996 | 1570223280 | Python | Python (3.4.3) | py | Runtime Error | 1574 | 14252 | 451 | N=int(input())
A = list(map(int,input().split()))
def chk(i,j):
if i < j:
return 0
else:
return 1
ans=1
a=A.pop(0)
x = chk(a,A[0])
while A!=[]:
b = A.pop(0)
if x == 0 and a>b:
ans+=1
if A != []:
x=chk(b,A[0])
else:
break
elif x =... |
s064997613 | p03745 | u204616996 | 1570221765 | Python | Python (3.4.3) | py | Runtime Error | 93 | 14252 | 275 | N=int(input())
A = list(map(int,input().split()))
ans=1
if A[0] <A[1]:
x=0
else:
x=1
i=1
while i<N-1:
if x == 0 and A[i]>A[i+1]:
ans+=1
x+=1
x=x%2
elif x==1 and A[i]<A[i+1]:
ans+=1
x+=1
x=x%2
i+=1
print(ans) |
s251695424 | p03745 | u204616996 | 1570221628 | Python | Python (3.4.3) | py | Runtime Error | 83 | 14252 | 248 | N=int(input())
A = list(map(int,input().split()))
ans=1
if A[0] <A[1]:
x=0
else:
x=1
i=1
while i<N-1:
if x == 0 and A[i]>A[i+1]:
ans+=1
x+=1
x=x%2
elif x==1 and A[i]<A[i+1]:
ans+=1
i+=1
print(ans) |
s071188385 | p03745 | u634461820 | 1569609273 | Python | PyPy3 (2.4.0) | py | Runtime Error | 241 | 63596 | 356 | N = int(input())
a = list(map(int,input().split()))
data = []
for i in range(N-1):
if a[i+1]-a[i] == 0:
continue
else:
data.append(a[i+1]-a[i])
#print(data)
ans = 0
i = 0
while i<len(data)-1:
if (data[i+1] * data[i]) < 0:
ans += 1
i += 1
left = i
i += 1
else:
if left == len(data):
pa... |
s988040855 | p03745 | u541883958 | 1566702782 | Python | Python (3.4.3) | py | Runtime Error | 46 | 14436 | 614 | n = int(input())
a = [int(c) for c in input().split(' ')]
prev = None
c = 1
inc = None
for i in range(l):
current = a[i]
if i == 0 :
continue
if inc == None:
if a[i] > a[i-1] :
inc = True
elif a[i] < a[i - 1]:
inc = False
else:
... |
s272011824 | p03745 | u493491792 | 1565822126 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 272 | n,c,k=map(int,input().split())
lista=[int(input())for i in range(n)]
listb=sorted(lista)
count=0
bustime=0
buspeople=0
for i in listb:
if buspeople==0 or bustime<i:
count+=1
buspeople=c-1
bustime=i+k
else :
buspeople-=1
print(count) |
s891286326 | p03745 | u821432765 | 1565666395 | Python | Python (3.4.3) | py | Runtime Error | 113 | 14436 | 537 | n=int(input())
a=[int(i) for i in input().split()]
ud = []
for i in range(n-1):
k="u" if a[i] < a[i+1] else "d" if a[i] > a[i+1] else False
if not k:
if len(ud)==0:
continue
else:
k=ud[i-1]
ud.append(k)
def ccount(l): # v: finding val, l: list
ans = 0
i = 0
... |
s185651399 | p03745 | u285443936 | 1565666201 | Python | Python (3.4.3) | py | Runtime Error | 91 | 14252 | 344 | N = int(input())
A = [int(i) for i in input().split()]
ans = 1
if A[1] - A[0] > 0:
pre = 1
elif A[1] - A[0] == 0:
pre = 0
else:
pre = -1
for i in range(2,N):
if A[i] - A[i-1] > 0:
now = 1
elif A[i] - A[i-1] == 0:
now = 0
else:
now = -1
if now*pre < 0:
ans += 1
pre = 0
else:
pre ... |
s819908091 | p03745 | u948524308 | 1564938974 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 341 | N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
i = 0
ans = 0
while i < N:
t = T[i]
x = T.count(T[i])
ans = ans + (x-1+C)//C
for j in range(i+((x-1+C)//C)*C-1,N):
if T[j]>t+K:
y = j-i
break
y = N-i
y=min(C,y)
i... |
s257600506 | p03745 | u948524308 | 1564928728 | Python | Python (3.4.3) | py | Runtime Error | 92 | 14252 | 213 | N = int(input())
A = list(map(int,input().split()))
c = 0
i =2
if N ==1 or N ==2:
print(1)
exit()
while i<N+1:
if (A[i-1]-A[i-2])*(A[i]-A[i-1])<0:
c=c+1
i = i+1
i = i+1
print(c+1) |
s304430506 | p03745 | u172111219 | 1564886226 | Python | Python (3.4.3) | py | Runtime Error | 73 | 14252 | 725 | def main():
n = int(input())
ls = [int(x) for x in input().split()]
right,left = 0,1
cnt = 0
flg = 0
while 1:
now = ls[left]
nex = ls[right]
if now<nex:
if flg ==-1:
cnt +=1
flg = 0
else:
flg = 1
... |
s925427881 | p03745 | u097317219 | 1564684189 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14252 | 230 | n = int(input())
a = list(map(int,input().split()))
i = 1
ans = 1
while(i<=n-2):
if (a[i]-a[i-1]>=0) and (a[i+1]-a[i]>=0) or (a[i]-a[i-1]<=0) and (a[i+1]-a[i]<=0):
cotinue
else:
ans += 1
i += 1
i += 1
print(ans) |
s832039812 | p03745 | u097317219 | 1564683962 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14252 | 225 | n = int(input())
a = list(map(int,input().split()))
i = 1
ans = 1
while(i<=n-2):
if (a[i]-a[i-1]>=0 and a[i+1]-a[i]>=0) or (a[i]-a[i-1]<=0 and a[i+1]-a[i]<=0):
cotinue
else:
ans += 1
i += 1
i += 1
print(ans) |
s275575751 | p03745 | u097317219 | 1564683846 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 225 | n = int(input())
a = list(map(int,input().split()))
i = 1
ans = 1
while (1<=n-2):
if (a[i]-a[i-1]>=0 and a[i+1]-a[i]>=0) or a[i]-a[i-1]<=0 and a[i+1]-a[i]<=0):
cotinue
else:
ans += 1
i += 1
i += 1
print(ans) |
s480845120 | p03745 | u097317219 | 1564683812 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 225 | n = int(input())
a = list(map(int,input().split()))
i = 1
ans = 1
whlie (1<=n-2):
if (a[i]-a[i-1]>=0 and a[i+1]-a[i]>=0) or a[i]-a[i-1]<=0 and a[i+1]-a[i]<=0):
cotinue
else:
ans += 1
i += 1
i += 1
print(ans) |
s167722571 | p03745 | u214434454 | 1563559124 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3320 | 2388 | n,l,T = map(int,input().split())
s = [0 for i in range(n)]
for i in range(n):
s[i] = list(map(int, input().split()))
def f(w):
if w == 1:
return 1
elif w == 2:
return -1
t = 0
d = l
i_d = []
while t < T:
for i in range(n):
if i < n-1 :
if s[i][0] < s[i+1][0] an... |
s065706240 | p03745 | u292735000 | 1563494379 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14224 | 395 | n = int(input())
a = list(map(int, input().split()))
if a[1] > a[0]:
inc = True
else:
inc = False
count = 1
for i in range(2, len(a)):
if a[i] > a[i - 1]:
if inc:
pass
else:
count += 1
inc = False
elif a[i] < a[i - 1]:
if inc:
cou... |
s837269908 | p03745 | u292735000 | 1563493280 | Python | Python (3.4.3) | py | Runtime Error | 95 | 15116 | 435 | n = int(input())
a = list(map(int, input().split()))
diff_list = [a[i] - a[i - 1] for i in range(1, len(a))]
print(diff_list)
diff = a[1] - a[0]
count = 1
for i in range(2, len(a)):
if a[i] - a[i - 1] != 1:
count += 1
elif a[i] - a[i - 1] == 1:
if diff != 1:
count += 1
dif... |
s920540672 | p03745 | u882209234 | 1563468420 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14252 | 251 | N = int(input())
A = list(map(int,input().split()))
dif = [0] * (N-1)
for i in range(1,N): dif[i-1] = A[i] - A[i-1]
ans = 1
t = dif[0]
for i in range(N-1):
if dif[i]*t < 0:
ans += 1
if i < N-2:
t = dif[i+1]
print(ans) |
s153420775 | p03745 | u500297289 | 1563169018 | Python | Python (3.4.3) | py | Runtime Error | 78 | 14480 | 605 | N = int(input())
A = list(map(int, input().split()))
B = []
tmp = -1
for a in A:
if a != tmp:
B.append(a)
tmp = a
def f(A):
ans = 1
n = len(A)
if A[0] < A[1]:
ff = 1
else:
ff = -1
for i in range(1, n - 1):
if ff == 0:
if A[i] < A[i + 1]:
... |
s770495268 | p03745 | u280978334 | 1562603573 | Python | Python (3.4.3) | py | Runtime Error | 64 | 14252 | 438 | N = int(input())
A = list(map(int,input().split()))
if A[0] == A[1]:
pre = 0
elif A[0] > A[1]:
pre = -1
else:
pre = 1
prevalue = A[1]
ans = 0
for a in A[2:]:
if a > prevalue:
if pre == -1:
ans += 1
pre = 0
else:
pre = 1
elif a < prevalue:
i... |
s025741715 | p03745 | u539517139 | 1562038540 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 280 | n=int(input())
a=list(map(int,input().split()))
s=n
for i in range(n-1):
if a[i]!=a[i+1]:
s=i
f=0 if a[s]<a[s+1] else f=1
break
p=0
for i in range(s+1,n-1):
if f==0:
if a[i]>a[i+1]:
p+=1
f=1
else:
if a[i]<a[i+1]:
p+=1
f=0
print(p) |
s156425345 | p03745 | u399721252 | 1561392458 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 270 | n = int(input())
num_list = [ int(v) for v in input().split() ]
mode = 1
ans = 0
for i in range(n-1):
if mode == 1 and num_list[i+1] < num_list[i]:
mode = -1
ans += 1
elif mode == -1 and num_list[i+1] > num_list[i]:
mode = 1
ans += 1
print(ans+1) |
s935079073 | p03745 | u680004123 | 1558814252 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14252 | 261 | n = int(input())
a = list(map(int, input().split()))
count = 1
num = 0
for i in range(1,len(a)-1):
if a[i+1]-a[i] == 0:
num = a[i+1] - a[i]
elif (a[i+1]-a[i])*d < 0:
count += 1
num = 0
print(count) |
s345233473 | p03745 | u680004123 | 1558814203 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14252 | 263 | n = int(input())
a = list(map(int, input().split()))
count = 1
num = 0
for i in range(1,len(a)-1):
if a[i+1]-a[i] == 0:
num = a[i+1] - a[i]
elif (a[i+1]-a[i])*d < 0:
count += 1
scope = 0
print(count) |
s704408055 | p03745 | u652081898 | 1558723474 | Python | Python (3.4.3) | py | Runtime Error | 74 | 14252 | 373 | n = int(input())
a = list(map(int, input().split()))
ans = 1
pre = a[0]
increase = True
if a[1] < a[0]:
increase = False
for i in range(1, n):
if a[i] < pre:
if increase:
ans += 1
increase = not increase
elif a[i] > pre:
if not increase:
ans += 1
... |
s536096964 | p03745 | u764600134 | 1558715071 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 874 | # -*- coding: utf-8 -*-
"""
A - Sorted Arrays
https://atcoder.jp/contests/agc013/tasks/agc013_a
"""
import sys
from typing import List
def solve(N, array):
ans = 1
prev = None
direction = None
for a in array:
if prev == None:
pass
elif a > prev:
if direction =... |
s382547646 | p03745 | u623819879 | 1558577314 | Python | PyPy3 (2.4.0) | py | Runtime Error | 197 | 55664 | 416 | n=int(input())
ans=1
t=0
for i in input().split():
a=int(i)
if pre==0:
pre=a
else:
if pre>a:
if -t<0 and t**2==1:
ans+=1
t=-2
else:
t=-1
elif pre<a:
if t<0 and t**2==1:
ans+=1
... |
s153281329 | p03745 | u029169777 | 1558567436 | Python | Python (3.4.3) | py | Runtime Error | 72 | 14224 | 361 | N=int(input())
A=list(map(int,input().split()))
before=0
state=-1
ans=0
for a in A:
if a==before:
continue
elif a-before>0:
if state==-1:
state=1
ans+=1
if state==0:
state=-1
else:
if state==-1:
state=0
ans+=1
if state==1:
state=-1
before=a
if (A[-1]-A[... |
s865398702 | p03745 | u542932305 | 1558496002 | Python | Python (3.4.3) | py | Runtime Error | 97 | 14436 | 461 | N = int(input())
A = list(map(int, input().split()))
count = 0
tmp = A[0]
bf = 1 if tmp < A[1] else 2 if tmp > A[1] else 0
af = 0 # {1: '+', 2: '-'}
for i in range(1, N):
if tmp < A[i]:
af = 1
elif tmp > A[i]:
af = 2
tmp = A[i]
if af != bf:
count += 1
if i+1 < N:
... |
s085222360 | p03745 | u542932305 | 1558495602 | Python | Python (3.4.3) | py | Runtime Error | 91 | 14252 | 405 | N = int(input())
A = list(map(int, input().split()))
count = 1
tmp = A[0]
bf = 1 if tmp < A[1] else 2 if tmp > A[1] else 0
af = 0 # {1: '+', 2: '-'}
for i in range(1, N):
if tmp < A[i]:
af = 1
elif tmp > A[i]:
af = 2
tmp = A[i]
if af != bf:
count += 1
if i+1 < N:
... |
s241077032 | p03745 | u047393579 | 1558154472 | Python | Python (3.4.3) | py | Runtime Error | 84 | 14252 | 327 | N = int(input())
sub = 0
count = 1
A = [int(i) for i in input().split()]
pre_num = A[1]
pre_sub = A[1] - A[0]
for num in A[2:]:
if not pre_num == num:
if pre_sub * (num - pre_num) < 0:
count += 1
pre_sub = 0
else:
pre_sub = num - pre_num
pre_num = num
print... |
s763670611 | p03745 | u767664985 | 1557969718 | Python | Python (3.4.3) | py | Runtime Error | 24 | 5908 | 193 | N = int(input())
A = [0] * N
for i in range(N):
A[i] = int(input())
for j in range(1, N):
if A[j] in A[: j]:
A[A[: j].index(A[j])] = -1
A[j] = -1
print(len([k for k in A if k != -1]))
|
s950755695 | p03745 | u091051505 | 1557164220 | Python | Python (3.4.3) | py | Runtime Error | 81 | 14224 | 443 | n = int(input())
a = [int(i) for i in input().split()]
if a[1] > a[0]:
temp = 1
elif a[1] < a[0]:
temp = -1
else:
temp = 0
ans = 1
for i in range(1, n-1):
if a[i+1] > a[i]:
if temp >= 0:
temp = 1
elif temp == -1:
ans += 1
temp = 0
elif a[i+1] < a[i... |
s355189876 | p03745 | u977389981 | 1552267360 | Python | Python (3.4.3) | py | Runtime Error | 83 | 14436 | 566 | n = int(input())
A = [int(i) for i in input().split()]
if A[0] < A[1]:
flag = 1
elif A[0] > A[1]:
flag = -1
else:
flag = 0
cnt = 1
x = A[1]
for i in range(2, n):
if flag == 1:
if x <= A[i]:
pass
else:
cnt += 1
flag = 0
if flag == -1:
... |
s131869545 | p03745 | u977389981 | 1552267241 | Python | Python (3.4.3) | py | Runtime Error | 82 | 14252 | 531 | n = int(input())
A = [int(i) for i in input().split()]
if A[0] <= A[1]:
flag = 1
else:
flag = -1
cnt = 1
x = A[1]
for i in range(2, n):
if flag == 1:
if x <= A[i]:
pass
else:
cnt += 1
flag = 0
if flag == -1:
if x < A[i]:
cnt += 1
... |
s729694452 | p03745 | u151625340 | 1552060309 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14228 | 483 | N = int(input())
A = list(map(int, input().split()))
divide = 0
if A[0] < A[1]:
up = 1
elif A[0] > A[1]:
up = -1
else:
up = 0
for i in range(1,N-1):
if A[i] == A[i+1]:
continue
elif A[i] < A[i+1]:
if up < 0:
divide += 1
up = 0
else:
up = 1
... |
s731418773 | p03745 | u853952087 | 1551747657 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 702 | n,l,t=list(map(int,input().split()))
L=[]
for i in range(n):
L.append(list(map(int,input().split())))
a=0
for i in range(1,n):
if L[0][1]==1 and L[i][1]==2:
a+=max(int((t-abs(L[0][0]-L[i][0])/2)/(l/2))+1,0)
elif L[0][1]==2 and L[i][1]==1:
a+=max(int((t-(l-abs(L[0][0]-L[i][0]))/2)/(l/2))+1,0)... |
s455879697 | p03745 | u367130284 | 1551347774 | Python | Python (3.4.3) | py | Runtime Error | 68 | 14052 | 235 | n,*a=map(int,open(0).read().split())
ans=0
x=a[0]
if a[1]>a[0]:
mode=0
else:
mode=1
for s in a:
# print(x,s,mode,ans)
if x<s and mode==0:
ans+=1
mode=1
elif x>s and mode==1:
ans+=1
mode=0
x=s
print(ans//2+1) |
s126488078 | p03745 | u945418216 | 1551327274 | Python | Python (3.4.3) | py | Runtime Error | 96 | 14224 | 408 | n = int(input())
aa = list(map(int, input().split()))
if n==1:
print(1)
else:
mode = None
ans = 1
for i in range(n-1):
if aa[i] != aa[i+1]:
if mode == None:
mode = aa[i]<aa[i+1]
if (aa[i] < aa[i+1]) != mode:
ans+=1
mode = a... |
s368737668 | p03745 | u944209426 | 1551315735 | Python | PyPy3 (2.4.0) | py | Runtime Error | 245 | 62704 | 254 | n=int(input())
a=list(map(int,input().split()))
u=a[0]<=a[1]
d=a[0]>=a[1]
res=0
for i in range(2,n):
u=u and a[i-1]<=a[i]
d=d and a[i-1]>=a[i]
#print(i,u,d)
if not any([u,d]):
res+=1
u=True
d=True
print(res+1)
|
s826244447 | p03745 | u401487574 | 1550985262 | Python | Python (3.4.3) | py | Runtime Error | 697 | 14252 | 654 | n = int(input())
a = list(map(int,input().split()))
cnt = 0
id = 1
while a != []:
if a[0] == a[1]:
while a[id-1] == a[id] and id <= len(a)-1:
id += 1
if id == len(a):break
del(a[:id-1])
if id == n:
cnt = 1
break
id = 1
if a[0] > a[1]:
... |
s140231036 | p03745 | u401487574 | 1550984242 | Python | Python (3.4.3) | py | Runtime Error | 703 | 14100 | 565 | n = int(input())
a = list(map(int,input().split()))
cnt = 0
id = 1
while a != []:
if a[0] == a[1]:
while a[id-1] == a[id] and id < len(a)-1:
id += 1
del(a[:id-1])
id = 1
if a[0] > a[1]:
while a[id-1] >= a[id] and id <= len(a)-1:
id += 1
if id ... |
s673637204 | p03745 | u401487574 | 1550978124 | Python | Python (3.4.3) | py | Runtime Error | 698 | 14480 | 497 | n = int(input())
a = list(map(int,input().split()))
cnt = 0
while a != []:
id = 1
if a[0] == a[1]:
while a[id-1] == a[id]:
id += 1
del(a[:id-1])
id = 1
if a[0] > a[1]:
while a[id-1] >= a[id] and id < len(a)-1:
id += 1
elif a[0] < a[1]:
whi... |
s677119389 | p03745 | u926181697 | 1549254319 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38512 | 164 | N = int(input())
cnt = 0
L = list(map(int,input()..split()))
for i in range(N-2):
if (L[i] > L[i+1] < L[i+2]) or (L[i] < L[i+1] > L[i+2]):
cnt += 1
print(cnt) |
s453203888 | p03745 | u197300260 | 1549242111 | Python | Python (3.4.3) | py | Runtime Error | 65 | 14224 | 639 | # _*_ coding:utf-8 _*_
# Atcoder_Grand_Contest013-A
# TODO https://atcoder.jp/contests/agc013/tasks/agc013_a
def solveProblem(allNumber,aList):
flag = "Flat"
count = 1
for i in range(allNumber - 1):
b = aList[i + 1] - aList[i]
if flag == "Plus":
if b < 0:
flag = "Flat"
count = count+1
elif flag ... |
s509250830 | p03745 | u197300260 | 1549242010 | Python | Python (3.4.3) | py | Runtime Error | 64 | 14224 | 639 | # _*_ coding:utf-8 _*_
# Atcoder_Grand_Contest013-A
# TODO https://atcoder.jp/contests/agc013/tasks/agc013_a
def solveProblem(allNumber,aList):
flag = "Flat"
count = 1
for i in range(allNumber - 1):
b = aList[i + 1] - aList[i]
if flag == "Plus":
if b < 0:
flag = "Flat"
count = count+1
elif flag ... |
s947079260 | p03745 | u444732068 | 1549227049 | Python | Python (3.4.3) | py | Runtime Error | 75 | 14480 | 382 | N = int(input())
a = list(map(int,input().split()))
ans = 1
if a[0] < a[1]:
flag = 1
if a[0] > a[1]:
flag = -1
if a[0] == a[1]:
flag = 0
for i in range(2,N):
if flag == 1 and a[i-1] > a[i]:
ans += 1
flag = 0
elif flag == -1 and a[i-1] < a[i]:
ans += 1
flag = 0
elif flag == 0 and a[i-1] < a[i]:
flag =... |
s302948550 | p03745 | u864565901 | 1548813041 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 271 | iipt=lambda:int(input())
miipt=lambda: list(map(int, input().split()))
n,l,t=miipt()
a=[miipt() for i in range(n)]
d=0
for x,w in a:
d+=(x+(t if w==1 else -t))//l
d=d%n
e=[(x+(t if w==1 else -t))%l for x, w in a]
e.sort()
for i in range(n):
print(e[(d+i)%n]) |
s835105426 | p03745 | u434208140 | 1547073510 | Python | Python (3.4.3) | py | Runtime Error | 20 | 5140 | 255 | n=int(input())
a=list(map(int,input()))
t=1
p=a[0]
m=0
for i in a:
if(p==i):
continue
if(m>0):
if(i<p):
t+=1
m=0
elif(m<0):
if(i>p):
t+=1
m=0
else:
if(i>p):
m=1
elif(i<p):
m=-1
p=i
print(t) |
s555741120 | p03745 | u434208140 | 1547073415 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 254 | n=int(input())
a=list(map(int,input()))
t=1
p=a[0]
m=0
for i in a:
if(p==i):
continue
if(m>0):
if(i<p):
t+=1
m=0
elif(m<0):
if(i>p):
t+=1
m=0
else:
if(i>p):
m=1
eif(i<p):
m=-1
p=i
print(t) |
s104721971 | p03745 | u037449077 | 1546265440 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 507 | import sys
lines = sys.stdin.readlines()
for n, line in enumerate(lines):
if n == 0:
continue
inputs = [int(_) for _ in line.strip().split(' ')]
log = []
res = [[]]
for n, input_ in inputs:
mono_inc = True
mono_dec = True
if n > 0:
if input_ > prev
mono_dec = False
elif input_ < prev
... |
s375379546 | p03745 | u983918956 | 1545883270 | Python | Python (3.4.3) | py | Runtime Error | 2164 | 781784 | 514 | N = int(input())
A = list(map(int,input().split()))
if N == 1:
print(1)
exit()
d = [A[i+1] - A[i] for i in range(N-1)]
def judge(list_hoge = d,count = 1):
if len(list_hoge) == 1:
print(count)
return
for i in range(1,len(list_hoge)):
if list_hoge[i] * list_hoge[0] < 0:
... |
s643120079 | p03745 | u983918956 | 1545880296 | Python | Python (3.4.3) | py | Runtime Error | 2148 | 781784 | 321 | N = int(input())
A = list(map(int,input().split()))
if N <= 2:
print(1)
exit()
d = [A[i+1] - A[i] for i in range(N-1)]
def judge(list_hoge = d,count = 1):
for i in range(1,len(list_hoge)):
if list_hoge[i] * list_hoge[0] < 0:
return judge(list_hoge[i+1:],count + 1)
print(count)
judge(... |
s205363361 | p03745 | u983918956 | 1545879842 | Python | Python (3.4.3) | py | Runtime Error | 2149 | 781784 | 322 | N = int(input())
A = list(map(int,input().split()))
if N == 1:
print(1)
exit()
d = [A[i+1] - A[i] for i in range(N-1)]
def judge(list_hoge = d,count = 1):
for i in range(1,len(list_hoge)):
if list_hoge[i] * list_hoge[0] < 0:
return judge(list_hoge[i+1:],count + 1)
print(count)
judge(... |
s774641576 | p03745 | u983918956 | 1545819982 | Python | Python (3.4.3) | py | Runtime Error | 2150 | 781784 | 286 | N = int(input())
A = list(map(int,input().split()))
d = [A[i+1] - A[i] for i in range(N-1)]
def judge(list_hoge = d,count = 1):
for i in range(1,len(list_hoge)):
if list_hoge[i] * list_hoge[0] < 0:
return judge(list_hoge[i+1:],count + 1)
print(count)
judge() |
s899046054 | p03745 | u853900545 | 1545501559 | Python | Python (3.4.3) | py | Runtime Error | 107 | 14252 | 633 | n = int(input())
a = list(map(int,input().split()))
i = 0
c = 1
if a[0] <= a[1]:
s = 0
elif a[0] >= a[1]:
s = 1
else:
s = 2
while i < n-1:
if s ==2:
if a[i] <= a[i+1]:
s = 0
i += 1
elif a[i] >= a[i+1]:
s = 1
i += 1
else:
... |
s818766771 | p03745 | u853900545 | 1545501362 | Python | Python (3.4.3) | py | Runtime Error | 112 | 14252 | 628 | n = int(input())
a = list(map(int,input().split()))
i = 0
c = 1
if a[0] <= a[1]:
s = 0
elif a[0] >= a[1]:
s = 1
else:
s = 2
while i < n-1:
if s ==2:
if a[i] <= a[i+1]:
s = 0
i += 1
elif a[i] >= a[i+1]:
s = 1
i += 1
else:
... |
s488220326 | p03745 | u853900545 | 1545501049 | Python | Python (3.4.3) | py | Runtime Error | 77 | 14480 | 458 | n = int(input())
a = list(map(int,input().split()))
i = 0
c = 1
if a[0] <= a[1]:
s = 0
elif a[0] >= a[1]:
s = 1
else:
s = 2
while i < n-1:
if a[i] == a[i+1]:
i += 1
elif s == 0 or s ==2 and a[i] < a[i+1]:
i += 1
elif s == 1 or s ==2 and a[i] < a[i+1]:
i += 1
s =... |
s614331705 | p03745 | u177040005 | 1545346575 | Python | Python (3.4.3) | py | Runtime Error | 112 | 14480 | 718 | N = int(input())
A = list(map(int,input().split()))
ans = 1
pm = 1
i = 0
tmp = []
while i < N:
if i == 0:
if A[i] <= A[i+1]:
pm = 1
else:
pm = -1
i += 1
else:
if pm*(A[i] - A[i-1]) >= 0:
i += 1
if pm == 0 and A[i] != A[i-1]:
... |
s610738976 | p03745 | u177040005 | 1545346307 | Python | Python (3.4.3) | py | Runtime Error | 99 | 14252 | 500 | N = int(input())
A = list(map(int,input().split()))
ans = 1
pm = 1
i = 0
while i < N:
if i == 0:
if A[i] <= A[i+1]:
pm = 1
else:
pm = -1
i += 1
else:
if pm*(A[i] - A[i-1]) >= 0:
i += 1
else:
i += 1
if N <= i... |
s450199178 | p03745 | u853900545 | 1544925167 | Python | Python (3.4.3) | py | Runtime Error | 102 | 14436 | 401 | n = int(input())
a = list(map(int,input().split()))
i = 0
c = 1
if a[0] <= a[1]:
s = 0
else:
s = 1
while i < n-1:
if a[i] == a[i+1]:
i += 1
elif s == 0 and a[i] < a[i+1]:
i += 1
elif s == 1 and a[i] < a[i+1]:
i += 1
s = 0
c +=1
elif s == 1 and a[i] > a[i+... |
s763659157 | p03745 | u983918956 | 1544847744 | Python | Python (3.4.3) | py | Runtime Error | 2148 | 777724 | 628 | N = int(input())
A = list(map(int,input().split()))
if N == 1 or len(list(set(A))) == 1:
print(1)
exit()
def rec(list1,t):
for i in range(1,len(list1)):
if list1[i] - list1[i-1] > 0:
note = "not decrease"
break
elif list1[i] - list1[i-1] < 0:
note = "not i... |
s524572772 | p03745 | u368780724 | 1542146362 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 649 | def inpl(): return [int(i) for i in input().split()]
def next(v):
for i in edge[v]:
if visited[i]:
continue
visited[i] = True
return i
return -1
from collections import defaultdict
edge = defaultdict(lambda: [])
N, M = inpl()
visited = [False for _ in range(N+1)]
visited[1] ... |
s017674501 | p03745 | u102126195 | 1537048357 | Python | Python (3.4.3) | py | Runtime Error | 76 | 14224 | 403 | N = int(input())
A = list(map(int, input().split()))
if A[0] <= A[1]:
di = 1
else:
di = -1
cnt = 1
i = 1
while i < N:
if di == 1 and A[i - 1] > A[i]:
di = -1
cnt += 1
i += 1
if i >= N:
cnt += 1
elif di == -1 and A[i - 1] < A[i]:
di = 1
cnt += 1... |
s345699090 | p03745 | u536113865 | 1536990509 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 1195 | li = lambda: list(map(int,input().split()))
n,l,t = li()
a,ac,au = [],[],[]
for i in range(n):
x,y = li()
if i == 0: start = y
a.append(x)
if y == 1:
ac.append(x)
else:
au.append(x)
tt = t%l
if start == 2:
acc = [n-ac[-s] for s in range(1,len(ac)+1)]
dist = au[0]+acc[0]
... |
s963931631 | p03745 | u957084285 | 1534898316 | Python | Python (3.4.3) | py | Runtime Error | 103 | 14252 | 324 | n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
if a[-1] != b[i]:
a.append(b[i])
ans = 1
inc = a[0] < a[1]
n = len(a)
i = 1
while i < n:
if (a[i-1] < a[i]) ^ inc:
ans += 1
inc = a[i] < a[min(i+1, n-1)]
i += 2
else:
i += 1
print(... |
s811232529 | p03745 | u957084285 | 1534897918 | Python | Python (3.4.3) | py | Runtime Error | 93 | 14252 | 294 | n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
if a[-1] != b[i]:
a.append(b[i])
ans = 1
inc = a[0] < a[1]
n = len(a)
for i in range(1, n):
if (a[i-1] > a[i]) ^ inc:
pass
else:
ans += 1
inc = not inc
print(ans) |
s482480801 | p03745 | u957084285 | 1534897419 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14252 | 134 | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in range(n):
ans += a[2*i+1]
print(ans) |
s067457316 | p03745 | u828847847 | 1534053349 | Python | Python (2.7.6) | py | Runtime Error | 98 | 11320 | 297 | n = int(input())
arr = map(int,raw_input().split())
ans = 0
i = 1
while i < n-1:
if arr[i-1] <= arr[i] <= arr[i+1]:
i += 1
if i == n-1:
print ans
quit()
elif arr[i-1] >= arr[i] >= arr[i+1]:
i += 1
if i == n-1:
print ans()
quit()
else :
ans += 1
i += 2
print ans + 1 |
s979013285 | p03745 | u863076295 | 1531611066 | Python | Python (3.4.3) | py | Runtime Error | 103 | 14224 | 389 | n = int(input())
a = list(map(int,input().split()))
flg = int(a[1]>a[0])
skp = 1
cnt = 1
temp = a[0]
for i in range(1,n):
dif = a[i] - temp
direct = int(dif>0)
if dif != 0:
if skp:
flg = direct
skp = 0
elif direct != flg and skp==0:
flg = dir... |
s232873811 | p03745 | u863076295 | 1531606125 | Python | Python (3.4.3) | py | Runtime Error | 376 | 23132 | 427 | import numpy as np
n = int(input())
a = list(map(int,input().split()))
flg = np.sign(a[1] - a[0])
skp = 1
cnt = 1
temp = a[0]
for i in range(1,n):
dif = a[i] - temp
direct = np.sign(dif)
if dif != 0:
if skp:
flg = direct
skp = 0
continue
eli... |
s596166062 | p03745 | u863076295 | 1531605990 | Python | Python (3.4.3) | py | Runtime Error | 374 | 23128 | 406 | import numpy as np
n = int(input())
a = list(map(int,input().split()))
flg = np.sign(a[1] - a[0])
skp = 1
cnt = 1
temp = a[0]
for i in range(1,n):
dif = a[i] - temp
direct = np.sign(dif)
if dif != 0:
if skp:
flg = direct
skp = 0
elif direct != flg:
... |
s986466972 | p03745 | u136090046 | 1529357690 | Python | Python (3.4.3) | py | Runtime Error | 73 | 14252 | 524 | n = int(input())
array = [int(x) for x in input().split()]
cnt = 1
tmp = array.pop(0)
tmp2 = array.pop(0)
mode = "plus" if tmp2 > tmp else "minus" if tmp2 != tmp else "equal"
tmp = tmp2
for i in array:
if tmp < i:
if mode == "minus":
cnt += 1
mode = "equal"
elif mode == "eq... |
s058723531 | p03745 | u102126195 | 1526758175 | Python | Python (3.4.3) | py | Runtime Error | 73 | 14224 | 414 | N = int(input())
A = list(map(int, input().split()))
if A[0] <= A[1]: check = 1
else: check = 0
cnt = 1
for i in range(1, len(A)):
if check == 1:
if A[i] < A[i - 1]:
cnt += 1
if A[i] <= A[i - 1]: check = 1
else: check = 0
else:
if A[i] > A[i - 1]:
... |
s782384332 | p03745 | u102126195 | 1526758050 | Python | Python (3.4.3) | py | Runtime Error | 80 | 14252 | 414 | N = int(input())
A = list(map(int, input().split()))
if A[0] <= A[1]: check = 1
else: check = 0
cnt = 1
for i in range(1, len(A)):
if check == 1:
if A[i] < A[i - 1]:
cnt += 1
if A[i] <= A[i - 1]: check = 0
else: check = 1
else:
if A[i] > A[i - 1]:
... |
s762124360 | p03745 | u102126195 | 1526757914 | Python | Python (3.4.3) | py | Runtime Error | 70 | 14224 | 404 | N = int(input())
A = list(map(int, input().split()))
if A[0] <= A[1]: check = 1
else: check = 0
cnt = 1
for i in range(1, len(A)):
if check == 1:
if A[i] < A[i - 1]:
cnt += 1
if A[0] <= A[1]: check = 1
else: check = 0
else:
if A[i] > A[i - 1]:
cnt ... |
s201051490 | p03745 | u257974487 | 1524544945 | Python | Python (3.4.3) | py | Runtime Error | 83 | 14436 | 557 | n = int(input())
nums = list(map(int,input().split()))
ans = 1
if nums[1] >= nums[0]:
flag = 1
else:
flag = 2
i = 1
while i < n:
if flag == 0:
if nums[i] > nums[i-1]:
flag = 1
ans += 1
else:
flag = 2
ans += 1
elif flag == 1:
if n... |
s940522404 | p03745 | u562016607 | 1523138251 | Python | Python (3.4.3) | py | Runtime Error | 126 | 14252 | 324 | N=int(input())
A=[int(i) for i in input().split()]
T=[[A[0],A[1]]]
k=0
for i in range(2,N):
if len(T[k])<=1:
T[k].append(A[i])
continue
if not((T[k][0]>=A[i-2]>=A[i-1]>=A[i]) or (T[k][0]<=A[i-2]<=A[i-1]<=A[i])):
k+=1
T.append([A[i]])
else:
T[k].append(A[i])
print(len(... |
s097922649 | p03745 | u562016607 | 1523138160 | Python | Python (3.4.3) | py | Runtime Error | 128 | 14436 | 343 | N=int(input())
A=[int(i) for i in input().split()]
T=[[A[0],A[1]]]
k=0
for i in range(2,N):
if len(T[k])<=1:
T[k].append(A[i])
continue
if not((T[k][0]>=A[i-2]>=A[i-1]>=A[i]) or (T[k][0]<=A[i-2]<=A[i-1]<=A[i])):
k+=1
T.append([])
T[k].append(A[i])
else:
T[k].a... |
s445594358 | p03745 | u562016607 | 1523138108 | Python | Python (3.4.3) | py | Runtime Error | 182 | 19216 | 347 | N=int(input())
A=[int(i) for i in input().split()]
T=[[A[0],A[1]]]
k=0
for i in range(2,N):
if len(T[k])<=1:
T[k].append(A[i])
#continue
if not((T[k][0]>=A[i-2]>=A[i-1]>=A[i]) or (T[k][0]<=A[i-2]<=A[i-1]<=A[i])):
k+=1
T.append([])
T[k].append(A[i])
else:
T[k].... |
s709187764 | p03745 | u562016607 | 1523137395 | Python | Python (3.4.3) | py | Runtime Error | 126 | 14436 | 348 | N=int(input())
A=[int(i) for i in input().split()]
T=[[A[0],A[1]]]
B=[0]
k=0
for i in range(2,N):
if len(T[k])<=1:
T[k].append(A[i])
continue
if not(T[k][0]>=A[i-2]>=A[i-1]>=A[i] or T[k][0]<=A[i-2]<=A[i-1]<=A[i]):
k+=1
T.append([])
T[k].append(A[i])
else:
T[k]... |
s780494105 | p03745 | u562016607 | 1523137101 | Python | Python (3.4.3) | py | Runtime Error | 124 | 14252 | 324 | N=int(input())
A=[int(i) for i in input().split()]
T=[[A[0],A[1]]]
k=0
for i in range(2,N):
if len(T[k])<=1:
T[k].append(A[i])
continue
if not(A[i-2]>=A[i-1]>=A[i] or A[i-2]<=A[i-1]<=A[i]):
k+=1
T.append([])
T[k].append(A[i])
else:
T[k].append(A[i])
print(len(... |
s485848618 | p03745 | u030726788 | 1522879354 | Python | Python (3.4.3) | py | Runtime Error | 1570 | 14480 | 407 | import sys
n=int(input())
a=list(map(int,input().split()))
x=0
for i in range(n-1):
if(a[i+1-x]==a[i-x]):
a.pop(i-x)
n-=1
x+=1
if(n==3):break
if(a[0]==a[1]):
a.pop(0)
n-=1
if(n==1):
print(1)
sys.exit()
if(n==2):
print(1)
sys.exit()
til=a[1]-a[0]
x=0
for i in range(n-1):
tilt=a[i+1]-a[i]
... |
s141728902 | p03745 | u030726788 | 1522879297 | Python | Python (3.4.3) | py | Runtime Error | 1573 | 14436 | 374 | import sys
n=int(input())
a=list(map(int,input().split()))
x=0
for i in range(n-1):
if(a[i+1-x]==a[i-x]):
a.pop(i-x)
n-=1
x+=1
if(n==3):break
if(a[0]==a[1]):
a.pop(0)
n-=1
if(n==2):
print(1)
sys.exit()
til=a[1]-a[0]
x=0
for i in range(n-1):
tilt=a[i+1]-a[i]
if(til*tilt<0):
x+=1
if... |
s274944554 | p03745 | u030726788 | 1522879118 | Python | Python (3.4.3) | py | Runtime Error | 813 | 14480 | 372 | import sys
n=int(input())
a=list(map(int,input().split()))
x=0
for i in range(n-1):
if(a[i+1-x]==a[i-x]):
a.pop(i)
n-=1
x+=1
if(n==3):break
if(a[0]==a[1]):
a.pop(0)
n-=1
if(n==2):
print(1)
sys.exit()
til=a[1]-a[0]
x=0
for i in range(n-1):
tilt=a[i+1]-a[i]
if(til*tilt<0):
x+=1
if(i... |
s920471448 | p03745 | u729707098 | 1522618001 | Python | Python (3.4.3) | py | Runtime Error | 182 | 23104 | 245 | import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
answer= 1
if n!=1: np.sign(a[1]-a[0])
for i in range(1,n-1):
num = np.sign(a[i+1]-a[i])
if flag==0:
flag = num
elif num==-flag:
answer += 1
flag = 0
print(answer) |
s951757997 | p03745 | u729707098 | 1522617859 | Python | Python (3.4.3) | py | Runtime Error | 527 | 23104 | 242 | import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
answer,flag = 1,np.sign(a[1]-a[0])
for i in range(1,n-1):
num = np.sign(a[i+1]-a[i])
if flag==0:
flag = num
elif num==-flag:
answer += 1
flag = 0
print(answer) |
s992542994 | p03745 | u455638863 | 1521001167 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 1477 | def search(v, A, B, flg, p, c, s):
# if c > 2:
# print("v=", v, "flg=", flg, "p=", p, "cnt=", c)
if flg[v-1] == 1:
return c
flg[v-1] = 1
p.append(v)
c += 1
for idx in range(len(A)):
if v == A[idx]:
cnt = search(B[idx], A, B, flg, p, c, s)
if cnt != 0:
return cnt
else:
... |
s889957374 | p03745 | u455638863 | 1521001089 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 1473 | def search(v, A, B, flg, p, c, s):
if c > 2:
print("v=", v, "flg=", flg, "p=", p, "cnt=", c)
if flg[v-1] == 1:
return c
flg[v-1] = 1
p.append(v)
c += 1
for idx in range(len(A)):
if v == A[idx]:
cnt = search(B[idx], A, B, flg, p, c, s)
if cnt != 0:
return cnt
else:
... |
s367946883 | p03745 | u455638863 | 1520939072 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 1173 | def search(v, A, B, flg, p, c, s):
if flg[v-1] == 1:
return c
# print("v=", v, "flg=", flg, "p=", p, "cnt=", c)
flg[v-1] = 1
for idx in A:
if v == A[idx]:
c += 1
if search(B[idx], A, B, flg, p, c, s) == 0:
return 0
for idx in B:
if v == B[idx]:
c += 1
if search(A[idx... |
s032824028 | p03745 | u231282396 | 1520576076 | Python | Python (3.4.3) | py | Runtime Error | 19 | 5132 | 387 | N = input()
A = []
AD = True
EF = True
ANS = 1
for i in range(0,int(N)):
A[i] = input()
for i in range(0,int(N)):
if i >= 1:
if A[i] > A[i-1] and AD == False and EF == False:
EF = True
ANS += 1
elif A[i] < A[i-1] and AD == True and EF == False:
EF = True
ANS += 1
elif EF == True:
EF = False
... |
s967031414 | p03745 | u866879589 | 1520575129 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 390 | N = input()
A = input().split()
AD = True
EF = True
ANS = 0
for i in range(0,int(N)):
if i >= 1:
if A[i] >= A[i-1] and AD == False and EF == False:
EF = True
ANS += 1
elif A[i] <= A[i-1] and AD == True and EF == False:
EF = True
ANS += 1
if EF == True:
if A[i] >= A[i-1]:
AD = True
EF = Fa... |
s667534015 | p03745 | u761320129 | 1515621042 | Python | Python (3.4.3) | py | Runtime Error | 27 | 11096 | 200 | N = int(input())
src = map(int,input().split())
asc = 0
ans = 1
for i in range(N-1):
d = src[i+1] - src[i]
if asc * d < 0:
ans += 1
asc = 0
else:
asc = d
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.