problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p03745 | u212328220 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["N = int(input())\nalst = list(map(int, input().split()))\n\nnow = 'increase' or 'decrease'\ncnt = 1\nfor i in range(1, N):\n x = now\n if alst[i] - alst[i - 1] > 0:\n tmp = 'increase'\n else:\n tmp = 'decrease'\n\n if tmp != x:\n cnt += 1\n x = tmp\n\nprint(cnt)\n", "n = int(in... | ['Wrong Answer', 'Accepted'] | ['s884163036', 's575975307'] | [14228.0, 14100.0] | [83.0, 93.0] | [287, 742] |
p03745 | u223904637 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\nl=list(map(int,input().split()))\nif n<=2:\n print(1)\n exit()\nyt=[0]*n\nfor i in range(n-1):\n if l[i]<l[i+1]:\n yt[i]=1\n elif l[i]>l[i+1]:\n yt[i]=-1\n elif i!=0:\n l[i]=l[i-1]\nans=0\nfor i in range(n-1):\n if l[i]*l[i+1]==-1:\n ans+=1\n if i>1... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s194392908', 's599023671', 's959729765', 's302221424'] | [14436.0, 14436.0, 14252.0, 14252.0] | [108.0, 113.0, 111.0, 83.0] | [353, 359, 298, 246] |
p03745 | u227082700 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\na=list(map(int,input().split()))\nb=0\nans=1\nfor i in range(n-1):\n if a[i]<a[i+1] and b==-1:\n ans+=1\n b=1\n if a[i]>a[i+1] and b==1:\n ans+=1\n b=-1\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\nb=0\nans=1\nfor i in range(n-1):\n if b==0 and a[i]!=a[i+1]:\n if ... | ['Wrong Answer', 'Accepted'] | ['s519719289', 's047217025'] | [15020.0, 14228.0] | [76.0, 84.0] | [183, 228] |
p03745 | u238510421 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['C = input()\nN = list(map(int,input().split()))\n\ncount = 0\na = 0\nb = 0\nfor i in range(len(N)-1):\n if N[i+1] - N[i] > 0:\n b = 1\n elif N[i+1] - N[i] < 0:\n b = -1\n else:\n b = 0\n \n if a == 0:\n a = b \n elif a == b:\n pass\n elif a == b * (-1):\n ... | ['Wrong Answer', 'Accepted'] | ['s619177644', 's283654342'] | [14252.0, 14252.0] | [92.0, 94.0] | [354, 373] |
p03745 | u243492642 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['# coding: utf-8\nimport array, bisect, collections, heapq, itertools, math, random, re, string, sys, time\nsys.setrecursionlimit(10 ** 7)\nINF = 10 ** 20\nMOD = 10 ** 9 + 7\n \n \ndef II(): return int(input())\ndef ILI(): return list(map(int, input().split()))\ndef IAI(LINE): return [ILI() for __ in range(LINE)]\ndef... | ['Wrong Answer', 'Accepted'] | ['s123512531', 's197767513'] | [15404.0, 15408.0] | [79.0, 77.0] | [852, 852] |
p03745 | u247211039 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\nA=list(map(int,input().split()))\n\ncnt = 0\nflag = 0\n\nfor i in range(N-1):\n #print(A[i+1]-A[i])\n if A[i+1]-A[i] >= 0:\n if flag == 1:\n cnt +=0\n elif flag == -1:\n cnt +=1\n flag = 0\n elif flag ==0:\n flag = 1\n elif A[i+1]-A[i] <= 0:\n if flag == 1:\n cn... | ['Wrong Answer', 'Accepted'] | ['s089568481', 's868141911'] | [14252.0, 20160.0] | [93.0, 89.0] | [413, 740] |
p03745 | u276204978 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\n\ncnt = 1\ninc = False\ndec = False\np = A.pop(0)\n\nfor Ai in A:\n if (not inc) and (not dec):\n if Ai < p:\n dec = True\n else:\n inc = True\n elif inc:\n if Ai < p:\n cnt += 1\n inc = False... | ['Wrong Answer', 'Accepted'] | ['s571934301', 's756694383'] | [14252.0, 14252.0] | [65.0, 65.0] | [406, 413] |
p03745 | u292735000 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\n\n\nif a[1] > a[0]:\n inc = True\nelse:\n inc = False\ncount = 1\nfor i in range(2, len(a)):\n if a[i] > a[i - 1]:\n if inc:\n pass\n else:\n count += 1\n inc = False\n elif a[i] < a[i - 1]:\n if i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s065706240', 's837269908', 's471018211'] | [14224.0, 15116.0, 14252.0] | [79.0, 95.0, 78.0] | [395, 435, 431] |
p03745 | u298520807 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['from otsutil.funcs import parg\n_ = input()\nA = map(int, input().split())\nprev = next(A)\nup = None\ncount = 1\nfor i in A:\n if prev < i:\n if up is None:\n up = True\n elif not up:\n count += 1\n up = None\n else:\n if up is None:\n up = False... | ['Runtime Error', 'Accepted'] | ['s520266148', 's558129160'] | [3060.0, 11100.0] | [17.0, 64.0] | [392, 370] |
p03745 | u306412379 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\naa =list(map(int, input().split()))\n\nlist1 =[0] * n\ncnt = 1 \nfor i in range(n-1):\n if aa[i+1] > aa[i]:\n list1[i+1] = 1\n elif aa[i+1] < aa[i]:\n list1[i+1] = -1\n elif aa[i+1] == aa[i]: \n list1[i+1] = 0\n\nprint(list1) \nwhile 1 in list1 and -1 in list1:\n del list1[:max(l... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s690712781', 's734434932', 's287977845'] | [20292.0, 20384.0, 20432.0] | [527.0, 163.0, 354.0] | [376, 537, 359] |
p03745 | u327310087 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\n\nslash = 0\nfor i in range(n):\n if i <= n - 2 and a[i] < a[i + 1]: # up\n while i <= n - 2 and a[i] <= a[i + 1]:\n i += 1\n slash += 1\n continue\n elif i <= n - 2 and a[i] > a[i + 1]: # down\n while i <= n - 2 and a... | ['Wrong Answer', 'Accepted'] | ['s353669823', 's879254955'] | [14252.0, 15020.0] | [2104.0, 85.0] | [380, 308] |
p03745 | u329749432 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["n = int(input())\na = [int(i) for i in input().split()]\n\ncount = 1\nstate = 'none'\nb = [a[0]]\n\nfor i in range(1,n):\n if state=='none':\n before=b.pop()\n now = a[i]\n if before<now:\n b.append(now)\n state='incr'\n elif before>now:\n b.append(now)\... | ['Runtime Error', 'Accepted'] | ['s555068359', 's140035292'] | [3064.0, 14480.0] | [17.0, 95.0] | [773, 773] |
p03745 | u339199690 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\n\ninc = 0\nres = 0\nfor i in range(N - 1):\n if A[i] < A[i + 1]:\n if inc == 1:\n continue\n elif inc == 0:\n inc = 1\n else:\n res += 1\n inc = 0\n elif A[i] > A[i + 1]:\n if inc == -1... | ['Wrong Answer', 'Accepted'] | ['s039087295', 's937522029'] | [14224.0, 14228.0] | [79.0, 80.0] | [435, 439] |
p03745 | u344122377 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['#include <bits/stdc++.h>\nusing namespace std;\n#ifdef LOCAL_DEBUG\n #include "LOCAL_DEBUG.hpp"\n#endif\n\nconst int INF = 1LL << 60;\n\nsigned main(){\n\n int n; cin >> n;\n vector<int> a(n);\n for(int i = 0; i < n; i++){\n cin >> a[i];\n }\n\n int ans = 0;\n for(int i = 0; i < n; i++){\n int right1 = i... | ['Runtime Error', 'Accepted'] | ['s979337024', 's559787518'] | [2940.0, 14252.0] | [17.0, 100.0] | [540, 294] |
p03745 | u348293370 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nnum_list = list(map(int, input().split()))\nans = 1\ncnt_list = [0] * n\na = int()\n\nfor i in range(1,n):\n if num_list[i-1] > num_list[i]:\n cnt_list[i] = -1\n if num_list[i-1] < num_list[i]:\n cnt_list[i] = 1\n\nfor i in range(1,n-1):\n if not cnt_list[i] == 0:\n a =... | ['Wrong Answer', 'Accepted'] | ['s464467169', 's799778675'] | [20004.0, 20124.0] | [93.0, 359.0] | [476, 386] |
p03745 | u354638986 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["def sign(x):\n if x < 0:\n return -1\n elif x == 0:\n return 0\n else:\n return 1\n\n\ndef main():\n n = int(input())\n a = list(map(int, input().split()))\n\n cnt, idx = 1, 1\n if 1 < n:\n flg = a[idx] - a[idx-1]\n while idx <= n - 1:\n if sign(a[idx... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s378971646', 's512478798', 's884421102'] | [14224.0, 14252.0, 14436.0] | [88.0, 94.0, 99.0] | [583, 405, 546] |
p03745 | u368780724 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['def inpl(): return [int(i) for i in input().split()]\ndef next(v):\n for i in edge[v]:\n if visited[i]:\n continue\n visited[i] = True\n return i\n return -1\n\nfrom collections import defaultdict\nedge = defaultdict(lambda: [])\nN, M = inpl()\nvisited = [False for _ in range(N+1... | ['Runtime Error', 'Accepted'] | ['s524572772', 's772600173'] | [3316.0, 14252.0] | [21.0, 95.0] | [649, 371] |
p03745 | u375616706 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['def solve(A, inc):\n\n ans = 1\n N = len(A)\n l = [0]*N\n for i in range(1, N):\n if A[i] - A[i-1] == 0:\n l[i] = 1\n else:\n l[i] = A[i]-A[i-1]\n\n for i in range(1, N):\n if l[i]*l[i-1] < 0:\n l[i] = 0\n ans += 1\n return ans\n\n\nN ... | ['Wrong Answer', 'Accepted'] | ['s157964674', 's512767451'] | [14252.0, 14252.0] | [84.0, 77.0] | [374, 382] |
p03745 | u391731808 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\n*A, = map(int,input().split())\n\nans = 0\nl = 0\nud = 0\nfor a in A:\n if l==0:\n ans += 1\n elif l==1:\n if b>a:\n ud = 1\n l+=1\n elif b<a:\n ud = -1\n l+=1\n else:\n if b>a and ud == -1:\n ans += 1\n l = 1\n elif b<a and ud == 1:\n ans += 1\n ... | ['Wrong Answer', 'Accepted'] | ['s646569814', 's876911910'] | [14224.0, 14224.0] | [57.0, 74.0] | [323, 333] |
p03745 | u392319141 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\n\n\nans = 1\ni = 1\nprev = -1\nwhile i < N - 1:\n if A[i - 1] < A[i] and A[i + 1] < A[i]:\n if i - prev > 1:\n ans += 1\n prev = i\n elif A[i - 1] > A[i] and A[i + 1] > A[i]:\n if i - prev > 1:\n ans += 1\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s065020942', 's647183207', 's929950767'] | [14228.0, 14224.0, 14436.0] | [105.0, 111.0, 110.0] | [383, 387, 407] |
p03745 | u404034840 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import numpy as np\n\nN = int(input())\nA = list(map(int, input().split()))\ncount = 1\nupd = 0\nfor i in range(N-1):\n s0 = np.sign(A[i+1] - A[i])\n if upd == 0:\n upd = s0\n elif s0 != 0 and s0 != upd:\n upd = 0\n count += 1\n print(i,"番目")\nprint(count)', 'import numpy as np\n\nN = int(input())\nA =... | ['Wrong Answer', 'Accepted'] | ['s210920038', 's303226073'] | [23124.0, 23088.0] | [588.0, 544.0] | [261, 239] |
p03745 | u411858517 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nl = list(map(int, input().split()))\n\nres = 0\nfor i in range(n-1):\n\tif l[i+1] < l[i]:\n\t\tres += 1\n\nprint(res+1) \t\n', "N = int(input())\nL = list(map(int, input().split()))\n\nans1 = 1\nflag = ''\nfor i in range(1, N):\n if flag == '':\n if L[i] < L[i-1]:\n flag = 'minus'\n elif... | ['Wrong Answer', 'Accepted'] | ['s001275653', 's259687835'] | [14252.0, 14252.0] | [66.0, 82.0] | [129, 392] |
p03745 | u425762225 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import sys\nsys.setrecursionlimit(10**6)\n\nN = int(input())\na = list(map(int,input().split()))\n\n\ndef solve(n,a,c=0,ans=1,prev_da=0):\n if c == n-1:\n return ans\n \n da = a[c+1] - a[c]\n \n if da == 0:\n return(n,a,c+1,ans,prev_da)\n \n elif da > 0 and prev_da < 0:\n return solve(n,a,c+1,ans+1,0)... | ['Wrong Answer', 'Accepted'] | ['s113174872', 's855563372'] | [130396.0, 20004.0] | [161.0, 85.0] | [495, 268] |
p03745 | u426108351 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\n\nans = 1\nflag = 0\nbase = -1\ncount = 0\nfor i in range(n):\n if count == 0:\n count += 1\n base = a[i]\n elif count == 1:\n count += 1\n if a[i] < base:\n flag = 0\n elif a[i] > base:\n flag = 1\n else:\n continue\n else:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s518817976', 's542727376', 's288436178'] | [14428.0, 14436.0, 14440.0] | [80.0, 79.0, 80.0] | [552, 562, 587] |
p03745 | u434208140 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\na=list(map(int,input()))\nt=1\np=a[0]\nm=0\nfor i in a:\n if(p==i):\n continue\n if(m>0):\n if(i<p):\n t+=1\n m=0\n elif(m<0):\n if(i>p):\n t+=1\n m=0\n else:\n if(i>p):\n m=1\n eif(i<p):\n m=-1\n p=i\nprint(t)', 'n=int(input())\na=list(map(int,input()... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s555741120', 's835105426', 's366095802'] | [3060.0, 5140.0, 14224.0] | [17.0, 20.0, 74.0] | [254, 255, 263] |
p03745 | u455638863 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['def search(v, A, B, flg, p, c, s):\n if flg[v-1] == 1:\n return c\n# print("v=", v, "flg=", flg, "p=", p, "cnt=", c)\n flg[v-1] = 1\n for idx in A:\n if v == A[idx]:\n c += 1\n if search(B[idx], A, B, flg, p, c, s) == 0:\n return 0\n for idx in B:\n if v == B[idx]:\n c += 1\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s367946883', 's668901272', 's889957374', 's992542994', 's864724087'] | [3188.0, 15448.0, 3192.0, 3192.0, 15196.0] | [20.0, 525.0, 18.0, 18.0, 84.0] | [1173, 646, 1473, 1477, 647] |
p03745 | u464205401 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['from collections import deque\n\nn = int(input())\na = list(map(int,input().split()))\nd = deque(a)\n\ntmp = []\ncnt = 0\nwhile d:\n v = d.popleft()\n if len(tmp)<=1:\n pass\n else:\n if not v >= tmp[-1] >= tmp[-2] or v <= tmp[-1] <= tmp[-2]:\n tmp = []\n cnt += 1\n tmp.append(v)\n# print(d,tmp,c... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s138596786', 's158624427', 's700761588', 's718261765'] | [20644.0, 20416.0, 146752.0, 20364.0] | [82.0, 78.0, 1335.0, 88.0] | [332, 412, 356, 299] |
p03745 | u474925961 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import numpy as np\nn=int(input())\na=list(map(int,input().split()))\nb=a.copy()\nb.insert(0,0)\n\n\narr=np.array(b)\ndiff=np.diff(arr)\narr2=np.array(a)\naa=arr2[np.nonzero(diff)]\nprint(diff,aa)\n\naaa=aa.tolist()\npoint=[]\ncnt=1\nprint(aaa)\nif len(aaa)<=2:\n print(1)\nelse:\n for i in range(len(aaa)-2):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s551806751', 's565142470', 's469364567'] | [28032.0, 27956.0, 25008.0] | [283.0, 286.0, 259.0] | [591, 576, 537] |
p03745 | u487594898 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nP = list(map(int,input().split()))\ncnt = 1\nflag = 0 \nfor i in range(1,N+1):\n if P[i-1]!=P[i] and flag == 0:\n flag = 1\n elif flag == 1 and ((P[i-1] > P[i]) != (P[i-2]>P[i-1])):\n cnt += 1\n flag = 0\nprint(cnt)', 'N = int(input())\nP = list(map(int,input().split()))\n... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s026459425', 's166394532', 's343192018', 's519263379', 's527328269', 's908736535', 's730902318'] | [15020.0, 14252.0, 15020.0, 14224.0, 14252.0, 15020.0, 14252.0] | [92.0, 93.0, 97.0, 93.0, 96.0, 94.0, 91.0] | [266, 268, 252, 250, 250, 250, 355] |
p03745 | u488884575 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["n = int(input())\nA = list(map(int, input().split()))\n\nans = 1\nsq = 0\na = A[0]\nfor i in range(1,n):\n print(a,A[i], sq)\n if sq == 0 and A[i] < a:\n sq = -1\n elif sq == 0 and A[i] > a:\n sq = 1\n elif (sq == 1 and A[i] < a) or (sq == -1 and A[i] > a):\n print('---')\n ans... | ['Wrong Answer', 'Accepted'] | ['s843059874', 's179506867'] | [14252.0, 14252.0] | [267.0, 74.0] | [351, 353] |
p03745 | u493491792 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n,c,k=map(int,input().split())\nlista=[int(input())for i in range(n)]\nlistb=sorted(lista)\ncount=0\nbustime=0\nbuspeople=0\nfor i in listb:\n if buspeople==0 or bustime<i:\n count+=1\n buspeople=c-1\n bustime=i+k\n else :\n buspeople-=1\nprint(count)', 'n = int(input())\nlista=list(... | ['Runtime Error', 'Accepted'] | ['s272011824', 's679152379'] | [3064.0, 15020.0] | [17.0, 80.0] | [272, 440] |
p03745 | u536113865 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["li = lambda: list(map(int,input().split()))\n\nn,l,t = li()\na,ac,au = [],[],[]\nfor i in range(n):\n x,y = li()\n if i == 0: start = y\n a.append(x)\n if y == 1:\n ac.append(x)\n else:\n au.append(x)\n\ntt = t%l\n\nif start == 2:\n acc = [n-ac[-s] for s in range(1,len(ac)+1)]\n dis... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s345699090', 's613129349', 's161978823'] | [3188.0, 14252.0, 14252.0] | [17.0, 81.0, 80.0] | [1195, 278, 320] |
p03745 | u539517139 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\na=list(map(int,input().split()))\ns=n\nfor i in range(n-1):\n if a[i]!=a[i+1]:\n s=i\n f=0 if a[s]<a[s+1] else f=1\n break\np=0\nfor i in range(s+1,n-1):\n if f==0:\n if a[i]>a[i+1]:\n p+=1\n f=1\n else:\n if a[i]<a[i+1]:\n p+=1\n f=0\nprint(p)', 'n=int(input())\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s025741715', 's180119528', 's543250797'] | [3064.0, 14480.0, 14484.0] | [17.0, 75.0, 105.0] | [280, 418, 501] |
p03745 | u541610817 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA_lst = [int(x) for x in input().split()]\nB_lst =[]\nfor i in range(N - 1):\n B_lst.append(A_lst[i + 1] - A_lst[i])\n\ndef my_sign(n):\n return (n > 0) - (n < 0)\n\ncnt = 1\ni = 0\npm = my_sign(B_lst[0])\nwhile True:\n if i >= len(B_lst) - 1:\n break\n else:\n if my_sign(B... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s057734054', 's292943869', 's547475124'] | [14440.0, 201872.0, 14480.0] | [151.0, 2116.0, 101.0] | [557, 989, 731] |
p03745 | u541883958 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["n = int(input())\na = [int(c) for c in input().split(' ')]\nl = len(a)\nc = 1\nfor i in range(l):\n if i == 0:\n if l == 1:\n pass\n else:\n prev = a[0]\n if a[1] > a[0]:\n inc = True\n else:\n inc = False\n continue\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s188961209', 's988040855', 's802568791'] | [14252.0, 14436.0, 14224.0] | [92.0, 46.0, 97.0] | [582, 614, 658] |
p03745 | u542932305 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["N = int(input())\nA = list(map(int, input().split()))\ncount = 1\n\ntmp = A[0]\nbf = 1 if tmp < A[1] else 2 if tmp > A[1] else 0\naf = 0 # {1: '+', 2: '-'}\nfor i in range(1, N):\n if tmp < A[i]:\n af = 1\n elif tmp > A[i]:\n af = 2\n\n tmp = A[i]\n if af != bf:\n count += 1\n ... | ['Runtime Error', 'Accepted'] | ['s085222360', 's908078243'] | [14252.0, 15020.0] | [91.0, 73.0] | [405, 367] |
p03745 | u554954744 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nup = dn = False\npre = A[0]\nfor a in A[1:]:\n if pre < a:\n up = True\n elif pre > a:\n dn = True\n if up and dn:\n ans += 1\n up = dn = False\n pre = a\n\nprint(ans)\n', 'n = int(input())\nA = list(map(int, inp... | ['Wrong Answer', 'Accepted'] | ['s627172434', 's978604663'] | [19936.0, 20096.0] | [67.0, 67.0] | [258, 258] |
p03745 | u556160473 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["n = int(input())\na_ = list(map(int, input().split(' ')))\na = [-1]\ni = 0\nwhile i < n:\n if a[-1] != a_[i]:\n a.append(a_[i])\n i += 1\na = a[1:]\n\nret = 1\n\ni = 0\nwhile i < n-2:\n 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]):\n ret += 1\n i += 2\n ... | ['Runtime Error', 'Accepted'] | ['s041225702', 's103462023'] | [14436.0, 14436.0] | [128.0, 142.0] | [344, 356] |
p03745 | u562016607 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\nA=[int(i) for i in input().split()]\nT=[[A[0],A[1]]]\nk=0\nfor i in range(2,N):\n if len(T[k])<=1:\n T[k].append(A[i])\n #continue\n 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])):\n k+=1\n T.append([])\n T[k].append(A[i])\n else:... | ['Runtime Error', 'Accepted'] | ['s445594358', 's120039872'] | [19216.0, 14436.0] | [182.0, 120.0] | [347, 345] |
p03745 | u581309643 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import numpy as np\nN, L, T = map(int, input().split())\nX = []\nW = []\nant = [i for i in range(N)]\nfor i in range(N):\n xi, wi = map(int, input().split())\n X.append(xi)\n W.append(wi)\n\nnpX = np.array(X).astype(np.float)\nnpW = np.array(W).astype(np.float)\nnpW[npW == 2] = -1\n\ndef swap(ant, i, j):\n ... | ['Runtime Error', 'Accepted'] | ['s398976415', 's839520549'] | [21792.0, 15020.0] | [374.0, 78.0] | [765, 238] |
p03745 | u593567568 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int,input().split()))\n\nprev = A[0]\nisUp = True\nisDown = True\n\nans = 0\nfor a in A[1:]:\n if prev == a:\n pass\n elif prev < a:\n isDown = False\n if not isUp:\n isUp = True\n ans += 1\n elif a < prev:\n isUp = False\n if not isDown:\n isDown = True... | ['Wrong Answer', 'Accepted'] | ['s148660352', 's226510448'] | [14224.0, 14224.0] | [70.0, 73.0] | [353, 394] |
p03745 | u595064211 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\n\nword = []\ncount = 0\nstart = 0\nfor x in range(N):\n if start==N:\n print("break")\n break\n for i in range(N,1,-1):\n word = A[start:i]\n if word == sorted(word, reverse=True):\n count += 1\n start = i\n... | ['Wrong Answer', 'Accepted'] | ['s481462550', 's431046263'] | [14252.0, 14252.0] | [2104.0, 101.0] | [569, 389] |
p03745 | u598229387 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\na=[int(i) for i in input().split()]\n\nans=0\ndef plus_minus(i):\n while True:\n if a[i]==a[i+1]:\n i+=1\n continue\n if a[i]<a[i+1]:\n return 1\n if a[i]>a[i+1]:\n return -1\n\ncheck=plus_minus(0) \nans=1\nfor j in range(i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s100729454', 's102584348', 's334429904'] | [14252.0, 14436.0, 14428.0] | [46.0, 46.0, 91.0] | [574, 568, 609] |
p03745 | u602860891 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N, M = list(map(int, input().split()))\nline_list = list()\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n line_list.append((a, b))\n\npath_points = [ line_list[0][0], line_list[0][1] ]\n\nfor i in range(1, M):\n if line_list[i][0] not in path_points and line_list[i][1] not in path_points:\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s286960725', 's451675268', 's503239936', 's567756578', 's765320966', 's124276680'] | [3064.0, 14252.0, 15020.0, 3064.0, 14252.0, 15020.0] | [18.0, 89.0, 104.0, 17.0, 81.0, 113.0] | [617, 488, 372, 898, 314, 434] |
p03745 | u617116410 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\narray = list(map(int, input().split()))\nisHead = True\nisIncrease = False\ncount = 1\nfor i in range(1, n):\n if(isHead):\n isHead = False\n if(array[i] > array[i-1]):\n isIncrease = True\n elif(array[i] < array[i-1]):\n isIncrease = False\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s760707530', 's388677934'] | [14252.0, 14252.0] | [72.0, 89.0] | [596, 447] |
p03745 | u626467464 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nline = list(map(int,input().split()))\ncount = 0\nup = False\ndown =False\nfor i in range(n - 1):\n if line[i] < line[i + 1]:\n up = True\n elif line[i] > line[i + 1]:\n down = True\n if up == down == True:\n count += 1\n up =False\n down =False\nprint(count)', 'n = int(input())\nl... | ['Wrong Answer', 'Accepted'] | ['s152391999', 's404741591'] | [14224.0, 14224.0] | [81.0, 85.0] | [281, 281] |
p03745 | u626468554 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['#n = int(input())\n#n,k = map(int,input().split())\n#x = list(map(int,input().split()))\n\nN = int(input())\nA = list(map(int,input().split()))\n\nans = 0\nmm = 0\ni = 0\nwhile(i<N-2):\n if (A[i]-A[i+1])*(A[i+1]-A[i+2])<0:\n ans += 1\n i+=1\n i+=1\n \nprint(ans)\n\n\n', '#n = int(input())\n#n,k... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s460294879', 's655698456', 's684879348', 's640161053'] | [14252.0, 14252.0, 14228.0, 14252.0] | [93.0, 94.0, 90.0, 96.0] | [272, 272, 272, 593] |
p03745 | u629350026 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\na=list(map(int,input().split()))\nans=1\ntemp=0\ncnt=0\nfor i in range(1,n-1):\n cnt=cnt+1\n if a[i-1]<a[i] and temp==0:\n temp=1\n elif a[i-1]>a[i] and temp==0:\n temp=2\n elif a[i-1]>a[i] and temp==1:\n temp=2\n if cnt>1:\n ans=ans+1\n cnt=0\n elif a[i-1]<a[i] and temp==2:... | ['Wrong Answer', 'Accepted'] | ['s423813166', 's321842667'] | [14480.0, 14228.0] | [116.0, 102.0] | [400, 290] |
p03745 | u636387751 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\n\ncount = 0\nans = 1\nbef = 0\nbuff = True\nfor i in A:\n if count == 0:\n count = 1\n elif count == 1:\n if bef < i:\n count += 1\n elif bef > i:\n count += 1\n buff = False\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s315670614', 's620169679'] | [14252.0, 14252.0] | [69.0, 70.0] | [588, 624] |
p03745 | u672475305 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nlst = list(map(int,input().split()))\n\nm = -1 \nif n==1 or n==2:\n print(1)\nelse:\n cnt = 0\n num = lst[0]\n mode = 0\n for i in range(1,n):\n if mode==0:\u3000\n if lst[i]==num:\n continue \n elif lst[i] > num:\n ... | ['Runtime Error', 'Accepted'] | ['s620168336', 's476855410'] | [2940.0, 14436.0] | [17.0, 74.0] | [661, 599] |
p03745 | u678167152 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\ndef solve(N,A):\n liss = []\n lis = []\n lis.append(A[0])\n a = A[0]\n for i in range(1,N):\n if len(lis)==1 or prev==0:\n if A[i]>a:\n prev = 1\n elif A[i]<a:\n prev = -1\n else... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s594112150', 's645505506', 's266774223'] | [3060.0, 14252.0, 19908.0] | [17.0, 74.0, 67.0] | [528, 360, 231] |
p03745 | u691896522 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\nans = 0\nif n <= 2:\n print(1)\n exit()\npre = a[1] - a[0]\ni = 2\nwhile i < n:\n if pre * (a[i] - a[i-1]) < 0:\n ans += 1\n i += 1\n if i == n:\n break\n if a[i] != a[i-1]:\n pre = a[i] - a[i-1]\n i += 1\npri... | ['Wrong Answer', 'Accepted'] | ['s852129341', 's053805515'] | [14252.0, 14224.0] | [108.0, 105.0] | [313, 329] |
p03745 | u692632484 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\nA=[int(i) for i in input().split()]\nB=[]\nendflag=False\nans=1\nif N>2:\n\tfor i in range(N-1):\n\t\tif A[i]<A[i+1]:\n\t\t\tB.append(1)\n\t\telif A[i]==A[i+1]:\n\t\t\tB.append(0)\n\t\telse:\n\t\t\tB.append(-1)\n\tcount=0\n\twhile B[count]==0:\n\t\tcount+=1\n\t\tif count>N-1:\n\t\t\tendflag=True\n\t\t... | ['Wrong Answer', 'Accepted'] | ['s842960334', 's488675803'] | [14480.0, 14480.0] | [189.0, 117.0] | [598, 601] |
p03745 | u706884679 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = input().split()\n\nc = 1\ni = 1\nwhile i <= N-2:\n\tif int(A[i])-int(A[i-1]) > 0:\n\t\tif int(A[i+1])-int(A[i]) < 0:\n\t\t\tc += 1\n\t\t\ti += 2\n\t\telse:\n\t\t\ti += 1\n\telif int(A[i])-int(A[i-1]) < 0:\n\t\tif int(A[i+1])-int(A[i]) > 0:\n\t\t\tc += 1\n\t\t\ti += 2\n\t\telse:\n\t\t\ti += 1\n\t... | ['Wrong Answer', 'Accepted'] | ['s068160552', 's650624087'] | [11096.0, 11448.0] | [202.0, 1541.0] | [304, 349] |
p03745 | u729707098 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import numpy as np\nn = int(input())\na = [int(i) for i in input().split()]\nanswer= 1\nif n!=1: np.sign(a[1]-a[0])\nfor i in range(1,n-1):\n\tnum = np.sign(a[i+1]-a[i])\n\tif flag==0:\n\t\tflag = num\n\telif num==-flag:\n\t\tanswer += 1\n\t\tflag = 0\nprint(answer)', 'import numpy as np\nn = int(input())\na = [int(i... | ['Runtime Error', 'Accepted'] | ['s920471448', 's592218262'] | [23104.0, 23100.0] | [182.0, 516.0] | [245, 253] |
p03745 | u731436822 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['\n\nN = int(input())\nA = list(map(int,input().split()))\n\ncount = 0\nsign = 0\nfor i in range(N-1):\n if sign == 0:\n sign = A[i+1]-A[i]\n elif sign*(A[i+1]-A[i]) < 0:\n count += 1\n sign = 0\nprint(count)', '\n\nN = int(input())\nA = list(map(int,input().split()))\n\ncount = 0\nsign = 0\... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s719261186', 's852757592', 's305101091'] | [15020.0, 14224.0, 15020.0] | [75.0, 74.0, 72.0] | [332, 330, 332] |
p03745 | u731467249 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["N = int(input())\nA = list(map(int, input().split()))\n\nli = []\n\nfor i in range(N-1):\n if A[i+1] - A[i] > 0:\n li.append('+')\n elif A[i+1] - A[i] < 0:\n li.append('-')\n else:\n pass\nprint(li)\nans = 1\np = 0\nm = 0\nfor i in li:\n if i == '+':\n p = 1\n elif i == '-':\... | ['Wrong Answer', 'Accepted'] | ['s493999383', 's293592579'] | [20268.0, 20452.0] | [98.0, 97.0] | [392, 394] |
p03745 | u733738237 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\na=list(map(int,input().split()))\na.insert(0,0)\nprint(a,len(a))\ncnt=1\nval=0\nl=len(a)-1\nfor n in range(1,l):\n\tif a[n-1]<=a[n]:\n\t\tval=1\n\t\tcontinue\n\telif a[n-1]>a[n] and val==1:\n\t\tif n==l-2:\n\t\t\tcnt+=1\n\t\tval=0\n\t\tcnt+=1\n\telif a[n-1]>=a[n]:\n\t\tval=2\n\t\tcontinue\n\telif a[n-... | ['Wrong Answer', 'Accepted'] | ['s134064230', 's990969992'] | [14480.0, 14228.0] | [101.0, 92.0] | [348, 284] |
p03745 | u740284863 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import sys\ninput = sys.stdin.readline\nn = int(input())\nA = list(map(int,input().split()))\nans = 1\nfor i in range(n-1):\n if A[i] > A[i+1]:\n ans += 1\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\n\nans = 1\nstatus = 0\nprev = a[0]\n\nfor i in a:\n diff = i - prev\n\n if di... | ['Wrong Answer', 'Accepted'] | ['s877325590', 's286423723'] | [14252.0, 20140.0] | [73.0, 73.0] | [168, 420] |
p03745 | u757030836 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\n\nans = 1\nup,down = False,False\nfor i in range(N-1):\n if A[i] < A[i+1]:\n up = True\n elif A[i] > A[i+1]:\n down = True\n if up and dn:\n ans +=1\n up,down = False,False\n \nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\... | ['Runtime Error', 'Accepted'] | ['s856027747', 's111967714'] | [14252.0, 14252.0] | [75.0, 79.0] | [246, 263] |
p03745 | u760961723 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int,input().split()))\n\nans = 1\ni = 0\n\nls = [0]*(N-1)\nfor i in range(N-1):\n if A[i] > A[i+1]:\n ls[i] = 1\n elif A[i] < A[i+1]:\n ls[i] = -1\n else:\n if i == 0:\n ls[i] = 0\n else:\n ls[i] = ls[i-1]\n\nprint(ls)\n\nj = 0\nwhile j < N-2:\n if ls[j] == 1:\... | ['Wrong Answer', 'Accepted'] | ['s920050581', 's837403482'] | [14480.0, 14252.0] | [134.0, 79.0] | [435, 376] |
p03745 | u761320129 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nsrc = map(int,input().split())\nasc = 0\nans = 1\nfor i in range(N-1):\n d = src[i+1] - src[i]\n if asc * d < 0:\n ans += 1\n asc = 0\n else:\n asc = d\nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\nup = dn = False\nans = 1\np = A[0]\nfor a in A:\n... | ['Runtime Error', 'Accepted'] | ['s667534015', 's715212195'] | [11096.0, 14252.0] | [27.0, 66.0] | [200, 242] |
p03745 | u767664985 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = [0] * N\nfor i in range(N):\n\tA[i] = int(input())\n\nfor j in range(1, N):\n\tif A[j] in A[: j]:\n\t\tA[A[: j].index(A[j])] = -1\n\t\tA[j] = -1\n\n\nprint(len([k for k in A if k != -1]))\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nchange = 0 # 1, 0, -1\nans = 1\n\nfor i in ra... | ['Runtime Error', 'Accepted'] | ['s763670611', 's334840992'] | [5908.0, 14252.0] | [24.0, 82.0] | [193, 479] |
p03745 | u780475861 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n, *lst = map(int, open(0).read().split())\nif n < 3:\n print(1)\n quit()\ngroup = 0\nstart = (lst[1] >= lst[0])\nfor i in range(2, n - 1):\n if (lst[i] >= lst[i - 1]) != start:\n start = (lst[i + 1] >= lst[i])\n group += 1\nif (lst[-1] >= lst[-2]) != start:\n group += 1\nif group != 0:\n group += 1\nprint... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s262817213', 's511302191', 's573592982', 's985622773', 's628138653'] | [14052.0, 14052.0, 14052.0, 14052.0, 14052.0] | [71.0, 70.0, 70.0, 70.0, 69.0] | [312, 308, 311, 284, 326] |
p03745 | u785989355 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['\nN=int(input())\nA = list(map(int,input().split()))\nprev = A[0]\ncount=1\ndirection = 0\nfor i in range(1,N):\n if A[i] > prev:\n if direction==0:\n direction=1\n elif direction==-1:\n count+=1\n direction=1\n elif A[i] < prev:\n if direction==0:\n ... | ['Wrong Answer', 'Accepted'] | ['s138968837', 's337041655'] | [14252.0, 14436.0] | [82.0, 80.0] | [423, 544] |
p03745 | u787059958 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nL = list(map(int, input().split()))\n\nif n == 1:\n print(1)\n exit()\n\nd = [0] * (n - 1)\nif (L[0] > L[1]):\n d[0] = -1\nelif (L[0] < L[1]):\n d[0] = 1\n\ncnt = 1\ndec_cnt = 0\nfor i in range(n):\n if (i == 0):\n continue\n elif (i == n - 1):\n break\n else:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s323639785', 's858333001', 's984163596'] | [109100.0, 14480.0, 14252.0] | [2104.0, 125.0, 115.0] | [747, 743, 955] |
p03745 | u787456042 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N,*A=map(int,open(0).read().split());f=a=0\nfor i,j in zip(A,A[1:]):\n if f:\n if(f<0)&(i<j)|(0>f)&(i>j):a+=1;f=0\n else:f=(i<j)-(i>j)\nprint(a+1)', 'N,*A=map(int,open(0).read().split());f=a=0\nfor i,j in zip(A,A[1:]):\n if f:\n if(f<0)&(i<j)|(f>0)&(i>j):a+=1;f=0\n else:f=(i<j)-(i>j)\nprint(a+1)'] | ['Wrong Answer', 'Accepted'] | ['s145454296', 's947831237'] | [14052.0, 14052.0] | [69.0, 73.0] | [142, 142] |
p03745 | u798818115 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['# coding: utf-8\n# Your code here!\n_=int(input())\nA=list(map(int,input().split()))\nN=len(A)\n\ntrend=0\nans=0\nfor i in range(N-1):\n temp=A[i+1]-A[i]\n if trend==0:\n if temp>0:\n trend=1\n ans+=1\n elif temp<0:\n trend=-1\n ans+=1\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s778622490', 's488193075'] | [14436.0, 14252.0] | [80.0, 82.0] | [617, 605] |
p03745 | u799479335 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import numpy as np\nN = int(input())\nAs = input().split()\nfor i in range(N):\n As[i] = int(As[i])\nAs = np.array(As)\n\n\ndef get_sign(x):\n if x>0:\n return +1\n elif x<0:\n return -1\n else:\n return 0\n\nans = 1\na0 = None\na1 = None\nfor a in As:\n if a0 is None:\n a0 ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s214016239', 's234638244', 's981636558', 's063729354'] | [20160.0, 21392.0, 20144.0, 20164.0] | [538.0, 424.0, 690.0, 726.0] | [565, 498, 538, 588] |
p03745 | u814986259 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\na=list(map(int,input().split()))\ndiff=[a[i+1]-a[i] for i in range(N-1)]\nans=[0,0]\n\nfor i in range(N-1):\n if diff[i]<0:\n ans[0]+=1\n elif diff[i]>0:\n ans[1]+=1\nprint(min(ans)+1)\n', 'N=int(input())\na=list(map(int,input().split()))\nflag=0\nans=1\nfor i in range(1,N):\n if flag== 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s314650629', 's273946951'] | [14252.0, 14252.0] | [76.0, 77.0] | [199, 356] |
p03745 | u835283937 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['def main():\n # N = int(input())\n # A = [int(a) for a in input().split()]\n\n f = open("subtask_1_02.txt", "r")\n N = int(f.readline())\n A = [int(a) for a in f.readline().split()]\n\n idx = 0\n ans = 0\n for i in range(len(A)):\n if idx + 1 > len(A) - 1 :\n break\n\n ... | ['Runtime Error', 'Accepted'] | ['s516847398', 's474129629'] | [9096.0, 20164.0] | [26.0, 91.0] | [1394, 1278] |
p03745 | u835482198 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split))\n# N = 9\n# A = [1, 2, 1, 2, 1, 2, 1, 2, 1]\n# N = 7\n# A = [1, 2, 3, 2, 1, 999999999, 1000000000]\n# N = 6\n# A = [1, 2, 3, 2, 2, 1]\n# N = 2\n# A = [1, 1]\nA = A + [A[-1]]\n\nd = 0\ni = 0\n\ninc = None\nwhile i < N:\n if inc is None:\n if A[i] < A[i + 1]... | ['Runtime Error', 'Accepted'] | ['s158174043', 's432767859'] | [5132.0, 15020.0] | [19.0, 82.0] | [660, 662] |
p03745 | u846226907 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import sys\n\nread= sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nMOD = 1000000007\nsys.setrecursionlimit(10**7)\n\nN = int(readline())\nA = list(map(int,readline().split()))\n\nres = 0\n\nin_i = 0\nde_i = 0\ni = 0\nwhile i <= N-1:\n for j in range(i+1,N):\n ... | ['Runtime Error', 'Accepted'] | ['s984572817', 's527842943'] | [12992.0, 14484.0] | [2104.0, 93.0] | [543, 1184] |
p03745 | u852798899 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\n\nans = 1\njudge = -1\nfor i in range(n-1):\n if a[i] == a[i+1]:\n break\n elif a[i] < a[i+1]:\n if judge == -1:\n ans += 1\n else:\n judge = 1\n elif a[i] > a[i+1]:\n if judge == 1:\n ans += 1\n else:\n judge = 1 \nprin... | ['Wrong Answer', 'Accepted'] | ['s980554827', 's132343888'] | [14252.0, 14252.0] | [89.0, 75.0] | [306, 338] |
p03745 | u854685751 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\na = list(map(int,input().split(" ")))\n\nc = 1\n\nt = a[0]\nfor i in a[1:]:\n\tif t > i:\n\t\tc += 1\n\tt = i\n\nprint(c)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n', 'N = int(input())\na = list(map(int, input().split(" ")))\n\nl = [[] for i in range(N)]\nc = 0\n\ns = 0\nt = a[0]\n\nfor i in a[1:]:\n\tif t... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s003678069', 's558556986', 's698445343'] | [14252.0, 33044.0, 23444.0] | [55.0, 170.0, 259.0] | [142, 436, 608] |
p03745 | u857070771 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\n*a,=map(int,input().split())\ncnt=0\nmode=0\nfor i in range(n-1):\n if mode==0:\n if a[i]<a[i+1]:\n cnt+=1\n mode="inc"\n elif a[i]>a[i+1]:\n cnt+=1\n mode="dec"\n if a[i]<a[i+1]:\n if mode=="inc":\n pass\n else:\... | ['Runtime Error', 'Accepted'] | ['s273923830', 's051169538'] | [14252.0, 14252.0] | [89.0, 94.0] | [466, 467] |
p03745 | u868701750 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\na = A[::]\n\ncount = 1\nwhile len(a) > 1:\n first_tilt = 0\n for i in range(1, len(a)):\n if a[i] - a[i - 1] > 0:\n first_tilt = 1\n break\n if a[i] - a[i - 1] < 0:\n first_tilt = -1\n break\n\n i... | ['Wrong Answer', 'Accepted'] | ['s652912070', 's595342393'] | [14100.0, 14432.0] | [2108.0, 83.0] | [827, 820] |
p03745 | u896741788 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\nl=[0]+list(map(int,input().split()))+[0]\na,s=0,0\nfor i in range(1,n+1):\n fa,fs=1,1\n if l[i-1]<=l[i]:fa=0\n if l[n-i]>=l[n-i+1]:fs=0\n a+=fa\n s+=fs\nprint(min(a,s)+1)', 'n=int(input())\nl=list(map(int,input().split()))\nif len(set(l))==1:print(1);exit()\nfrom itertools import groupby as gb\nl... | ['Wrong Answer', 'Accepted'] | ['s766591380', 's647283407'] | [15020.0, 14736.0] | [112.0, 101.0] | [182, 513] |
p03745 | u897329068 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nAN = list(map(int,input().split()))\n\ncuts = []\ncutNum = []\nfor beforePM in [1,-1]:\n\tcuts = []\n\tfor ai in range(N-1):\n\t\tif beforePM == 1:\n\t\t\tif AN[ai] < AN[ai+1]:\n\t\t\t\tbeforePM = -1\n\t\t\t\tai+=1\n\t\t\t\tcuts.append(1)\n\t\t\telif AN[ai] > AN[ai+1]:\n\t\t\t\tcuts.append(0)\n\t\t\... | ['Wrong Answer', 'Accepted'] | ['s878775478', 's019517194'] | [14100.0, 14252.0] | [160.0, 78.0] | [586, 856] |
p03745 | u903005414 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["import numpy as np\nN = int(input())\nA = np.array(list(map(int, input().split())))\n\nv = A[1:] - A[:-1]\n# print(v)\n\ncnt = 0\ni = 0\nwhile i <= len(v) - 1:\n # print('i', i)\n if v[i] * v[i + 1] < 0:\n cnt += 1\n i += 1\n i += 1\nans = cnt + 1\nprint(ans)\n\n\n\n\n", 'import sys\ninput = sy... | ['Runtime Error', 'Accepted'] | ['s429074710', 's103144115'] | [23128.0, 18336.0] | [350.0, 76.0] | [418, 388] |
p03745 | u905582793 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int,input().split()))\nflg = 0\nans = 0\nfor i in range(1,n):\n if a[i] == a[i-1]:\n continue\n elif a[i] > a[i-1]:\n if flg == -1:\n ans += 1\n flg = 1\n elif a[i] < a[i-1]:\n if flg == 1:\n ans += 1\n flg = -1\nprint(ans)', 'n = int(input())\na = list(map(i... | ['Wrong Answer', 'Accepted'] | ['s960215051', 's131000730'] | [14224.0, 14224.0] | [90.0, 93.0] | [267, 321] |
p03745 | u912652535 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['\nimport numpy as np\n\nn = int(input())\na = np.array(list(map(int,input().split())))\n\n\nret = 0\ni = 0\nwhile i < len(a):\n j = i\n while j < n -1 and a[j] <= a[j+1]:\n j += 1\n h = i\n while h < n - i and a[h] >= a[h +1 ]:\n h += 1\n i = max(h,j) + 1\n ret += 1\n\nprint(r... | ['Runtime Error', 'Accepted'] | ['s623498491', 's568579399'] | [23128.0, 23084.0] | [2109.0, 279.0] | [303, 294] |
p03745 | u941438707 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n,*a=map(int,open(0).read().split()) \na+=[0]\nb,c,=a[0]>a[1],0\nfor i in range(n-1):\n if a[i]==a[i+1]:\n continue\n elif (a[i]>a[i+1])!=b:\n b=a[i+1]>a[i+2]\n c+=1\nprint(c+1) ', 'n,*a=map(int,open(0).read().split())\nans=1\nvec=0\nfor i in range(n-1):\n now=a[i+1]-a[i]\n if ... | ['Wrong Answer', 'Accepted'] | ['s851142273', 's229586914'] | [14052.0, 20072.0] | [83.0, 77.0] | [203, 180] |
p03745 | u942051624 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\nA=list(map(int,input().split()))\nif N==1:\n print(1)\n exit()\n\nB=[A[i]-A[i-1] for i in range(1,N)]\nans=0\nfor i in range(N-1):\n if B[i]!=0:\n first=B[i]\nfor i in range(N-1):\n if first*B[i]>=0:\n pass\n else:\n ans+=1\n if i+1<=N-2:\n first=B... | ['Wrong Answer', 'Accepted'] | ['s000404519', 's588650184'] | [20372.0, 20196.0] | [96.0, 88.0] | [320, 478] |
p03745 | u943707649 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split(" ")))\n\nlist = []\nsim=0\nfor i in range(N-1):\n if A[i]<A[i+1]:\n list.append(1)\n if A[i]>A[i+1]:\n list.append(0)\n if A[i]==A[i+1]:\n sim+=1\n\nprint(list)\n\ni = 0\ncount = 0\n\nwhile i<N-2-sim:\n if list[i] != list[i+1]:\n count += 1\n i+=1\... | ['Wrong Answer', 'Accepted'] | ['s335782947', 's913107703'] | [20368.0, 20192.0] | [117.0, 111.0] | [321, 312] |
p03745 | u944643608 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int, input().split()))\ncount = 0\nup = 0\ndown = 0\nbefore = A[0]\ntmp = 0\nfor i in range(1,N):\n tmp = A[i]\n if (up == 0) and (down == 0):\n if tmp > before:\n up = 1\n before = tmp\n elif tmp < before:\n down = 1\n before = tmp\n else:\n continue... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s677578538', 's690924921', 's769203347', 's836471977', 's869057001', 's844251207'] | [15020.0, 2940.0, 3064.0, 3064.0, 14252.0, 14436.0] | [57.0, 17.0, 17.0, 17.0, 45.0, 77.0] | [303, 8, 506, 508, 101, 567] |
p03745 | u948524308 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int,input().split()))\n\nc = 0\ni =2\n\nif N ==1 or N ==2:\n print(1)\n exit()\nwhile i<N+1:\n if (A[i-1]-A[i-2])*(A[i]-A[i-1])<0:\n c=c+1\n i = i+1\n i = i+1\nprint(c+1)', 'N,C,K = map(int,input().split())\nT = [int(input()) for i in range(N)]\n\nT.sort()\ni =... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s257600506', 's819908091', 's328078628'] | [14252.0, 3064.0, 14252.0] | [92.0, 17.0, 81.0] | [213, 341, 363] |
p03745 | u953794676 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = 6\na = [int(e) for e in input().split()]\ncount = 1\nfor i in range(1, len(a)-1):\n if a[i] < a[i-1] and a[i+1] < a[i]:\n count = count + 1\n elif a[i] > a[i-1] and a[i] > a[i+1] :\n count = count + 1\nprint(count)', 'N = int(input())\nA = list(map(int,input().split()))\ni = 0\ncount = 1\nwhil... | ['Wrong Answer', 'Accepted'] | ['s099912449', 's512614531'] | [3060.0, 14224.0] | [17.0, 96.0] | [230, 460] |
p03745 | u954774382 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import sys\nfrom functools import lru_cache, cmp_to_key\nfrom heapq import merge, heapify, heappop, heappush\nfrom math import *\n# import math\nfrom collections import defaultdict as dd, deque, Counter as C\nfrom itertools import combinations as comb, permutations as perm\nfrom bisect import bisect_left as bl, bisec... | ['Runtime Error', 'Accepted'] | ['s440677161', 's464876063'] | [5124.0, 16304.0] | [36.0, 123.0] | [1456, 1458] |
p03745 | u957084285 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\n\na.sort(reverse=True)\n\nans = 0\nfor i in range(n):\n ans += a[2*i+1]\n\nprint(ans)', 'n = int(input())\nb = list(map(int, input().split()))\na = [b[0]]\nfor i in range(1, n):\n if a[-1] != b[i]:\n a.append(b[i])\n\nans = 1\ninc = a[0] < a[min(1, n... | ['Runtime Error', 'Accepted'] | ['s482480801', 's573690931'] | [14252.0, 14224.0] | [87.0, 101.0] | [134, 334] |
p03745 | u962829271 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["import pdb\n\n\ndef main():\n num = int(input())\n array = []\n tmp = input()\n for i in range(num):\n array.append(int(tmp.split()[i]))\n \n ans = 1\n div = 0\n prev = 0\n count = 0\n #pdb.set_trace()\n for tmp in array:\n count += 1\n if(count == 1):\n ... | ['Wrong Answer', 'Accepted'] | ['s231226192', 's338054558'] | [13344.0, 16284.0] | [2104.0, 97.0] | [781, 781] |
p03745 | u968404618 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\n\nans = 1\nx = 0\n\nfor i in range(n-1):\n if A[i] < A[i+1]:\n if x == -1:\n ans += 1\n x = 0\n elif x == 0:\n x = 1\n elif A[i] > A[i+1]:\n if x == 1:\n ans += 1\n x = 0\n e... | ['Runtime Error', 'Accepted'] | ['s529705504', 's080139080'] | [14252.0, 14228.0] | [42.0, 80.0] | [342, 342] |
p03745 | u980205854 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['\nimport numpy as np\n\nN = int(input())\nA = list(map(int, input().split()))\nsgn = 0\nans = 1\n\nfor i in range(N-1):\n tmp = np.sign(A[i+1]-A[i])\n if tmp*sgn<0:\n ans += 1\n sgn = np.sign(2*sgn+tmp)\n\nprint(ans)', '\nimport numpy as np\n\nN = int(input())\nA = list(map(int, input().split()))\nsgn... | ['Wrong Answer', 'Accepted'] | ['s255200633', 's319550619'] | [23128.0, 23208.0] | [818.0, 810.0] | [237, 267] |
p03745 | u993268357 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["n = int(input().split())\nnum_list = [int(i) for i in input().split()]\nif len(num_list)==1:\n print(1)\nelse:\n res = 1\n flag = None\n pre = num_list[0]\n for i in num_list[1:]:\n if pre > i and not flag:\n flag = 'down'\n \n elif pre < i and not flag:\n flag = 'up'\n \n elif (pre > i ... | ['Runtime Error', 'Accepted'] | ['s250474773', 's175905998'] | [3064.0, 14252.0] | [17.0, 80.0] | [407, 399] |
p03745 | u997607103 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nl = [int(x) for x in input().split()]\n\norder = 0\nsubs = []\ntmp = []\n\nprev = 0\nd = []\nt = [l[0]]\nfor x in range(len(l)-1):\n a,b = l[x],l[x+1]\n c = a-b\n print(a,b,c, prev)\n if c == 0:\n t.append(b)\n elif prev == 0:\n t.append(b)\n prev = c\n elif (c < 0 and prev < 0) or (... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s055359932', 's067760963', 's511678138'] | [15732.0, 15664.0, 14428.0] | [368.0, 350.0, 121.0] | [412, 397, 414] |
p03745 | u999503965 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\nl=list(map(int,input().split()))\n\nif n=<2:\n print(1)\n exit()\n \ncnt=0\n\nif l[0]>l[1]:\n ans="low"\nelif l[0]<l[1]:\n ans="high"\nelse:\n ans="even"\n \nfor i in range(2,n):\n if l[i-1]>l[i] and (ans=="low" or ans=="even"):\n ans="low"\n elif l[i-1]<l[i] and (ans=="high" or ans=="even... | ['Runtime Error', 'Accepted'] | ['s228631361', 's821938583'] | [9008.0, 20164.0] | [26.0, 84.0] | [404, 404] |
p03747 | u054556734 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coor... | ['\n\n\n\nn,l,t=map(int,input().split())\nx=[0 for i in range(n+1)]\nw=[0 for i in range(n+1)]\nans=[]\n\nfor i in range(1,n+1):\n x[i],w[i]=map(int,input().split())\n if w[i]==1: a=(x[i]+t)%l\n else: a=(x[i]-t+l)%l\n ans.append(a)\n\n\ncrash=0\nfor i in range(2,n+1):\n if w[i] != w[1]:\n if w[1] ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s225070966', 's376205139', 's512889040', 's965046347', 's977935243'] | [16160.0, 2940.0, 15980.0, 15980.0, 12912.0] | [516.0, 17.0, 569.0, 557.0, 561.0] | [845, 1176, 1045, 1045, 604] |
p03747 | u095021077 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coor... | ["N, L, T=map(int, input().split())\nXW=[list(map(int, input().split())) for _ in range(N)]\nX_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)]\nX_.sort()\nA0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L\nP0_=X_.index(A0_)\nif P0_>0:\n X_=X_[P0_:]+X_[:P0_]\n \nif XW[0][1]==1:\n C0_=... | ['Runtime Error', 'Accepted'] | ['s511303391', 's563055444'] | [31052.0, 31664.0] | [462.0, 454.0] | [700, 702] |
p03747 | u099643902 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coor... | ['N, L, T = map(int, input().split())\nX = [0 for i in range(N)]\nW = [0 for i in range(N)]\nE = [0 for i in range(N)]\ncount = 0\nfor i in range(N):\n X[i], W[i] = map(int, input().split())\n if W[i] == 1:\n end = X[i] + T\n end = end % L\n if W[i] == 2:\n end = X[i]-T\n end = end ... | ['Wrong Answer', 'Accepted'] | ['s465367224', 's102106514'] | [15044.0, 13864.0] | [630.0, 648.0] | [1096, 1157] |
p03747 | u104282757 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coor... | ['# C\nimport numpy as np\nN, L, T = map(int, input().split())\nX = list()\nW = list()\npositions = list()\nfor _ in range(N):\n x, w = map(int, input().split())\n X.append(x)\n W.append(w)\n if w == 1:\n positions.append((x + T) % L)\n else:\n positions.append((x - T) % L)\n\n# find which ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s372319767', 's760707802', 's136403361'] | [22452.0, 21872.0, 12860.0] | [917.0, 906.0, 470.0] | [718, 718, 862] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.