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
p02958
u400221789
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\np=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n if not i+1 != p[i]:\n count+=1\nif count==0 or count==2:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\np=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n if i+1 != p[i]:\n count+=1\nif count==0 or count==2:...
['Wrong Answer', 'Accepted']
['s776554460', 's447000979']
[3060.0, 2940.0]
[17.0, 17.0]
[169, 166]
p02958
u401452016
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(map(int, input().split()))\n\nL=[]\nfor i in range(n):\n if i+1 !=p[i]:\n L.append([i, p[i]])\n if len(L)==2:\n break\n\n\nif len(L)<=1:\n print('Yes')\nelse:\n p[L[0][0]] = L[1][1]\n p[L[1][0]] = L[0][1]\n if p == sorted(p):\n print('Yes')\n else:\...
['Wrong Answer', 'Accepted']
['s340938598', 's548014051']
[3064.0, 3064.0]
[18.0, 17.0]
[319, 319]
p02958
u402467563
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\np = list(map(int, input().split()))\ncount = 0\n\nfor i in range(N-1):\n if (int(p[i])+1) != int(p[i+1]):\n count += 1\n\nif count == 0 or count == 3:\n print('YES')\nelse:\n print('NO')\n", "N = int(input())\np = list(map(int, input().split()))\ncount = 0\n\nfor i in range(N-1):\n if p[i]+1 ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s191651403', 's357080790', 's381912916', 's589012833', 's649936740', 's952451816', 's704534835']
[2940.0, 3060.0, 3060.0, 3064.0, 3060.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 17.0]
[200, 187, 187, 232, 232, 200, 182]
p02958
u407016024
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int, input().split()))\ncnt = 0\nfor n in range(N):\n if p[n] != i+1:\n cnt+=1\n\nif cnt <= 2:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\np = list(map(int, input().split()))\ncnt = 0\nfor n in range(N):\n if p[n] != i+1:\n cnt+=1\n\nif cnt <= 2:\n...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s214304115', 's296930943', 's580418809', 's648091859']
[2940.0, 2940.0, 3060.0, 3060.0]
[18.0, 18.0, 18.0, 24.0]
[167, 167, 190, 167]
p02958
u407415713
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\na = list(map(int, input().split()))\n\nbox=[]\n\nfor i in range(n-1):\n if i == a[i]:\n pass\n else:\n box.append(i)\nif len(box) == 0 or len(box) == 2:\n print('YES')\nelse:\n print('NO')", "n = int(input())\na = list(map(int, input().split()))\n\nbox=[]\nprint(a)\nprint(box)\n\nfor i in ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s298997226', 's348286406', 's111166216']
[3060.0, 3060.0, 3060.0]
[20.0, 17.0, 18.0]
[288, 308, 288]
p02958
u409757418
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = input()\nl = input().split(" ")\nns = []\nk = 0\nfor i in range(int(n)):\n ns.append(i+1)\n if int(l[i]) != ns[i]:\n k += 1\nif k <= 2:\n print("Yes")\nelse:\n print("No")\n', 'n = input()\nl = input().split(" ")\nns = []\nk = 0\nfor i in range(int(n)):\n ns.append(i+1)\n if int(l[i]) != ns[i]:\n k +=...
['Wrong Answer', 'Accepted']
['s666976294', 's179493855']
[2940.0, 3060.0]
[17.0, 17.0]
[172, 171]
p02958
u409814604
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(input())\nl=list(range(1,N+1))\nprint(l)\na=list(map(int, input().split()))\nprint(a)\ncount=0\nfor i in range(0, len(l)):\n if l[i]==a[i]:\n count=count+1\nprint(count)\nif count >= N-2:\n print("Yes")\nelse:\n print("No")', 'N=int(input())\nl=list(range(1,N+1))\na=list(map(int, input().split()))\ncount=...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s382652455', 's809289231', 's704083591']
[3064.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[222, 191, 191]
p02958
u412481017
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\nr=list(map(int,input().split()))\na=sorted(r)\n\nr="".join(r)\na="".join(a)\n\ncount=0\ni=0\nwhile i<len(r):\n if r[i]!=r[i]:count+=1\n \nprint("Yes" if count<=2 else "No")\n', 'input()\nr=list(map(int,input().split()))\n\ni=1\ncount=0\nfor item in r:\n if item!=i:count+=1\n i+=1\n\nprint("YES" ...
['Runtime Error', 'Accepted']
['s244614246', 's387628650']
[3060.0, 2940.0]
[17.0, 17.0]
[181, 132]
p02958
u416223629
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["a = [input().split() for l in range(2)]\nN=int(a[0][0])\np=a[1]\nprint(N)\nprint(p)\ncount=0\nfor i in range(N):\n if int(p[i])!=i+1:\n count=count+1\n\nif count==0 or count==2:\n print('YES')\nelse:\n print('NO')\n", "a = [input().split() for l in range(2)]\nN=int(a[0][0])\np=a[1]\ncount=0\nfor i in ...
['Wrong Answer', 'Accepted']
['s631826132', 's382059639']
[3060.0, 2940.0]
[17.0, 18.0]
[217, 199]
p02958
u417794477
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np_array = [int(x) for x in input().split()]\n\nmy_array = list(range(1,N+1))\nans_array = []\nnum = 0\n\nfor i in range(0,N):\n\tnum = p_array[i] - my_array[i]\n\tans_array.append(num)\n\nprint(ans_array)\nnew_lst = [e for e in ans_array if e != 0]\nif len(new_lst)==0:\n\tans = "YES"\nelif len(new_l...
['Wrong Answer', 'Accepted']
['s709045760', 's768070690']
[3064.0, 27292.0]
[17.0, 118.0]
[364, 637]
p02958
u418149936
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\np_ls = list(map(int, input().split(' ')))\ncnt = 0\n\nfor i in range(len(p_ls) - 1):\n min_idx = i\n for j in range(i + 1, len(p_ls)):\n if p_ls[min_idx] > p_ls[j]:\n min_idx = j\n if min_idx != i:\n p_ls[min_idx], p_ls[i] = p_ls[i], p_ls[min_idx]\n cnt += 1\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s115880745', 's668267402', 's253416503']
[9016.0, 9024.0, 9100.0]
[28.0, 28.0, 28.0]
[357, 357, 357]
p02958
u422581886
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['num = int(input())\nnum -= 1\nls = list(map(str, input().split(" ")))\n\nsls = sorted(ls)\n\ndiff = 0\nfor i in range(num):\n if (sls[i] != ls[i]):\n diff += 1\n\nif diff == 2 or diff == 0:\n print("YES")\nelse:\n print("NO")', 'num = int(input())\nls = list(map(int, input().split(" ")))\n\ndiff = 0\n...
['Wrong Answer', 'Accepted']
['s668643177', 's829937413']
[3188.0, 3060.0]
[17.0, 17.0]
[227, 197]
p02958
u422590714
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["import copy\n\nN = int(input())\np = [int(i) for i in input().split(' ')]\n\nhas_changed = False\nfor i in range(N):\n expect = i + 1\n #print(p)\n #print(p[i], expect)\n if p[i] != expect:\n if has_changed:\n print('NO')\n exit()\n index = p[i] - 1\n if p[index]...
['Wrong Answer', 'Accepted']
['s026978993', 's888351664']
[3444.0, 3444.0]
[23.0, 23.0]
[552, 554]
p02958
u422673384
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\npn = list(map(int, input().split()))\n\ncount = 0\nflag = True\nfor i in range(n-1):\n if pn[i] > pn[i+1]:\n for j in range(i+1, n-1):\n if pn[j] > pn[j+1]:\n tmp = pn[i]\n pn[i] = pn[j+1]\n pn[j+1] = tmp\n break\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s051266040', 's534466951', 's524029363']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[412, 463, 466]
p02958
u422994606
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['count = 0\nn = int(input())\nL = list(map(int, input().split()))\nfor i in range(n):\n if L[i] == i+1:\n continue\n else:\n count = count + 1\n\nif count == 2 or count ==0:\n print("Yes")\nelse:\n print("No")', 'count = 0\nn = int(input())\nL = list(map(int, input().split()))\nfor i in range...
['Wrong Answer', 'Accepted']
['s770321811', 's363561036']
[2940.0, 3316.0]
[18.0, 21.0]
[222, 222]
p02958
u424763114
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['def main():\n n = int(input())\n p = list(map(int, input().split()))\n\n if 2 >= n or n >= 50:\n return\n\n for i in p:\n if isinstance(i, int) == False:\n return\n\n num = 0\n\n for i in range(len(p)):\n if i+1 != p:\n num += 1\n \n if num == 2:\n ...
['Wrong Answer', 'Accepted']
['s410086731', 's977638085']
[3064.0, 3064.0]
[18.0, 17.0]
[387, 456]
p02958
u430414424
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['# -*- coding: utf-8 -*-\n\nn = int(input())\ninput_list = list(map(int, input().split()))\n\nac_list = sorted(input_list)\n\ncount = 0\nfor x in zip(input_list, ac_list):\n if x[0] != x[1]:\n count += 1\n if count > 3:\n print("No")\n break\nelse:\n print("Yes")', '# -*- coding:utf-8 -*-...
['Wrong Answer', 'Accepted']
['s158476107', 's955529989']
[3060.0, 3060.0]
[17.0, 19.0]
[277, 200]
p02958
u434282696
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = [int(_) for _ in input().split()]\nflg = False\nflg1 = True\nfor i in range(n):\n for j in range(n):\n flg1 = True\n q = p[:]\n q[i]=p[j]\n q[j]=p[i]\n for k in range(n):\n for l in range(n):\n if k < l and q[k]>q[l]:\n ...
['Wrong Answer', 'Accepted']
['s145496456', 's834356814']
[3188.0, 3064.0]
[555.0, 552.0]
[484, 484]
p02958
u434872492
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\nP = list(map(int,input().split()))\ncount = 0\nfor i in range(N):\n if P[i] != (1+i):\n count += 1\n\nif count > 2:\n print('YES')\nelse:\n print('NO')", "N = int(input())\nP = list(map(int,input().split()))\ncount = 0\nfor i in range(N):\n if P[i] != (1+i):\n count += 1\n\...
['Wrong Answer', 'Accepted']
['s506400794', 's978858663']
[3060.0, 2940.0]
[17.0, 17.0]
[175, 176]
p02958
u437351386
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import sys\nn=int(input())\np=list(map(int,input().split()))\nq=sorted(p)\nif p==q:\n print("YES")\n sys.exit()\nelse:\n print("NO")\n sys.exit()\n \n\nfor i in range(n-1):\n for j in range(i+1,n):\n s=p[i]\n p[i]=p[j]\n p[j]=s\n if p==q:\n print("Yes")\n sys.exit()\n s=p[i]\n p[i]=p...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s787495314', 's937697403', 's586296232']
[9128.0, 9196.0, 9124.0]
[25.0, 28.0, 26.0]
[355, 320, 279]
p02958
u439312138
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nX = list(map(int,input().split())\nctr = 0\n \nfor i in range(1,N):\n if X[i] != i:\n ctr += 1\n\nif ctr > 2:\n print("NO")\nelse:\n print("YES")', 'N = int(input())\nX = list(map(int,input().split()))\nctr = 0\n \nfor i in range(1,N):\n if X[i-1] != i:\n ctr += 1\n \nif ct...
['Runtime Error', 'Accepted']
['s545290492', 's117484896']
[2940.0, 2940.0]
[18.0, 18.0]
[166, 170]
p02958
u440334385
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\nP = list(map(int, input().split()))\n\ncheck = 0\nfor i, p in enumerate(P):\n if i + 1 != p[i]:\n check += 1\n\nif (check == 0 or check == 2):\n print('YES')\nelse:\n print('NO')\n ", "N = int(input())\nP = list(map(int, input().split()))\n\ncheck = 0\nfor i, p in enumerate(P):\n ...
['Runtime Error', 'Accepted']
['s402118669', 's017284185']
[2940.0, 2940.0]
[17.0, 17.0]
[206, 198]
p02958
u441575327
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np_list = list(map(int,input().split()))\np_list_sorted = sorted(p_list)\ncnt = 0\nfor i in range(N):\n if p_list[i] != p_list_sorted[i]:\n cnt += 1\n\nprint(p_list_sorted)\nprint(p_list)\nif cnt == 2 or cnt == 0:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\np_list = list(...
['Wrong Answer', 'Accepted']
['s135129913', 's228439044']
[3064.0, 3060.0]
[18.0, 17.0]
[269, 234]
p02958
u441823651
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int,input().split()))\n\nans = 0\nfor i in range(n):\n if p[i] != i+1:\n ans += 1\nif ans==0 or ans==2:\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\nP = [int(x) for x in input().split()]\n\nQ = sorted([int(x) for x in P])\n\nans = 0\nfor i in range(N):\n if ans!=3:\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s184930981', 's289066949', 's411963352', 's697466968', 's784925070', 's808788836', 's954115214', 's851233075']
[3064.0, 3060.0, 2940.0, 3060.0, 3060.0, 2940.0, 2940.0, 3060.0]
[19.0, 17.0, 18.0, 17.0, 17.0, 20.0, 17.0, 19.0]
[167, 228, 164, 298, 235, 164, 167, 308]
p02958
u442877951
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int,input().split()))\np_sort = sorted(p)\npi = 0\npj = 0\nif p == p_sort:\n print("Yes")\n exit()\nfor i in range(N//2):\n pi = p[i]\n for j in range(i+1,N):\n pj = p[j]\n p[i] = pj\n p[j] = pi\n if p == p_sort:\n print("Yes")\n exit()\n else:\n p[j] =...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s005289013', 's095381230', 's096822219', 's256351352', 's330600793']
[3064.0, 3064.0, 3060.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0, 17.0, 18.0]
[340, 331, 204, 204, 198]
p02958
u444082822
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int,input().split()))\nflag = False\nfor i in range(n):\n q = p\n for j in range(n):\n q[i], q[j] = q[j], q[i]\n if q == sorted(q):\n flag = True\n break\nif flag:\n print("YES")\nelse:\n print("NO") ', 'n = int(input())\np = list(map(int,...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s239004355', 's445436706', 's454993455', 's248092617']
[3060.0, 3064.0, 3444.0, 3060.0]
[27.0, 27.0, 41.0, 28.0]
[266, 265, 295, 279]
p02958
u444722572
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(input())\nP=list(map(int,input().split()))\ncount=0\nfor i in range(N):\n if P[i]!=i+1:\n count+=1\n\nprint("Yes" if count<=2 else "No")\n ', 'N=int(input())\nP=list(map(int,input().split()))\ncount=0\nfor i in range(N):\n if P[i]!=i+1:\n count+=1\n\nprint("Yes" if count<=2 else "...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s391169879', 's886076548', 's841102233']
[2940.0, 3316.0, 2940.0]
[18.0, 22.0, 17.0]
[158, 145, 156]
p02958
u444732068
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import numpy as np\nN = int(input())\np = list(map(int,input().split()))\np = np.array(p)\np_new = np.zeros(N)\nt = 0\nfor k in range(N-1):\n\tif p[k] > p[k+1]:\n\t\tt = 1\nif t == 0:\n\tprint("YES")\n\texit()\n\nfor i in range(N):\n\tfor j in range(i):\n\t\tfor k in range(N):\n\t\t\tp_new[k] = p[k]\n\t\tp_new[i] = p...
['Wrong Answer', 'Accepted']
['s540609618', 's581594053']
[14540.0, 3572.0]
[1844.0, 33.0]
[446, 458]
p02958
u445624660
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\narr = list(map(int, input().split()))\nreverse_arr = list(reversed(arr))\n\ncount = 0\nfor i in range(n):\n if arr[i] != reverse_arr[i]:\n count += 1\n\nif count <= 2:\n print("YES")\nelse:\n print("NO")\n', 'n = int(input())\narr = list(map(int, input().split()))\nsorted_arr = list(sorted(arr...
['Wrong Answer', 'Accepted']
['s496620029', 's078065410']
[2940.0, 2940.0]
[17.0, 17.0]
[216, 211]
p02958
u453634575
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int, input().split()))¥\n\nb = sorted(p)\ncnt = 0\nif p == b:\n print("YES")\nelse:\n for i in range(n):\n if p[i] != b[i]:\n cnt += 1\n if cnt == 3:\n print("NO")\n break \n if cnt == 1:\n print("NO")\n i...
['Runtime Error', 'Accepted']
['s097076297', 's041626381']
[2940.0, 3060.0]
[17.0, 17.0]
[335, 333]
p02958
u454093752
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int( input() )\np_list = list( map( int, input().split() ) )\nt_list = p_list[:]\np_list.sort()\nc = 0\nprint(p_list)\nfor i in range(N):\n if p_list[i] != t_list[i]:\n c += 1\nif c == 0 or c == 2:\n print("Yes")', 'N = int( input() )\np_list = list( map( int, input().split() ) )\nt_list = p_list[:]\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s418161984', 's486021672', 's576170387', 's783944334', 's188490576']
[3060.0, 3060.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[219, 227, 227, 242, 227]
p02958
u455533363
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\nbara=list(map(int,input().split()))\nnumber=list(range(1,n))\n\ncount = 0\n \nfor i in range (0,n-1):\n if bara[i] != number[i]:\n count += 1\n\nif count==2 or count==0:\n print("YES")\nelse:\n print("NO")\n\n', 'n = int(input())\nbara=list(map(int,input().split()))\n\nnumber=[1]\...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s014963842', 's050315824', 's084051816', 's179605979', 's272635595', 's698472427', 's899970801', 's170199807']
[2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[231, 217, 237, 218, 217, 234, 215, 231]
p02958
u455707769
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["\n# print(*a, sep=' ')\n\nimport math\n\nn = int, input()\n\np = list(map(int, input().split()))\n\nreverse = 0\nformer = 0\n\nfor num in p:\n if former > num:\n reverse += 1\n former = num\n if reverse > 1:\n print('NO')\n exit()\nprint('YES')\n", "\n# print(*a, sep=' ')\n\nimport math\...
['Wrong Answer', 'Accepted']
['s103052811', 's208086531']
[3060.0, 3060.0]
[17.0, 17.0]
[294, 291]
p02958
u455957070
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\ns = []\nfor i in range(n):\n s.append(i)\n\nfor i in range(n):\n t = 0\n if(s[i] != i + 1):\n t += 1\n if(t <= 2):\n print('Yes')\n else:\n print('No')", "n = int(input())\ns = []\nt = 0\nfor i in range(n):\n s.append(i)\n\nfor i in range(n):\n if(s[i] != i + 1):\n t += 1\...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s369112966', 's652692091', 's841079570', 's102169170']
[3060.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[179, 172, 129, 218]
p02958
u456107000
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["=int(input())\nP=list(map(int,input().split()))\ncount=0\nif P[0]!=1:\n count=count+1\nelif P[N-1\n ]!=N:\n count=count+1\nfor i in range(N-1):\n if P[i]+1!=P[i+1]:\n count=count+1\nif count<5:\n print('YES')\nelse:\n print('NO')", "N=int(input())\nP=list(map(int,input().split()))\ncount=0...
['Runtime Error', 'Accepted']
['s555777163', 's839828724']
[2940.0, 2940.0]
[17.0, 17.0]
[243, 165]
p02958
u456896733
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["import sys\nimport math\nINPUT = sys.stdin.readline\n\ndef SORO_INT(): return int(INPUT())\ndef MULT_INT_LIST(): return list(map(int, INPUT().split()))\ndef MULT_INT_MAP(): return map(int, INPUT().split())\ndef SORO_STRING(): return INPUT()\ndef MULT_STRING(): return INPUT().split()\n\nN = SORO_INT()\nA = MULT_INT_LI...
['Wrong Answer', 'Accepted']
['s679140566', 's520148245']
[3064.0, 3064.0]
[17.0, 17.0]
[510, 557]
p02958
u457460736
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import math\nimport collections\nimport itertools\nimport copy\n\ndef YesNo(Bool):\n if(Bool):\n print("Yes")\n else:\n print("No")\n return\n\ndef resolve():\n\n N=int(input())\n p=list(map(int,input().split()))\n ans=False\n\n tmp=copy.deepcopy(p)\n isOK=True\n for k in rang...
['Wrong Answer', 'Accepted']
['s969276231', 's942168626']
[9620.0, 9544.0]
[56.0, 59.0]
[734, 734]
p02958
u458315482
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np_i = list(map(int, input().split()))\n\nsorted_p = sorted(p_i)\ncount = 0\n\nfor i in range(N):\n if p_i[i] != sorted_p[i]:\n count += 1\n\nif count == 0 or count == 2:\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\np_i = list(map(int, input().split()))\n\nsorted_p = sor...
['Wrong Answer', 'Accepted']
['s156074420', 's109401096']
[2940.0, 3060.0]
[17.0, 19.0]
[227, 227]
p02958
u460229551
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['a=int(input())\nb=input().split(" ")\nsequence=[]\nfor i in range(0,a):\n sequence.append(int(b[i]))\nerror=[]\nfor q in range(0,a-1):\n if sequence[q]-sequence[q+1]>0:\n error.append(q)\n error.append(q+1)\n\nif len(error)<=2:\n print("YES")\nelse:\n print("NO")', 'a=int(input())\nb=input()...
['Wrong Answer', 'Accepted']
['s464967038', 's373206299']
[3064.0, 3192.0]
[18.0, 18.0]
[275, 2528]
p02958
u460386402
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n=int(input())\np=list(map(int,input().split()))\npx=sorted(p)\ncon=0\nfor i in range(n):\n if p[i]!=px[i]:\n con+=1\n \nif con==2:\n print('Yes')\nelse:\n print('No')", "n=int(input())\np=list(map(int,input().split()))\ncon=0\nfor i in range(n):\n if p[i]!=i+1:\n con+=1\n \nif con==2 or con==0:\n pr...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s145232373', 's174689515', 's632363278', 's409650473']
[3060.0, 3060.0, 3060.0, 3064.0]
[17.0, 18.0, 18.0, 17.0]
[165, 160, 175, 176]
p02958
u463838646
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\np=input().split()\nq=sorted(p)\nc=0\nfor i in range(n):\n if p[i] != q[i]:\n c+=1\nif c == 2 or c == 0:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\np=list(map(int,input().split()))\nc=0\nfor i in range(n):\n if p[i] != sorted(p)[i]:\n c+=1\nprint("YES" if c == 2 or...
['Wrong Answer', 'Accepted']
['s505907434', 's931179252']
[2940.0, 3060.0]
[17.0, 17.0]
[161, 155]
p02958
u465101448
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N=int(read_input())\nP=[int(x) for x in read_input().split()]\n\nN_J=list(range(1,N+1))\nans='NO'\nfor i in range(N):\n for j in range(N):\n P_temp=P.copy()\n p_i=P[i]\n p_j=P[j]\n\n P_temp[i]=p_j\n P_temp[j]=p_i\n \n if P_temp==N_J:\n ans='YES'\n ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s118874475', 's128696966', 's698501494', 's853121338']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 19.0, 19.0, 19.0]
[317, 289, 581, 296]
p02958
u469953228
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['#include <bits/stdc++.h>\nusing namespace std;\nint main()\n{\n int N;\n cin >> N;\n int count= 0;\n \n vector<int> p(N);\n for (int i=1 ;i < N ;i++) {\n cin >> p[i];\n if (p[i-1]+1 != p[i+1]) {\n count++;\n }\n }\n \n if (count == 0 || count ==2){\n cout << "YES" << endl;\n }\n else c...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s192570795', 's456523490', 's642391928', 's301384068']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 19.0, 17.0]
[322, 320, 173, 182]
p02958
u470189643
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(input())\nps=list(int(i) for i in input().split()) \n\npf=ps[0]\nflag=0\nfor i in ps[1:]:\n if pf>i:\n flag+=1\n if flag>=2:\n print("NO")\n break\n pf=i\nif flag<2:\n print("YES")', 'def bubble_sort(arr):\n change = True\n flag=0\n while change:\n chan...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s363537666', 's772040147', 's436125068']
[3060.0, 3064.0, 12508.0]
[17.0, 17.0, 148.0]
[216, 425, 180]
p02958
u471212175
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int,input().split(" ")))\ncounter = 0\nfor i in range(N):\n if p[i] != i+1 and counter <= 1:\n counter += 1\n elif p[i] != i+1 and counter > 1:\n break;\nif counter < 2:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\np = list(map(int,input().split(" "...
['Wrong Answer', 'Accepted']
['s554313944', 's023784136']
[3060.0, 3060.0]
[20.0, 17.0]
[251, 291]
p02958
u471684875
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n=int(input())\np=list(map(int,input().split()))\nq=[]\nfor i in range(1,n+1):\n q.append(i)\n\nprint(p,q)\n\na=0\nfor i in range(n):\n if p[i]==q[i]:\n a+=1\n else:\n a+=0\n\nif a==n or a==n-2:\n print('Yes')\nelse:\n print('No')", "n=int(input())\np=list(map(int,input().split()))\nq=[]\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s221201360', 's979190313', 's056640434']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[241, 229, 229]
p02958
u471828790
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["import sys\ninput = sys.stdin.readline\ninput()\nP = list(map(int, input().split()))\n\nPs = list(sorted(P))\n\nc = 0\nfor i in range(len(P)):\n if P[i] != Ps[i]:\n c += 1\n\nprint('Yes' if c <= 2 else 'No')\n", "import sys\ninput = sys.stdin.readline\ninput()\nP = list(map(int, input().split()))\n\nPs = li...
['Wrong Answer', 'Accepted']
['s302155911', 's622995659']
[3064.0, 3060.0]
[23.0, 18.0]
[206, 205]
p02958
u475675023
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n,*p=map(int,open(0).read().split())\nq=sorted(p)\nfor i in range(n):\n for j in range(n):\n r=p[:]\n r[i],r[j]=r[j],r[i]\n print(r)\n if r==q:\n print('YES')\n exit()\nprint('NO')", "n,*p=map(int,open(0).read().split())\nq=sorted(p)\nfor i in range(n-1):\n r=p[:]\n r[i],r[i+1]=r[i+1],r[i...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s133616627', 's137525956', 's163602684']
[3444.0, 3060.0, 3060.0]
[31.0, 17.0, 19.0]
[193, 169, 180]
p02958
u481514236
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\n\nlst = input().split()\ncnt = 0\n\nfor i in range(N):\n if lst[i] != i+1:\n cnt += 1\n\nif cnt <= 2:\n print('YES')\nelse:\n print('NO')\n\n", "N = int(input())\n\nlst = input().split()\nprint(lst) #debug\n\nlst2 = sorted(lst)\nprint(lst2) #debug\n\ncnt = 0\nfor i in range(N):\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s402781620', 's682779745', 's338512172']
[2940.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0]
[161, 224, 265]
p02958
u482157295
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nP = input().split()\nflag = "OK"\ncount = 0\nfor i in range(N):\n if i+1 != int(P[i]) :\n count = count + 1\nif count >= 2:\n print("NO")\nelse:\n print("YES")', 'N = int(input())\nP = input().split()\nflag = "OK"\ncount = 0\nfor i in range(N):\n if i+1 != int(P[i]) :\n count = count + 1\n...
['Wrong Answer', 'Accepted']
['s239581367', 's379857862']
[2940.0, 3060.0]
[17.0, 17.0]
[173, 173]
p02958
u486251525
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int, input().split()))\n\ncheck = []\n\nfor x in range(N):\n check.append(x + 1)\n\ncount = 0\nfor y in range(N):\n if check[y] != p[y]:\n count += 1\n\nif count <= 2:\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\np = list(map(int, input().split()))\n\nch...
['Wrong Answer', 'Accepted']
['s624291622', 's087782475']
[3060.0, 3060.0]
[17.0, 17.0]
[238, 238]
p02958
u488127128
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["# coding: utf-8\n# Your code here!\n\nN = int(input())\nps = list(map(int, input().split()))\n\ncount = 0\n\nfor p,n in zip(ps,range(N)):\n if p != n:\n count += 1\nif count == 2:\n print('YES')\nelse:\n print('NO')", "N = int(input())\nps = list(map(int, input().split()))\n\ncount = 0\n\nfor p,n in z...
['Wrong Answer', 'Accepted']
['s778836180', 's248928334']
[2940.0, 3060.0]
[17.0, 17.0]
[217, 200]
p02958
u489124637
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nA = list(map(int, input().split()))\ncount = 0\n\nfor i in range(N):\n if A[i] != i+1:\n count = count +1\n\nif count > 2:\n print("NO")\n\nif count <= 2:\n print("Yes")', 'N = int(input())\nA = list(map(int, input().split()))\ncount = 0\n\nfor i in range(N):\n if A[i] != i+1:\n ...
['Wrong Answer', 'Accepted']
['s504378428', 's240719696']
[2940.0, 3316.0]
[17.0, 19.0]
[191, 195]
p02958
u490489966
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["#B\nimport sys\nn = int(input())\np = list(map(int, input().split()))\ncount=0\nfor i in range(n):\n if p[i] != i+1:\n if count == 2:\n print('No')\n sys.exit()\n else:\n count += 1\nprint('Yes')", "#B\nimport sys\nn = int(input())\np = list(map(int, input().split()))...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s058696818', 's196712493', 's638817975']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[233, 233, 185]
p02958
u491462774
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(map(int, input().split()))\nflg_cnt = 0\nfor i in range(n):\n if i+1 != p[i]:\n flg_cnt += 1\n if flg_cnt > 2:\n print('No')\n exit()\nprint('Yes')", "n = int(input())\np = list(map(int, input().split()))\nflg_cnt = 0\nfor i in range(n):\n if i+1 != p[i]:\n ...
['Wrong Answer', 'Accepted']
['s776221331', 's279260618']
[9176.0, 9056.0]
[29.0, 31.0]
[192, 192]
p02958
u492749916
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import sys\n\nN = int(input())\nA = [int(N) for N in input().split()]\nswp = 0\n\nif A == sorted(A):\n print("Yes")\n sys.exit()\n\nfor i in range (0,N-1):\n if A[i]>A[i+1]:\n swp = A[i]\n A[i] = A[swp-1]\n A[swp-1] = swp\n if A == sorted(A):\n print("Yes")\n sys.exit()\nprint ("No")', 'N = int(inpu...
['Wrong Answer', 'Accepted']
['s402865108', 's888341500']
[3064.0, 9124.0]
[18.0, 28.0]
[284, 173]
p02958
u493407368
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["a = int(input())\nb = list(map(int, input().split()))\n\nsorted_b = [i+1 for i in range(a)]\n\ndiff = [x-y for (x,y) in zip(sorted_b, b)]\n\nif len([i for i in diff if i == 0]) == 2:\n print('YES')\nelse:\n print('NO')", "a, b = map(int, input().split())\n\nsorted_b = [i+1 for i in range(a)]\n\ndiff = [x-y for (x,y...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s574561189', 's614160465', 's042399017']
[3060.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[210, 190, 210]
p02958
u493491792
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np=list(map(int,input().split()))\nz=0\nfor i in range(n):\n if p[i]!=i+1:\n z+=1\nif z>2:print(NO)\nelse:\n print(YES)\n', 'n = int(input())\np=list(map(int,input().split()))\nz=0\nfor i in range(n):\n if p[i]!=i+1:\n z+=1\nif z>2:print("NO")\nelse:\n print("YES")\n\n']
['Runtime Error', 'Accepted']
['s042456546', 's921306691']
[2940.0, 2940.0]
[17.0, 17.0]
[142, 147]
p02958
u497952650
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['def main():\n N = int(input())\n p = list(map(int,input().split()))\n count = 0\n for i in range(N-1):\n if p[i]>p[i+1]:\n count += 1\n \n if count >= 2:\n print("NO")\n else:\n print("YES")\n\n\nif __name__=="__main__":\n main()', 'def main():\n N = int(inpu...
['Wrong Answer', 'Accepted']
['s799896322', 's150555823']
[3060.0, 3060.0]
[17.0, 17.0]
[270, 268]
p02958
u498620941
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = [int(i) for i in input().split()]\na = 0\nfor i in range(N):\n if p[i] == (i+1):\n continue\n else :\n a += 1\nif a <= 2 :\n print("Yes")\nelse:\n print("No")', 'N = int(input())\np = [int(i) for i in input().split()]\na = 0\nfor i in range(N):\n if p[i] == (i+1):\n ...
['Wrong Answer', 'Accepted']
['s039549013', 's574382433']
[2940.0, 3060.0]
[17.0, 19.0]
[195, 195]
p02958
u499381410
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n, *a = map(int, input().split())\ncnt = 0\nfor i in range(n):\n if sorted(a)[i] != a[i]:\n cnt +=1\n\n\nif cnt <= 2:\n print('YES')\nelse:\n print('NO')", "n, *a = map(int, input().split())\nli = []\nsorted_a = sorted(a)\nfor i in range(n):\n if sorted_a[i] != a[i]:\n cnt +=1\n li.ap...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s360233614', 's381441788', 's383703886', 's453429231', 's504486962', 's305025616']
[2940.0, 3064.0, 5604.0, 3064.0, 3064.0, 4844.0]
[17.0, 18.0, 53.0, 17.0, 17.0, 41.0]
[159, 470, 968, 398, 488, 997]
p02958
u502731482
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['\nn = int(input())\ndata = list(map(int, input().split()))\ncnt = 0\nfor i in range(n):\n if(data[i] != i + 1):\n cnt += 1\n\n\nprint("Yes" if cnt <= 2 else "No")', '\nn = int(input())\ndata = list(map(int, input().split()))\ncnt = 0\nfor i in range(n):\n if(data[i] != i + 1):\n cnt += 1\n\n\nprin...
['Wrong Answer', 'Accepted']
['s781014531', 's564857513']
[2940.0, 3064.0]
[17.0, 17.0]
[163, 163]
p02958
u502967152
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\np=list(map(int,input().split()))\ns=[1+i for i in range(n)]\nS=[]\nfor i in range(n):\n for j in range(i+1,n):\n a=s\n a[i]=s[j]\n a[j]=s[i]\n S.append(s)\nif p in S:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\np=list(map(int, input().split()))\np_sort=sorted(p)\ncount=0\nfor...
['Wrong Answer', 'Accepted']
['s323326440', 's188604958']
[3064.0, 3060.0]
[18.0, 17.0]
[220, 208]
p02958
u505893372
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\np = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(N-1):\n\tif p[i] == i :\n\t\tans += 1\n\nif ans == N or ans == N-2:\n\tprint('Yes')\nelse :\n\tprint('No')", "N = int(input())\np = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(N):\n\tif p[N] == (N+1) :\n\t\tans += 1\n\ni...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s077648940', 's412435872', 's494190393', 's580813443', 's614021549', 's668653731', 's764107801', 's834481814', 's863863191', 's916029172', 's981061481']
[2940.0, 2940.0, 3060.0, 2940.0, 3060.0, 3064.0, 3064.0, 2940.0, 2940.0, 2940.0, 3060.0]
[19.0, 18.0, 17.0, 17.0, 17.0, 18.0, 19.0, 17.0, 17.0, 17.0, 17.0]
[171, 167, 205, 165, 193, 195, 195, 163, 206, 174, 211]
p02958
u508273185
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int,input().split()))\ncount=0\n#print(p)\np_sorted = sorted(p)\nprint(p_sorted)\n\nfor i in range(n):\n #print(i)\n if p[i]!=p_sorted[i]:\n count+=1\n #print(count)\n\nif count==0 or count==2:\n print("YES")\nelse :\n print("NO")', 'n = int(input())\np = list(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s828766985', 's946594221', 's773974894']
[3060.0, 3064.0, 3060.0]
[18.0, 17.0, 17.0]
[271, 259, 272]
p02958
u513081876
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\np = [int(i) for i in input().split()]\ncheck = 0\npp = sorted(p)\nfor i in range(N):\n if p[i] != p[i + 1]:\n check += 1\n\nif check == 2:\n print('YES')\nelse:\n print('NO')", "N = int(input())\np = [int(i) for i in input().split()]\ncheck = 0\npp = sorted(p)\nfor i in range(N):\n ...
['Runtime Error', 'Accepted']
['s070244890', 's300111093']
[3060.0, 3060.0]
[18.0, 17.0]
[197, 208]
p02958
u514118270
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(input().split())\nq = sorted(p)\nfor i in range(n):\n if p[i] != q[i]:\n ans += 1\nif ans <= 2:\n print('YES')\nelse:\n print('NO')", "n = int(input())\np = list(map(int,input().split()))\nq = sorted(p)\nans = 0\nfor i in range(n):\n if p[i] != q[i]:\n ans += 1\nif ans == 2:\n pr...
['Runtime Error', 'Accepted']
['s098310435', 's304551096']
[2940.0, 3060.0]
[18.0, 17.0]
[155, 203]
p02958
u514136877
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int,input().split()))\ncount = 0\nsorted_p = sorted(p)\n\nfor i in range(n):\n if i+1 != p[i]:\n count += 1\n k = p.index(i+1)\n k = p.pop(k)\n p.insert(i,k)\n if count == 1:\n break\n\nif sorted_p == p:\n print("YES")\nelse:\n prin...
['Wrong Answer', 'Accepted']
['s736267063', 's379184506']
[3060.0, 3060.0]
[19.0, 17.0]
[309, 188]
p02958
u514383727
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int, input().split()))\nn = [i+1 in range(N)]\nc = 0\nfor i in range(N):\n if n[i] != p[i]:\n c += 1\nif c == 0 or c == 2:\n print("YES")\nelse:\n print("NO")\n\t', 'N = int(input())\np = list(map(int, input().split()))\nn = [i+1 for i in range(N)]\nc = 0\nfor i in range(N):\n ...
['Runtime Error', 'Accepted']
['s500020366', 's113123467']
[2940.0, 2940.0]
[17.0, 17.0]
[187, 202]
p02958
u516554284
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\na=list(map(int,input().split()))\nb=0\nfor i in range(n):\n if a[i]==i+1:\n b+=0\n else:\n b+=1\nif b==0 or b==2:\n print("Yes")\nelse:\n print("No")\n\n', 'n=int(input())\na=list(map(int,input().split()))\nb=0\nfor i in range(n):\n if a[i]==i:\n b+=0\n else:\n b+=1\nif b==0 or 2:\n ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s029903973', 's850069926', 's906132448', 's911308392', 's777006539']
[3064.0, 2940.0, 2940.0, 2940.0, 2940.0]
[20.0, 17.0, 17.0, 18.0, 17.0]
[166, 162, 157, 164, 166]
p02958
u519832983
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nP = list(map(int,input().split()))\nA = []\nfor n in range(N):\n A.append(n+1)\n\ncount = 0\nfor n in range(N):\n if A[n] != P[n]:\n count += 1\nif count == 0 or count == 2:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nP = list(map(int,input().split()))\nA = []\nfor n in range(N):...
['Wrong Answer', 'Accepted']
['s039479810', 's638146931']
[3060.0, 3060.0]
[20.0, 17.0]
[221, 221]
p02958
u522937309
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['a = int(input())\nlist_a=list(map(int, input().split())) \ncount = 0\nfor i in range(len(list_a)):\n print(list_a[i],len(list_a)-i)\n if list_a[i] != i+1:\n count += 1\n \nif count == 2 or count == 0:\n print("YES")\nelse :\n print("NO")', 'a = int(input())\nlist_a=list(map(int, input().split()...
['Wrong Answer', 'Accepted']
['s432062434', 's718062333']
[3060.0, 3060.0]
[17.0, 17.0]
[265, 267]
p02958
u524870111
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['\n\nimport sys\nstdin = sys.stdin\n\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(ns())\ndef na(): return list(map(int, stdin.readline().split()))\n\ndef main():\n n = ni()\n p = na()\n for i in range(n-1):\n for j in range(i, n):\n q = p.copy()\n q[i] = p[j];...
['Wrong Answer', 'Accepted']
['s895557344', 's595821508']
[9216.0, 9156.0]
[27.0, 26.0]
[651, 651]
p02958
u527261492
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\ntotl=0\nfor i in range(n-1):\n if a[i]+a[i+1]<b[i]:\n totl+=a[i]+a[i+1]\n a[i]=0\n a[i+1]=0\n else:\n totl+=b[i]\n if a[i]<b[i]:\n a[i]=0\n a[i+1]-=b[i]-a[i]\n else:\n a[i]-=b[i]\n \n\nprint(totl)...
['Runtime Error', 'Runtime Error', 'Accepted']
['s923902676', 's964714457', 's285599027']
[3064.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[304, 161, 153]
p02958
u529106146
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\nP = list(map(int, input().split()))\nla = list(range(1,N+1))\ncnt1 = 0\ncnt2 = 0\nwhile cnt1 < N-1:\n if P[cnt1] == la[cnt1]:\n cnt2 += 1\n cnt1 += 1\nif cnt2 >= N-2:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nP = list(map(int, input().split()))\nla = list(range(1,N+...
['Wrong Answer', 'Accepted']
['s721961519', 's944267906']
[3060.0, 3060.0]
[17.0, 17.0]
[227, 228]
p02958
u531220228
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int, input().split()))\n\np_sorted = sorted(p)\n\nis_changed = [0 if x==y else 1 for x,y in zip(p, p_sorted)]\n\nif sum(is_changed) == 2:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\np = list(map(int, input().split()))\n\np_sorted = sorted(p)\n\nis_changed = [0 if x==y...
['Wrong Answer', 'Accepted']
['s439454954', 's875363829']
[3060.0, 3060.0]
[17.0, 17.0]
[200, 200]
p02958
u534282583
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import copy\n\nN = int(input())\na = input().split()\nans = "NO"\nb = copy.deepcopy(a)\nif b == sorted(a):\n ans = "YES"\nelse:\n for i in range(0, N):\n if ans =="YES":\n break\n for j in range(i, N-1):\n b = copy.deepcopy(a)\n temp = b[i]\n b[i] = b[j]...
['Wrong Answer', 'Accepted']
['s316979063', 's340368913']
[3444.0, 3444.0]
[76.0, 73.0]
[448, 435]
p02958
u534302832
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["#!/usr/bin/env python\n\nN = input()\n\nn = int(N)\n\nlist1 = list(range(n))\n\nfor i in range(n) :\n\tlist1[i] = list1[i] + 1\n\n#print(list1)\n\nlist2 = []\n\nfor i in range(n) :\n\tlist2.append(input())\n\nlist2 = [int(n) for n in list2]\n\n#print(list2)\n\njudge = 0\n\nfor i in range(n) : \n\tif list1[i] != list2...
['Runtime Error', 'Accepted']
['s852849104', 's054589350']
[3060.0, 3060.0]
[17.0, 18.0]
[373, 356]
p02958
u538956308
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\nP = list(map(int,input().split()))\nQ = list(range(1,N+1))\nJ = [x - y for (x, y) in zip(P, Q)]\nR = [i for i in J if i != 0]\nprint(R)\nif len(R)<=2:\n print('YES')\nelse:\n print('NO')\n", "N = int(input())\nP = list(map(int,input().split()))\nQ = list(range(1,N+1))\nJ = [x - y for (x, y) in zip...
['Wrong Answer', 'Accepted']
['s406514027', 's537424500']
[3064.0, 3060.0]
[17.0, 17.0]
[198, 188]
p02958
u539367121
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n=int(input())\nc=list(range(1,n+1))\np=list(map(int,input().split()))\ncnt=0\n\nfor i in range(n):\n cnt += 1 if c[i]!=p[i] else 0\n \nprint('Yes' if cnt==2 or cnt==0 else 'No') ", "n=int(input())\nc=list(range(1,n+1))\np=list(map(int,input().split()))\ncnt=0\n\nfor i in range(n):\n cnt += 1 if c[i]!=p[i] els...
['Wrong Answer', 'Accepted']
['s001825719', 's937519244']
[9184.0, 9176.0]
[30.0, 29.0]
[177, 172]
p02958
u539692012
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(map(int, input().split()))\nq = sorted(p)\ns = sum(pi != qi for pi, qi in zip(p, q))\nif s == 0 or s == 2:\n print('Yes')\nelse:\n print('No')\n", "n = int(input())\np = list(map(int, input().split()))\nq = sorted(p)\ns = sum(pi != qi for pi, qi in zip(p, q))\nif s == 0 or s == 2:\n ...
['Wrong Answer', 'Accepted']
['s503473556', 's460891835']
[2940.0, 2940.0]
[17.0, 17.0]
[169, 169]
p02958
u540290227
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(map(int, input().split()))\nerror = 0\nfor i in range(n):\n if p[i] != i+1:\n error += 1\nif error == 2 or error == 0:\n print('Yes')\nelse:\n print('No')", "n = int(input())\np = list(map(int, input().split()))\nerror = 0\nfor i in range(n):\n if p[i] != i+1:\n er...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s039128118', 's161771288', 's200525299', 's874316468', 's370155915']
[8992.0, 9092.0, 9120.0, 8928.0, 9172.0]
[27.0, 29.0, 28.0, 27.0, 27.0]
[188, 173, 187, 145, 187]
p02958
u541475502
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\nN = list(map(int, input().split()))\ncnt = 0\nfor i in range(1, len(N)):\n tmp = N[i] \n if tmp < N[i-1]:\n j = i\n while True:\n N[j] = N[j-1]\n j -= 1\n if j == 0 or tmp >= N[j-1]:\n break\n N[j] = tmp\n if j != i:\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s763383309', 's897391210', 's713120845']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[390, 164, 361]
p02958
u544212192
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n=int(input())\np=input().split()\n\nl=list(range(1,n+1))\ncnt=0\n\nfor i in range(n):\n if l[i]!=int(p[i]):\n cnt+=1\nprint(cnt)\nif cnt<=2:\n print('Yes')\nelse:\n print('No')\n", "n=int(input())\np=input().split()\n\nl=list(range(n,0,-1))\ncnt=0\n\nfor i in range(n):\n if l[i]!=int(p[i]):\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s377884298', 's477597698', 's633576420', 's923465095']
[3060.0, 3060.0, 3060.0, 2940.0]
[21.0, 17.0, 17.0, 18.0]
[181, 182, 181, 170]
p02958
u546686251
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int, input().split()))\nfor i in range(N):\n for j in range(i + 1, N):\n if p[j - 1] < p[i] < p[j + 1] and p[i - 1] < p[j] < p[i + 1]:\n print("YES")\n else:\n continue\nprint("NO")\n', 'N = int(input())\np = list(map(int, input().split()))\nfor i ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s362007450', 's420739200', 's761577453', 's235933385']
[2940.0, 3188.0, 3060.0, 2940.0]
[17.0, 18.0, 18.0, 17.0]
[244, 235, 263, 191]
p02958
u546853743
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["\nn=int(input())\np=list(map(int,input().split()))\nnew_p=p.sort()\n\nfor i in range(n-1):\n if p[i]<=p[i+1]:\n tmp=p[i]\n p[i]=p[i+1]\n p[i+1]=tmp\n break\nif new_p==p:\n print('YES')\nelse:\n print('NO')", "n=int(input())\np=list(map(int,input().split()))\nnew_p=p.reverse()\n\nf...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s056742531', 's115598892', 's288186169', 's366569162', 's410514235', 's457472250', 's574200713']
[9060.0, 9020.0, 9148.0, 9096.0, 9104.0, 9060.0, 9092.0]
[28.0, 25.0, 24.0, 24.0, 26.0, 25.0, 29.0]
[228, 230, 195, 191, 227, 234, 191]
p02958
u548684908
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = input()\nli = list(map(int,input().split()))\nfalse = 0\nfor i in range(n):\n if i != li[i]:\n false += 1\nif false == 0 or false == 2:\n print('YES')\nelse:\n print('N0')", "n = input()\nli = list(map(int,input().split()))\nfalse = 0\nfor i in range(n):\n if i != li[i]:\n false += 1\nif...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s825206252', 's936041126', 's966708285', 's992454119']
[2940.0, 2940.0, 3064.0, 2940.0]
[17.0, 18.0, 17.0, 17.0]
[182, 182, 187, 191]
p02958
u549497563
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int,input().split()))\nl = sorted(p)\ncnt = 0\nfor i in p:\n for j in l:\n if i!=j:\n cnt += 1\nif cnt>2 or cnt==1:\n print("NO")\nelse:\n print("YES")', 'n = int(input())\np = list(map(int,input().split()))\nl = sorted(p)\ncnt = 0\nfor i in range(n):\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s439742190', 's859654826', 's799531922']
[3064.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[198, 206, 195]
p02958
u553070631
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["x = int(input())\nli = list(map(int,input().split()))\n#print (x)\n#print (li[2])\n\n\na = 0\nfor i in range(x-1):\n\t\n\tb = 0\n\t#print (li[i])\n \n\tif int(li[i]) < int(li[i+1]):\n\t\tb=b+1\n\telif int(li[i]) > int(li[i+1]):\n\t\ta=a+1\n\telse:\n\t\tb=b+1\n\t#print(a)\n\t\n \n#print(a)\n\nif a < 2:\n\tprint(...
['Wrong Answer', 'Accepted']
['s401794176', 's966464704']
[3064.0, 3060.0]
[17.0, 17.0]
[323, 288]
p02958
u556225812
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\nlst = list(map(int, input().split()))\ncnt = 0\nfor i in lst:\n if lst[i]-1 != i:\n cnt += 1\nif cnt > 2:\n print('NO')\nelse:\n print('YES')", "N = int(input())\nlst = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n if lst[i]-1 != i:\n cnt += 1\nif cnt > 2:\...
['Runtime Error', 'Accepted']
['s343114432', 's323535849']
[2940.0, 2940.0]
[18.0, 19.0]
[166, 171]
p02958
u557282438
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int,input().split()))\ncnt = 0\nfor i in range(N):\n if(p[i]!=i+1):\n cnt += 1\nif(cnt <= 2):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\np = list(map(int,input().split()))\ncnt = 0\nfor i in range(N):\n if(p[i]!=i+1):\n cnt += 1\nif(cnt <= 2):\n ...
['Wrong Answer', 'Accepted']
['s888273198', 's607516510']
[3060.0, 3060.0]
[17.0, 17.0]
[167, 167]
p02958
u561231954
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n=int(input())\narray=[int(i) for i in input().split()]\n\nmistake=[]\nfor i in range(n):\n if array[i]!=i+1:\n mistake.append([i+1,array[i]])\n\nans='Yes'\nk=len(mistake)\nif k>2:\n ans='No'\nelif k==2:\n if mistake[0][0]!=mistake[1][1]:\n ans='No'\n\nprint(ans)\n ", "n=int(input())\narray=[int(i) for i ...
['Wrong Answer', 'Accepted']
['s183157445', 's195365721']
[3060.0, 3060.0]
[18.0, 17.0]
[261, 261]
p02958
u561883765
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\na = list(map(int,input().split()))\n\ncount = 0\nfor i in range(n):\n if a[i] != i+1:\n rem = a[i]\n if rem == a[i]:\n count += 1\nif count <= 2:\n print("Yes")\nelse:\n print("No")\n', 'n = int(input())\na = list(map(int,input().split()))\n\ncount = 0\nfor i in range(n):\n if a[i] !=...
['Wrong Answer', 'Accepted']
['s669994757', 's953914150']
[3060.0, 2940.0]
[17.0, 17.0]
[202, 202]
p02958
u562550538
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nlist = list(map(int, input().split()))\ncount = 0\n\nfor a in range(1, N):\n if list[a-1] > list[a]:\n count += 1\n\n\nif count == 1 or count == 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nlist = list(map(int, input().split()))\nlist_sort = sorted(list)\ncount = 0\n\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s110466790', 's303178407', 's985328475', 's288966055']
[3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[205, 230, 205, 231]
p02958
u564770050
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(map(int,input().split()))\n\npa = sorted(p)\ncnt = 0\nfor i in range(n):\n if p[i] != pa[i]:\n cnt += 1\n\nif cnt <= 2:\n print('Yes')\nelse:\n print('No')\n", "n = int(input())\np = list(map(int,input().split()))\n\npa = sorted(p)\ncnt = 0\nfor i in range(n):\n if p[i] !...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s050368932', 's435500457', 's690324839', 's849304997']
[2940.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 18.0, 17.0]
[187, 186, 195, 186]
p02958
u565868811
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["a=int(input())\nb=list(map(int,input().split()))\ncount=0\nfor i,j in enumerte(a,1):\n if i != j:\n count +=1\n\nif count <= 2:\n print('YES')\nelse:\n print('NO')\n ", "a=int(input())\nb=list(map(int,input().split()))\ncount=0\nfor i,j in enumerate(b,1):\n if i != j:\n count +=1\n\nif count <= 2:\n ...
['Runtime Error', 'Accepted']
['s861279480', 's018644920']
[2940.0, 2940.0]
[17.0, 17.0]
[166, 164]
p02958
u565924121
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int,input().split()))\n\no=1\ne=0\nfor i in p:\n if i != o:\n e +=1\n o +=1\nif e=0 or e=2:\n print("YES")\nelse:\n print("NO")\n', 'N = int(input())\np = list(map(int,input().split()))\n\no=1\ne=0\nfor i in range(N):\n if i != o:\n o +=1\n e +=1\n\nif e=0 or e=2:\n prin...
['Runtime Error', 'Runtime Error', 'Accepted']
['s448475143', 's966918758', 's803638425']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[154, 161, 158]
p02958
u566297428
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\nS = list(map(int, input().split())\n\nMax_S = max(S)\nMax_idx = S.index(Max_S)\nMin_S = min(S)\nMin_idx = S.index(Max_S)\nSort_S = sorted(S)\n\nS[Max_idx], S[Min_idx] = S[Min_idx], S[Max_idx]\nif S == Sort_S:\n print('YES')\nelse:\n print('NO')\n", "N = int(input())\nS = list(map(int, input()....
['Runtime Error', 'Runtime Error', 'Accepted']
['s384526554', 's536884367', 's421174377']
[8848.0, 9124.0, 9116.0]
[25.0, 20.0, 30.0]
[256, 185, 176]
p02958
u566428756
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N=int(input())\nP=list(map(int,input().split()))\ncnt=0\nfor n in range(N):\n if P[n]!=n+1:\n cnt+=1\nif cnt<=2:\n print('Yes')\nelse:\n print('No')", "N=int(input())\nP=list(map(int,input().split()))\ncnt=0\nfor n in range(N):\n if P[n]!=n+1:\n cnt+=1\nif cnt<=2:\n print('YES')\nelse:\n ...
['Wrong Answer', 'Accepted']
['s888726325', 's491423567']
[3060.0, 2940.0]
[17.0, 17.0]
[155, 155]
p02958
u571445182
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["nN = int(input())\n\nTmp = []\nTmp = input().rstrip().split(' ')\n\nnData = [0 for i in range(nN)]\n\nfor i in range(nN):\n nData[i] = int(Tmp[i])\n\nnFlag = 0\nnCnt = 0\n\nfor i in range(nN-1):\n nTmp = i + 1\n if nData[i] != nTmp:\n nCnt += 1\n nTmp2 = nData[i] - 1\n nTmp3 = nData[nTmp]\n if nTmp3 !=...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s020385201', 's044730506', 's805090444', 's815574583', 's242770914']
[3064.0, 3060.0, 3060.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[410, 279, 287, 409, 416]