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
u046826851
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( )))\ncnt = 0\nfor i in range(n):\n if A[i] == i+1:\n cnt = (cnt + 1)%2\nif cnt == 0:\n print('YES')\nelse:\n print('NO')", "n = int(input())\nA = list(map(int, input().split( )))\ncnt = 0\nfor i in range(n):\n if A[i] != i+1:\n cnt += 1\nif cnt <= 2:\n pr...
['Wrong Answer', 'Accepted']
['s679462219', 's179674210']
[9180.0, 9068.0]
[27.0, 26.0]
[169, 160]
p02958
u049182844
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_l = list(range(1,n + 1))\ncount = 0\nfor n_num , p_num in zip(n_l,p):\n if n_num != p_num:\n count += 1\nif count == 2 or count == 0:\n print('Yes')\nelse:\n print('No')", "n = int(input())\np = list(map(int,input().split()))\nn_l = list(range(1,n + 1))\nc...
['Wrong Answer', 'Accepted']
['s497345591', 's019959790']
[9168.0, 9084.0]
[27.0, 28.0]
[221, 221]
p02958
u054931633
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(map(int,input().split()))\na=0\nfor i in range(n):\n if l[i]!=i+1:\n a+=1\nif a==0 or a==2:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\nl=list(map(int,input().split()))\na=0\nfor i in range(n):\n if l[i]!=i+1:\n a+=1\nif a==0 or a==2:\n print("YES")\nelse:\n print("NO")']
['Wrong Answer', 'Accepted']
['s009449796', 's900186358']
[9076.0, 9140.0]
[30.0, 28.0]
[147, 147]
p02958
u057415180
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())\ncnt = 0\nfor k in range(1,n+1):\n if k >= 1 and k <= 9:\n cnt += 1\n elif k >= 100 and k <= 999:\n cnt += 1\n elif k >= 10000 and k <= 99999:\n cnt += 1\nprint(cnt)', "n = int(input())\np = list(map(int, input().split()))\ncnt = 0\nfor i in range(n):\n if p[i] != i +...
['Wrong Answer', 'Accepted']
['s744716459', 's221694625']
[2940.0, 2940.0]
[17.0, 17.0]
[203, 169]
p02958
u060569392
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=P.copy()\n\nb.sort()\ncount=0\n\nfor i in range(N):\n if P[i] != b[i]:\n count+=1\n \nif count >=2:\n print('NO')\nelse:\n print('YES')", "N = int(input())\nP = list(map(int, input().split()))\n\nb=P.copy()\n\nb.sort()\ncount=0\n\nfor i in range(N):\...
['Wrong Answer', 'Accepted']
['s879624315', 's135119206']
[3060.0, 3060.0]
[17.0, 18.0]
[188, 189]
p02958
u063703408
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))\nif p == q:\n print("Yes")\n exit(0)\ncnt = 0\nfor i in range(n):\n if p[i] != q[i]:\n cnt += 1\n t = i if cnt == 1 else 0\n if (cnt == 2 and p[t] != q[i]) or cnt > 2:\n print("No")\n exit(0)\nprint("Yes")...
['Wrong Answer', 'Accepted']
['s987377570', 's653491995']
[3064.0, 3064.0]
[17.0, 18.0]
[304, 385]
p02958
u067471258
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\nN = int(input())\np = list(map(int, input().split()))\npcopy = copy.deepcopy(p)\nans = sorted(p)\n\nis_ascend = False\nif p == ans:\n is_ascend = True\n\nfor i in range(N):\n for j in range(i+1,N):\n p = copy.copy(pcopy)\n p[i], p[j] = p[j], p[i]\n if p == ans:\n is_...
['Wrong Answer', 'Accepted']
['s765525491', 's846458367']
[9276.0, 9220.0]
[32.0, 30.0]
[370, 371]
p02958
u067983636
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...
['input()\nA = list(map(int, input().split()))\nN = sorted(A)\n\nres = 0\nfor a, n in zip(A, N):\n if a != n:\n res += 1\nprint("YES") if res <= 1 else print("NO")\n\n\n', 'input()\nA = list(map(int, input().split()))\nN = [n + 1 for n in range(len(A))]\n\nres = 0\nfor a, n in zip(A, N):\n if a != n:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s357714789', 's491711927', 's695291473']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[166, 187, 166]
p02958
u067986264
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 = [i for i in range(1, n+1)]\ncount = 0\nfor i in s:\n if p.index(i):\n count += 1\nif count > 2:\n print("NO")\nelse:\n print("YES")\n', 'n = int(input())\np = list(map(int, input().split()))\ns = [i for i in range(1, n+1)]\ncount = 0\nfor i in...
['Wrong Answer', 'Accepted']
['s518113546', 's231537713']
[2940.0, 2940.0]
[18.0, 17.0]
[197, 211]
p02958
u068142202
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=0\np_2 = sorted(p)\nfor i in range(n-1):\n a=+1\n if p[i] > p[i+1]:\n for j in range(a,n-1):\n if p[j] > p[j+1]:\n p[i],p[j+1] = p[j+1],p[i]\nif p == p_2:\n print('Yes')\nelse :\n print('No')", 'n = int(input())\np =...
['Wrong Answer', 'Accepted']
['s044972433', 's503074015']
[3064.0, 3060.0]
[17.0, 18.0]
[280, 196]
p02958
u068750695
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()))\nx=0\nfor i in range(n-1):\n if int(p[i])!=i+1:\n x+=1\nif x<=2:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\np=list(map(int,input().split()))\nx=0\nfor i in range(n-1):\n if int(p[i])!=i+1:\n x+=1\nif x<=2:\n print("YES")\nelse:\...
['Wrong Answer', 'Accepted']
['s349888711', 's419830764']
[3060.0, 3060.0]
[17.0, 20.0]
[156, 156]
p02958
u072549237
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())\nPp = input()\n\nP = []\nn=0\n\nfor i in range(N):\n P.append(int(Pp.split()[i]))\n\nfor w in range(N-1):\n if P[w+1]-P[w]==1:\n n+=1\n\nif N>3:\n \n if n >= N-2:\n print('YES')\n else:\n print('NO')\nelse:\n print('YES')", '#!/usr/bin/env python3\n# -*- c...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s903226706', 's998235778', 's084483366']
[3064.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[262, 314, 195]
p02958
u073139376
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 cnt += p[i] != i + 1\nif cnt == 0 or 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 cnt += p[i] != i + 1\nif cnt == 0 or cnt == 2:\n print('Y...
['Wrong Answer', 'Accepted']
['s192486143', 's638883250']
[2940.0, 2940.0]
[17.0, 17.0]
[162, 162]
p02958
u073606136
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\nnum = int(input())\nstr = input().split()\ntable = list(str)\ntable5 = [int(i) for i in table]\ncount = 0\ntable2 = sorted(table)\ntable3 = [int(i) for i in table2]\nprint(table5)\nprint(table3)\nfor i in range(num):\n if table5[i] == table3[i]:\n continue\n else:\n count += 1\n...
['Wrong Answer', 'Accepted']
['s138425918', 's021082140']
[9156.0, 9132.0]
[28.0, 30.0]
[370, 343]
p02958
u075628913
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()))\nindex_list = []\nvalue_list = []\nfor i in range(1, n+1):\n if i != p[i-1]:\n index_list.append(i)\n value_list.append(p[i-1])\nif len(index_list) == 0:\n print("YES")\nelif len(index_list) == 2 and value_list[0] == index_list[1] and value_list[1] == inde...
['Runtime Error', 'Accepted']
['s688527211', 's229467480']
[3064.0, 3064.0]
[17.0, 17.0]
[352, 353]
p02958
u076512055
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\nq = sorted(p)\n\ndiff = 0\nfor n in range(N):\n if p[n]!=q[n]:\n diff += 1\n\nif diff<=2:\n print('Yes')\nelse:\n print('No')", "N = int(input())\np = list(map(int, input().split()))\n\nq = sorted(p)\n\ndiff = 0\nfor n in range(N):\n if p[n]!...
['Wrong Answer', 'Accepted']
['s948764905', 's704837565']
[3060.0, 3060.0]
[17.0, 17.0]
[185, 185]
p02958
u077816564
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\n\nN = int(input())\nplist = tuple(map(int,input().split()))\nanswer_p = list(plist)\nanswer_p.sort()\nable = False\n\nfor i in range(N-1):\n if able == True:\n break\n p = list(plist)\n j = i + 1\n for j in range(N):\n if able == True:\n break\n p = list(plist)\n ...
['Wrong Answer', 'Accepted']
['s278571173', 's350198581']
[3064.0, 3064.0]
[19.0, 19.0]
[593, 593]
p02958
u078630793
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())\nNlist = [int(i) for i in input().split()]\n\nsum = 0\ncnt = 0\nfor i in range(N):\n if cnt > 2:\n break\n\n if Nlist[i] == (i + 1):\n continue\n else:\n sum += Nlist[i]\n cnt += 1\n\nif cnt == 0 or sum == (N + 1):\n print("Yes")\nelse:\n print("No")', 'N = ...
['Wrong Answer', 'Accepted']
['s480001013', 's198120049']
[3060.0, 3060.0]
[18.0, 18.0]
[292, 241]
p02958
u081688405
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()))\n\nc = 0\nfor i, v in enumerate(arr):\n if i+1==v:\n c += 1\n\nprint("YES" if c==2 or c==0 else "NO")', 'n = int(input())\narr = list(map(int, input().split()))\n\nc = 0\nfor i, v in enumerate(arr):\n if i+1!=v:\n c += 1\nprint("YES" if c==2 or c==0 else...
['Wrong Answer', 'Accepted']
['s777525235', 's390806274']
[2940.0, 2940.0]
[17.0, 17.0]
[153, 153]
p02958
u084411645
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 = [int(i) for in input().split()]\nt = 0\nfor i in range(n):\n for j in range(i+1,n):\n t += a[i] > a[j]\nprint("YES" if t < 2 else "NO")', 'n = int(input())\na = [int(i) for i in input().split()]\nt = 0\nfor i in range(n):\n for j in range(i+1,n):\n t += a[i] > a[j]\nprint("YES" if t < 2 else "...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s845259768', 's859170319', 's915680364', 's087869399']
[8944.0, 9116.0, 9208.0, 9136.0]
[23.0, 30.0, 26.0, 38.0]
[152, 155, 262, 278]
p02958
u085530099
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 = sorted(p)\nprint(p)\nprint(P)\nlength = len(p)\ncount = 0\nfor i in range(0, length):\n if p[i] != P[i]:\n count += 1\nprint(count)\nif count <= 2:\n print('YES')\nelse:\n print('NO')", "n = int(input())\np = input().split()\nP = sorted(p)\nlength = len...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s007135137', 's912859351', 's385276713']
[3064.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[234, 187, 203]
p02958
u086503932
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=sorted(p)\nflag=0\nfor i in range(N):\n for j in range(i+1,N):\n tmp=p\n tmp[i],tmp[j]=tmp[j],tmp[i]\n if tmp==s:\n flag=1\nprint('NYOE S'[flag::2])\n", "import copy\nN=int(input())\np=list(map(int,input().split()))\ns=sorted(p)\nif s==p:\n print('YE...
['Wrong Answer', 'Accepted']
['s216746734', 's300307361']
[3060.0, 3444.0]
[17.0, 67.0]
[206, 289]
p02958
u087373960
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 = map(int, input().split())\nnumbers = []\nresult = True\nfor i in A:\n numbers.append(int(i))\n result = sorted(numbers)\n if (result == True):\n print("YES")\n return "YES"\n if (result == False):\n for i in range(len(numbers)):\n for x in range(i+1, len(numbers)):\n num...
['Runtime Error', 'Runtime Error', 'Accepted']
['s384366240', 's914396023', 's800789256']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 28.0]
[750, 781, 917]
p02958
u088553842
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 range(n):\n if i + 1 != lst[i]:\n cnt += 1\n if cnt >= 3:\n print('No')\n exit()\nprint('Yes')", "n = int(input())\nlst = list(map(int, input().split()))\ncnt = 0\nfor i in range(n):\n if i + 1 != lst[i]:\n cnt += 1\n if cnt >=...
['Wrong Answer', 'Accepted']
['s044421417', 's172393291']
[9120.0, 9180.0]
[28.0, 31.0]
[171, 171]
p02958
u089230684
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, B = map(int, input().split())\n if (A + B) % 2 != 0:\n print("IMPOSSIBLE")\n else:\n print(int((A+B)/2))\n', 'def check(n, list1): \n new = [] \n for i in range(n): \n new.append(list1[i]) \n \n new.sort() \n \n # Check if 0 or 1 swap required \...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s339848541', 's506248875', 's518471282', 's682414530', 's518831656']
[8940.0, 9148.0, 9044.0, 3064.0, 8936.0]
[30.0, 25.0, 26.0, 17.0, 31.0]
[140, 537, 177, 350, 450]
p02958
u090032260
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())\nseqs =list(map(int,input().split()))\ncount = 0\nfor i in range(1,n+1):\n if i != seqs[i]:\n count += 1\nif count <= 2:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\nseqs =list(map(int,input().split()))\ncount = 0\nfor i in range(n):\n if i+1 != seqs[i]:\n count += 1...
['Runtime Error', 'Accepted']
['s683843333', 's563237222']
[3060.0, 2940.0]
[17.0, 19.0]
[178, 176]
p02958
u090406054
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 or cnt==n:\n print('YES')\nelse:\n print('NO')\n ", "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 or cnt==0:\n print('YES')\nel...
['Wrong Answer', 'Accepted']
['s808650841', 's444312500']
[9080.0, 9160.0]
[29.0, 28.0]
[158, 158]
p02958
u092303124
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 = map(int, input().split())\n\n\nasc_l = list(range(1, N))\n\ndiff_l = p - asc_l\ndiff_l.count(0) >= N - 2', "N = int(input())\np = list(map(int, input().split()))\n\nk = 0\ncounter = 1\nfor e in p:\n if e == counter:\n counter += 1\n else:\n k += 1\n counter += 1\n\nif ...
['Runtime Error', 'Accepted']
['s183557236', 's674839836']
[2940.0, 3060.0]
[17.0, 17.0]
[139, 222]
p02958
u093792099
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=[int(i) for i in input().split()]\na.insert(0,0)\nf=1\nfor i in range(1,n+1):\n if a[i]!=i:\n t=a[i]\n a[i]=a[a[i]]\n a[a[i]]=t\n break\nfor i in range(n):\n if a[i]>a[i+1]:\n f=0\nif f==0:\n print("NO")\nelse:\n print("YES")', 'n=int(input())\na=[int(i...
['Wrong Answer', 'Accepted']
['s369101347', 's048938174']
[3064.0, 3064.0]
[17.0, 17.0]
[274, 283]
p02958
u094191970
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_l = list(map(int, input().split()))\n\ncnt = 0\nfor i in range(n):\n if p_l[i] != min(p_l) + i:\n cnt += 1\nif cnt == 2 or p_l == sorted(p_l):\n print('Yes')\nelse:\n print('No')", "n = int(input())\np_l = list(map(int, input().split()))\n\ncnt = 0\nfor i in range(n):\n if p_l[i...
['Wrong Answer', 'Accepted']
['s781233168', 's848232215']
[3060.0, 3060.0]
[17.0, 17.0]
[204, 204]
p02958
u095021077
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=np.array(list(map(int, input().split())))\nq=np.arange(N)+1\n\ntemp=np.sum(p==q)\nif temp==0 or temp==2:\n print('YES')\nelse:\n print('NO')\n ", "import numpy as np\n\nN=int(input())\np=np.array(list(map(int, input().split())))\nq=np.arange(N)+1\n\ntemp=np.sum(~(p==q))\nif temp==0 or temp==2:\n ...
['Runtime Error', 'Accepted']
['s935364472', 's785692887']
[2940.0, 12508.0]
[17.0, 151.0]
[155, 178]
p02958
u097317219
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()))\nint_queue = [i for i in range(1,n+1)]\nans = 0\nfor j in range(1,n):\n ans += p[i]-int_queue[i]\nif ans == 0:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\np = list(map(int,input().split()))\nint_queue = [i for i in range(1,n+1)]\nans = 0\nfor j in r...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s261171568', 's572673567', 's092090605']
[3064.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[193, 193, 241]
p02958
u100800700
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...
["#135 0 or 1 Swap\nN=int(input())\nP=map(int,input().split())\nc=0\nfor i in range(1,N):\n if P[i-1]>P[i]:\n c+=1\nprint('YES' if c==0 or c==2 else 'NO')", "N=int(input())\np=list(map(int,input().split()))\nq=[i for i in range(1,N+1)]\nc=0\nfor i in range(N):\n if p[i]!=q[i]:\n c+=1\nprint('YES' if...
['Runtime Error', 'Accepted']
['s821067295', 's924505439']
[2940.0, 3060.0]
[17.0, 17.0]
[155, 169]
p02958
u102461423
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 = [int(x) for x in input().split()]\nB = list(range(1,N+1))\n\ndef test(i):\n AA = A.copy()\n AA[i], AA[i+1] = AA[i+1], AA[i]\n return AA == B\n\nbl = (A == B)\nfor i in range(N-1):\n if test(i):\n bl = True\nanswer = 'YES' if bl else 'NO'\nprint(answer)\n", "import itertools\nN = int(input...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s718527112', 's962347645', 's717407173']
[3064.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0]
[268, 309, 246]
p02958
u106342872
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\nflag = True\nfor i in range(n):\n for j in range(i+1,n):\n tmp = p[i]\n p[i] = p[j]\n p[j] = tmp\n if p == sorted(p):\n print('Yes')\n flag = False\n tmp = p[i]\n p[i] = p[j]\n ...
['Wrong Answer', 'Accepted']
['s547459567', 's685861742']
[3064.0, 3064.0]
[22.0, 23.0]
[472, 472]
p02958
u108377418
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\ndef solve():\n \n p_sorted = sorted(p, reverse=False)\n cnt = 0\n for i in range(0, n):\n if p[i] != p_sorted[i]:\n cnt += 1\n\n if cnt >= 3:\n print("No")\n return\n\n print("Yes")\n return\n\n\nif __name__ == "__main__":\n solve()'...
['Wrong Answer', 'Accepted']
['s698942475', 's062007760']
[3060.0, 3060.0]
[17.0, 17.0]
[341, 341]
p02958
u109436774
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...
['input()\na = list(map(str, input().split()))\nb = list(map(int, input().split()))\nif sorted(b) == a:\n print("YES")\nelse:\n m = 0\n for i in range(len(a)):\n if a[i] in sorted(b)[i]:\n m+=1\n if m==len(a)-2:\n print("YES")\n else:\n print("NO")', 'input()\ng = input()\...
['Runtime Error', 'Accepted']
['s176079989', 's079248446']
[3060.0, 3064.0]
[17.0, 17.0]
[280, 280]
p02958
u112567325
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\nflug = 0\n\nfor i in range(N):\n if P[i] != i+1:\n ans += 1\n \nif ans <= 2:\n print("Yes")\nelif ans >= 3:\n print("No")', 'N = int(input())\nP = list(map(int,input().split()))\n\nans = 0\nflug = 0\n\nfor i in range(N):\n if P[i] != i+1:\n ...
['Wrong Answer', 'Accepted']
['s568527370', 's696468956']
[3060.0, 3060.0]
[17.0, 19.0]
[184, 184]
p02958
u113255362
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()))\nmid = -1\nflag = True\nfor i in range(N):\n if List[i] == i+1:\n pass\n else:\n flag = False\n if mid == -1:\n mid = List[i]\n else:\n if mid == List[i]:\n print("YES")\n else:\n print("NO")\nif flag:\n print("YES")', 'N...
['Runtime Error', 'Accepted']
['s960386334', 's694562283']
[9100.0, 9080.0]
[27.0, 26.0]
[296, 193]
p02958
u115110170
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())\nls = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(n):\n if ls[i] == i+1:\n continue\n else:\n count +=1\n if count >=2:\n break\n if ls[ls[i]-1]==i+1:\n ls[ls[i]-1] = ls[i]\n ls[i] = i+1\n\n else:\n count+=1\nprint(ls)\nif count>=2:\n print("NO"...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s144229859', 's981749815', 's909535458']
[3064.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[321, 317, 312]
p02958
u115597223
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()]\ncnt = 0\na = []\n\nfor i in range(N-1):\n if p[i]>p[i+1]:\n cnt+=1\nprint(cnt)\nif cnt>2 or cnt==1:\n print("NO")\n exit()\nif cnt==0:\n print("YES")\n exit()\nelse:\n for i in range(N-1):\n if p[i]>p[i+1]:\n a.append(...
['Wrong Answer', 'Accepted']
['s933566205', 's573125388']
[3064.0, 3064.0]
[19.0, 17.0]
[408, 398]
p02958
u115877451
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()))\nc=b\nc.sort()\nd=[]\nprint(c)\nfor i in range(a):\n for j in range(a):\n b[i],b[j]=b[j],b[i]\n print(b)\n if b==c:\n d.append(b)\n else:\n continue\nif len(d)!=0:\n print('YES')\nelse:\n print('NO')", "a = i...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s290945094', 's495530629', 's720511688', 's774562780', 's542046410']
[3444.0, 3444.0, 3064.0, 2940.0, 3060.0]
[31.0, 30.0, 18.0, 18.0, 18.0]
[292, 292, 266, 147, 152]
p02958
u116002573
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(x) for x in input.split()]\n\ncount = 0\np_sorted = sorted(p)\nfor i in range(N):\n if p_sorted[i] != p[i]:\n count += 1\nif count > 2:\n print("NO")\nelse:\n print("YES")\n ', 'N = int(input())\np = [int(x) for x in input().split()]\n\ncount = 0\np_sorted = sorted(p)...
['Runtime Error', 'Accepted']
['s167992284', 's563212820']
[3316.0, 3316.0]
[18.0, 25.0]
[212, 214]
p02958
u116233709
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,d=map(int,input().split())\na=(2*d)+1\nif n%a==0:\n print(int(n/a))\nelse:\n print((n//a)+1)\n', 'n,d=map(int,input().split())\na=(2*d)+1\nif n%a==0:\n print(int(n/a))\nelse:\n print(int(n//a)+1)', 'n=int(input())\np=list(map(int,input().split()))\ncnt=0\nfor i in range(0,n):\n if p[i]==i+1:\n cnt+=0\n els...
['Runtime Error', 'Runtime Error', 'Accepted']
['s560130881', 's915680361', 's689462533']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[92, 94, 171]
p02958
u117078923
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 \ncount = 0\nfor i in range(n-1):\n if p[i] > p[i+1]:\n count += 1\n if count == 2:\n print("NO")\n exit()\nprint("YES")', 'n = int(input())\np = list(map(int,input().split()))\n \ncount = 0\nfor i in range(n-1):\n if p...
['Wrong Answer', 'Accepted']
['s345804779', 's906323004']
[2940.0, 2940.0]
[17.0, 17.0]
[205, 203]
p02958
u117494854
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, e in enumerate(a):\n if i+1 != e:\n count += 1\n\nif count > 2:\n print("No")\nelse:\n print("Yes")', 'n = int(input())\na = map(int, input().split())\n\ncount = 0\nfor i, e in enumerate(a):\n if i+1 != e:\n count += ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s011140244', 's336851688', 's745073794', 's194805220']
[3060.0, 2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 18.0]
[179, 173, 173, 179]
p02958
u117545210
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\na=list(map(int, input().split()))\ncorrect=sorted(a)\n\np=0\nfor i in range(n-1):\n for j in range(n-i-1):\n a[i], a[n-j-1] = a[n-j-1], a[i]\n if a == correct:\n p += 1\n \n else:\n pass\n a[i], a[n-j-1] = a[n-j-1], a[i]\n \nprint(p)', 'n= int(input())\n\na=list(map(i...
['Wrong Answer', 'Accepted']
['s385511589', 's208795155']
[3060.0, 3188.0]
[18.0, 19.0]
[267, 320]
p02958
u123745130
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(map(int(input().split())))\nm=sorted(l)\ncnt=0\nfor i in range(n):\n if l[i]!=m[i]:\n cnt+=1\n if cnt>=3:\n print("NO")\nelse:print("YES")\n ', 'n=int(input())\nl=list(map(int,input().split()))\nm=sorted(l)\ncnt=0\nfor i in range(n):\n if l[i]!=m[i]:\n cnt+=1\n if cnt>=3:\n pri...
['Runtime Error', 'Accepted']
['s814781000', 's541140681']
[2940.0, 3064.0]
[17.0, 17.0]
[163, 169]
p02958
u127499732
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(map(int,input().split()))\nm=sum([i!=l[i] for i in range(1,n+1)])\nprint("YES" if m==0 or m==2 else "NO")', 'n=int(input())\nl=list(map(int,input().split()))\nm=sum([i!=l[i] for i in range(n)])\nprint("YES" if m==0 or m==2 else "NO")', 'n=int(input())\nl=list(map(int,input().split()))\nm=sum([(...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s437229460', 's840452713', 's203554466']
[3056.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[125, 121, 125]
p02958
u127921738
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()))\nsorted_p = sorted(p)\narr = []\nban = [0 for l in range(n)]\nfor i in range(n):\n min_el = min(p[i:])\n idx = p.index(min_el)\n ban[idx] = 1\n if ban[i] != 1:\n arr.append(min_el)\n p[i], p[idx] = p[idx], p[i]\nprint ("YES" if arr == sor...
['Wrong Answer', 'Accepted']
['s622520508', 's850465189']
[3064.0, 2940.0]
[17.0, 17.0]
[322, 173]
p02958
u130900604
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())\nmodel=[]\nfor i in range(n):\n model.append(i+1)\np=list(map(int,input().split()))\ncnt=0\nfor j in p:\n if j != model[j]:\n cnt+=1\nif cnt=<2:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\np=list(map(int,input().split()))\nq=[j for j in range(1,n+1)]\ncnt=0\nfor i in range(n):\n if p...
['Runtime Error', 'Accepted']
['s426822005', 's239767401']
[2940.0, 9096.0]
[17.0, 28.0]
[190, 192]
p02958
u131264627
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 i + 1 == p[i]:\n cnt += 1\nif cnt <= 2:\n print("YES")\nelse:\n print("NO")\n', 'n = int(input())\np = list(map(int, input().split()))\ncnt = 0\nfor i in range(n):\n if i + 1 != p[i]:\n cnt += 1\nif cnt <...
['Wrong Answer', 'Accepted']
['s065061532', 's786561561']
[2940.0, 2940.0]
[17.0, 17.0]
[171, 171]
p02958
u135116520
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\n if z<=2:\n print("YES")\n else:\n print("NO")', '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:\n print("YES")\nelse:\n print("NO")']
['Wrong Answer', 'Accepted']
['s644978776', 's528484459']
[2940.0, 2940.0]
[19.0, 17.0]
[147, 139]
p02958
u135265051
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\n# import statistics\na=int(input())\n#b,c=int(input()),int(input())\n# c=[]\n\n# c.append(i)\n#e1,e2 = map(int,input().split())\nf = list(map(int,input().split()))\n#g = [input() for _ in range(a)]\n\ncount=0\nfor i in range(a-1):\n if f[i]!=f[i+1]-1:\n f[i+1]=f[i]+1\n count+=1\nif...
['Wrong Answer', 'Accepted']
['s061945301', 's990238899']
[9092.0, 9140.0]
[29.0, 29.0]
[376, 373]
p02958
u137226361
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(1,n+1):\n if i == p[i-1]:\n pass\n else:\n count += 1\n if count ==3:\n print('No')\n exit(0)\nprint('Yes')", "n= int(input())\np = list(map(int, input().split()))\ncount =0\n\nfor i in ra...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s173425197', 's730407154', 's085809932']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[225, 225, 225]
p02958
u137542041
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\nP = map(int, input().split())\nP = list(P)\n\n\ncnt = 0\nfor i in range(1, N):\n if P[i] < P[i - 1]:\n if cnt == 1:\n print('NO')\n else:\n v = P[i - 1]\n P[i] = P[i - 1]\n P[i - 1] = v\n cnt +=1\n else:\n continue\n...
['Wrong Answer', 'Accepted']
['s895110578', 's113299238']
[3060.0, 3064.0]
[17.0, 19.0]
[313, 473]
p02958
u138781768
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 = map(int, input().split())\np2 = ps[0] - 1\nfor p in ps:\n if p > p2:\n p2 = p\n\n else:\n print("NO")\nif p2 == p[-1]:\n print("YES")', 'n = int(input())\np = list(map(int, input().split()))\nlis = sorted(list(range(1, n+1)))\nl = len(p)\ncache = l\nfor k, m in zip(lis, p...
['Runtime Error', 'Accepted']
['s252234413', 's708350557']
[2940.0, 3064.0]
[17.0, 17.0]
[169, 221]
p02958
u139315183
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())\nY = [int(x) for x in input().split()]\nY_ = Y.copy()\nY_.sort()\ntest = [Y[i] == Y_[i] for i in range(len(Y))]\nif test.count(False) <= 2:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nY = [int(x) for x in input().split()]\nY_ = Y.copy()\nY_.sort()\ntest = [Y[i] == Y_[i] for i in range(...
['Wrong Answer', 'Accepted']
['s602250637', 's823327396']
[3060.0, 3060.0]
[17.0, 17.0]
[186, 186]
p02958
u140191608
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 = 1\nfor i in range(0,len(A)-1):\n if A[i] < A[i+1]:\n count += 1\nif count == N or count == 2:\n print('YES')\nelse:\n print('NO')", "N = int(input())\nA = list(map(int , input().split()))\ncount = 0\nB = [i for i in range(1,N+1)]\nfor i i...
['Wrong Answer', 'Accepted']
['s334778044', 's898845964']
[3060.0, 3060.0]
[17.0, 18.0]
[200, 208]
p02958
u141410514
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\nq = []\nfor x in range(N):\n q.append(x+1)\n\ni = 0\nc = 0\nans = "NO"\nwhile(i < N):\n if p[i] != q[i]:\n c += 1\n if c > 2:\n break\n i += 1\n\nif (c == 2) && (c == 0):\n ans = "YES"\n\nprint(ans)\n', 'N = int(input())\np = list(ma...
['Runtime Error', 'Accepted']
['s384123113', 's787902543']
[2940.0, 3064.0]
[17.0, 17.0]
[264, 263]
p02958
u146575240
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\npn = sorted(p)\n\ncount = 0\nfor i in range(N):\n if p[i] == pn[i]:\n pass\n else:\n count = count + 1\n\nprint(p, pn, count)\nif count == 2 or count == 0:\n print('YES')\nelse:\n print('NO')", "# Swap 0 or 1 Swap\n\nN = int(input())\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s345805039', 's624045557', 's851246049']
[3316.0, 3064.0, 3064.0]
[21.0, 17.0, 17.0]
[258, 276, 258]
p02958
u151037808
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 -*-\nfrom copy import deepcopy\n\n\ndef main():\n n = int(input())\n p = list(map(int, input().split()))\n\n for i in range(n):\n for j in range(i, n):\n \n # continue\n p_temp = deepcopy(p)\n temp = p_temp[i]\n p_temp[i] =...
['Wrong Answer', 'Accepted']
['s615279389', 's702715647']
[3956.0, 3444.0]
[89.0, 76.0]
[530, 532]
p02958
u156383602
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=[int(i) for i in input().split()]\nans=0\nok=True\nfor i in range(n-1):\n if a[i]!=i+1:\n if a[a[i]-1]!=i+1:\n ok=False\nif ok:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\na=[int(i) for i in input().split()]\nans=0\nkai=0\nok=True\nfor i in range(n-1):\n if a...
['Wrong Answer', 'Accepted']
['s850329996', 's263263360']
[3060.0, 3064.0]
[17.0, 17.0]
[197, 228]
p02958
u159975271
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 = sorted(A)\nfor i in range (N):\n if B[i] != A[i]:\n k += 1\nif k >= 3:\n print("NO")\nelse:\n print("YES")', 'N = int(input())\nA = list(map(int, input().split()))\nB = sorted(A)\nk = 0\nfor i in range (N):\n if B[i] != A[i]:\n k += ...
['Runtime Error', 'Accepted']
['s198863961', 's917048419']
[2940.0, 3060.0]
[17.0, 17.0]
[172, 178]
p02958
u163501259
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\nprint('YES' if CNT <= 2 else '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\nprint('YES' if CNT <= 2 else 'NO')"]
['Runtime Error', 'Accepted']
['s287663512', 's682080423']
[2940.0, 2940.0]
[17.0, 17.0]
[146, 147]
p02958
u163874353
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 = map(int, input().split())\nl = []\nfor i in range(1, n + 1):\n if i != p[i - 1]:\n l.append(i)\nif len(l) == 2:\n print("YES")\nelse:\n print("NO")\n ', 'n = int(input())\np = list(map(int, input().split()))\nl = []\nfor i in range(1, n + 1):\n if i != p[i - 1]:\n ...
['Runtime Error', 'Accepted']
['s257163860', 's680710597']
[2940.0, 3060.0]
[18.0, 17.0]
[185, 182]
p02958
u165114979
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()))\nc = 0\nfor i in range(n):\n if a[i] != i:\n c+=1\n \nif c == 0 or c == 2:\n print('YES')\n \nelse:\n print('NO')", "n = int(input())\na = list(map(int, input().split()))\nc = 0\nfor i in range(n):\n if a[i] != i + 1:\n c+=1\n \nif c == 0 or c == ...
['Wrong Answer', 'Accepted']
['s119499668', 's301283668']
[9116.0, 9156.0]
[36.0, 31.0]
[166, 172]
p02958
u167681750
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\n\nfor i in range(n):\n for j in range(n):\n temp = list(copy(p))\n temp[i], temp[j] = temp[j], temp[i]\n sorted_temp = sorted(temp)\n\n if sorted_temp == temp:\n print("YES")\n exit()\n\nprint("NO")', 'n = i...
['Runtime Error', 'Accepted']
['s974344194', 's803406029']
[3064.0, 3060.0]
[17.0, 27.0]
[295, 289]
p02958
u170183831
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()))\ndef check(L):\n for i in range(1, len(L)):\n if L[i] < L[i - 1]:\n return False\n return True\nfor i in range(n):\n for j in range(i + 1, n):\n if check(A[0:i] + [A[j]] + A[i+1:j] + [A[i]] + A[j+1:]):\n print('YES')\n return\nprint('NO')",...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s621682712', 's910578987', 's824022496']
[3064.0, 3064.0, 3064.0]
[18.0, 19.0, 19.0]
[304, 445, 440]
p02958
u172010803
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(" ")))\nc=0\nfor i in range(n):\n if p[i]!=i+1:\n c+=1\nif c<=2:\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]!=i+1:\n c+=1\nif c<=2:\n print("YES")\nelse:\n pri...
['Wrong Answer', 'Accepted']
['s336680956', 's040043704']
[3060.0, 2940.0]
[17.0, 18.0]
[152, 152]
p02958
u173178698
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\nprint(count)\nif count>=3:\n print('NO')\nelse:\n print('YES')\n", "N = int(input())\nP = list(map(int,input().split()))\ncount = 0\nfor i in range(N):\n if not i+1==P[i]:\n co...
['Wrong Answer', 'Accepted']
['s830547460', 's784401076']
[2940.0, 2940.0]
[17.0, 18.0]
[185, 172]
p02958
u175746978
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()))\nnew_A = sorted(A)\ncnt = 0\nfor i in range(n):\n if A[i] != new_A[i]:\n cnt += 1\nif cnt == 0 or cnt == 2:\n print('Yes')\nelse:\n print('No')", "n = int(input())\nA = list(map(int, input().split()))\nnew_A = sorted(A)\ncnt = 0\nfor i in range(n):...
['Wrong Answer', 'Accepted']
['s133265878', 's603735109']
[3060.0, 3060.0]
[18.0, 17.0]
[203, 203]
p02958
u176674210
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:utf8 -*-\n\nn = int(input())\nl = list(map(int, input().split()))\nc = 0\nfor i,n in enumerate(l,1):\n if n != i:\n c += 1\nans = 'Yes' if c == 0 or c == 2 else 'No'\nprint(ans)\n", "# -*- coding:utf8 -*-\n\nn = int(input())\nl = list(map(int, input().split()))\nc = 0\nfor i,n in enumerate(l,1)...
['Wrong Answer', 'Accepted']
['s319256310', 's621432629']
[2940.0, 2940.0]
[17.0, 17.0]
[192, 192]
p02958
u177756077
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...
['7\n1 2 3 4 5 6 7', 'N=int(input())\np=list(map(int,input().split()))\n\ncnt=0\nfor i in range(N):\n if i+1!=p[i]:\n cnt+=1\nif cnt==0 or cnt==2:\n print("YES")\nelse:\n print("NO")']
['Runtime Error', 'Accepted']
['s577823313', 's761227831']
[2940.0, 2940.0]
[17.0, 19.0]
[15, 166]
p02958
u178079174
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()\nPP = [str(i) for i in range(1,N+1)]\ndiff = 0\nfor i in range(N):\n if P[i] != PP[i]:\n diff += 1\nif diff <= 2:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nP = input().split()\nPP = [str(i) for i in range(1,N+1)]\ndiff = 0\nfor i in range(N):\n i...
['Wrong Answer', 'Accepted']
['s325724174', 's132350348']
[3060.0, 3060.0]
[18.0, 17.0]
[193, 193]
p02958
u181195295
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 \np = list()\n \np = map(int, input().split())\n \nk = 0\n \nfor i in range(0, len(p)-1 ):\n if (p[i] > p[ i + 1 ]):\n k += 1\n \n \nif ( k <= 1 ):\n print("YES")\nelse:\n print("NO")\n ', 'N = int(input())\n\np = list(map(int, input().split()))\n\nk = 0\n\nfor i in range(0, N-1 ):\n ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s102371475', 's266517870', 's499026501', 's563465074', 's289275163']
[2940.0, 2940.0, 2940.0, 3064.0, 3060.0]
[17.0, 17.0, 18.0, 17.0, 17.0]
[201, 176, 190, 221, 218]
p02958
u182332190
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\ncounter=0\nfor i in range(n):\n print(i, p[i])\n if i+1 != p[i]:\n counter+=1\n\nif counter==0 or counter==2:\n print('YES')\nelse:\n print('NO')", "n = int(input())\np = list(map(int, input().split()))\n\ncounter=0\nfor i in range(n):\n #...
['Wrong Answer', 'Accepted']
['s123665563', 's563209734']
[3060.0, 2940.0]
[17.0, 17.0]
[209, 211]
p02958
u184339976
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()))\np0=sorted(p)\ncount=int(0)\nfor i in range(N):\n if p[i]!=p0[i]:\n count+=1\n else:\n continue\nprint('Yes') if count<=2 else print('No')\n", "N=int(input())\np=list(map(int,input().split()))\np0=sorted(p)\ncount=int(0)\nfor i in range(N):\n if p[i]!=p0[i]:\n...
['Wrong Answer', 'Accepted']
['s048289880', 's527217333']
[3064.0, 2940.0]
[17.0, 17.0]
[187, 187]
p02958
u186542450
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\ncount = 0\nfor i in range(N):\n if P[i] != i + 1:\n count += count + 1\n if count > 2:\n print('No')\n exit()\n\nprint('Yes')\n", "N = int(input())\nP = list(map(int, input().split()))\n\ncount = 0\nfor i in range(N):\n if P[i] != ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s577084880', 's830359226', 's274199550']
[2940.0, 3060.0, 2940.0]
[23.0, 19.0, 18.0]
[199, 199, 192]
p02958
u189479417
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 print("Y...
['Runtime Error', 'Accepted']
['s337294961', 's161517097']
[2940.0, 2940.0]
[17.0, 17.0]
[163, 161]
p02958
u190178779
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())\narray = list(map(int,input().split()))\narray_base = [ I for I in range(1,N+1) ]\n\ndic = {}\nfor I in range(N):\n if array[I] != I + 1:\n dic[I] = array[I]\nif len(dic) != 2 or len(dic) != 0:\n print('NO')\nelse:\n print('YES')", "import sys\nN = int(input())\narray = li...
['Wrong Answer', 'Accepted']
['s500243247', 's696433618']
[9196.0, 9196.0]
[30.0, 30.0]
[262, 269]
p02958
u193264896
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\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\n\n\ndef main():\n N = int(readline())\n P = np.array(readline().split(), np.int64)\n A = np.array(range(1,N+1)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s265026526', 's448198045', 's852732450']
[12208.0, 20964.0, 20696.0]
[150.0, 305.0, 320.0]
[481, 470, 470]
p02958
u198905553
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...
['res = 0\na_sort = sorted(a)\n\nfor i in range(n):\n if a_sort[i] != a[i]:\n res += 1\n\nif res > 2:\n print("NO")\nelse:\n print("YES")\n', "n=int(input())\na=list(map(int, input().split()))\nans='Yes'\nnow=a[0]-1\nfor i in a: \n if now>i:\n ans='No'\n now=max(now, i-1)\nprint(ans)", 'a',...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s082207599', 's132491430', 's214796561', 's295399594', 's267982392']
[3064.0, 3064.0, 2940.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 19.0]
[142, 146, 1, 148, 198]
p02958
u200527996
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 = sorted(p)\nans = 0\nfor i in range(N):\n if p[i] == P[i]:\n ans += 0\n else:\n ans +=1\nprint("Yes" if ans < 3 else "No")', 'N = int(input())\np = list(map(int, input().split()))\nP = sorted(p)\nans = 0\nfor i in range(N):\n if p[i] == ...
['Wrong Answer', 'Accepted']
['s553902053', 's126676070']
[3060.0, 3060.0]
[17.0, 17.0]
[191, 191]
p02958
u203022424
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\nminp = p.pop()\nfor pi in p:\n if minp > pi:\n minp = pi\n count +=1\nif count==1:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\np = list(map(int, input().split(" ")))\np_sorted = p.copy()\np_sorted.sort()\nans = set(p) ^ set(p_s...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s371620928', 's735426698', 's533915198']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[185, 173, 163]
p02958
u203886313
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\nc = 0;\nfor i in range(n):\n if(p[i] != i+1): \n c+=1\n\nif c == 0 or c == 2:\n print("Yes")\nelse: \n print("NO")', 'n = int(input());\np = list(map(int, input().split()));\n\nc = 0;\nfor i in range(n):\n if(p[i] != i+1): \n c+=1\n\...
['Wrong Answer', 'Accepted']
['s954378240', 's834531285']
[3064.0, 3064.0]
[17.0, 19.0]
[178, 178]
p02958
u204208382
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...
['7\n1 2 3 4 5 6 7', 'n=int(input())\ninfo=list(map(int,input().split()))\n\np_sort=sorted(info)\ntem_1=0\ntem_2=0\ntem=0\nfor i in range(n-1):\n if info[i]>info[i+1]:\n tem_1=i\n for j in range(n-i-2):\n if info[i+j+1]>info[i+j+2]:\n tem_2=i+j+2\n break\n break\ntem=info[tem_1]\ninfo[tem_1...
['Runtime Error', 'Accepted']
['s995717906', 's976265529']
[2940.0, 3064.0]
[17.0, 17.0]
[15, 416]
p02958
u204800924
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 = 0\n\nfor i in range(n):\n\tif i+1 == p[i]:\n \tflag += 1\n\n \n\nif flag >= n-2: \n print('YES')\nelse:\n print('NO')", "n = int(input())\np = list(map(int, input().split()))\nflag = 0\n\nfor i in range(n):\n if i+1 == p[i]:\n...
['Runtime Error', 'Accepted']
['s302546769', 's586480076']
[2940.0, 2940.0]
[17.0, 17.0]
[193, 181]
p02958
u207608961
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 = intpu()\nseq = list(map(int, input().split()))\n\nfor i in range(len(seq)-1):\n if seq[i] <= min(seq[i+1:]):\n continue\n elif seq[i] > min(seq[i+1:]):\n j = seq.index(min(seq[i+1:]))\n if seq[i] > min(seq[i+1:j]+seq[j+1:]):\n print("NO")\n break\n seq[i], s...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s714150043', 's728798684', 's762397068']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[353, 341, 377]
p02958
u208497224
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 = 7\na_list = list(map(int, input().split()))\nfalse_count = 0\nfor index in range(a_list):\n if index + 1 != a_list[index]:\n false_count += 1\nif false_count in [0, 2]:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\na_list = list(map(int, input().split()))\nfalse_count = 0\nfor index in range(len(...
['Runtime Error', 'Accepted']
['s098937379', 's187237207']
[2940.0, 2940.0]
[18.0, 17.0]
[205, 222]
p02958
u209275335
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())\ncount = 0\nlia = []\nlib = list(map(int,input().split()))\nfor i in range(1,n+1):\n lia.append(i)\nfor i in range(n):\n if lia[i] != lib[i]:\n count += 1\n if count > 3:\n print("No")\n break\nif count <= 2:\n print("Yes")', 'n = int(input())\nli1 = list(map(int,inpo...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s354970338', 's555225284', 's033774409']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[260, 243, 242]
p02958
u209337527
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...
["input1 = input()\n \nrow = input1.split('\\n')\n\nN = int(row[0])\nnumbers = row[1].split()\n\ncounter = 0\n\nfor i in range(N):\n if int(numbers[i]) != i+1:\n counter+=1\n \nif counter <= 2:\n print('YES')\nelse:\n print('NO')", "N = int(input())\nnumbers = input().split()\n\ncounter = 0\n\nfo...
['Runtime Error', 'Accepted']
['s834768174', 's611653452']
[3060.0, 2940.0]
[17.0, 17.0]
[233, 190]
p02958
u214304095
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\ncnt = 0\nfor i, num in enumerate(p):\n if i + 1 != num:\n cnt += 1\nif cnt == 0 or cnt == 2:\n print("Yes")\nelse:\n print("No")\n', 'n = int(input())\np = list(map(int, input().split()))\n\ncnt = 0\nfor i, num in enumerate(p):\n if i + 1 != ...
['Wrong Answer', 'Accepted']
['s350417949', 's212319784']
[2940.0, 3316.0]
[17.0, 21.0]
[192, 192]
p02958
u215065194
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())\na = list(map(int, input().split()))\n\nsrt = sorted(a)\n\nres = "Yes"\ncnt = 0\nfor c,s in zip(a,srt):\n if c != s:\n cnt += 1 \n if cnt > 2:\n res = "No"\n break\nprint(res)', '\nn = int(input())\na = list(map(int, input().split()))\n\nsrt = sorted(a)\n\nres = "YES"\ncn...
['Wrong Answer', 'Accepted']
['s644342934', 's521536156']
[3060.0, 3060.0]
[17.0, 17.0]
[207, 207]
p02958
u215743476
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\nc = 0\nfor i in range(n):\n if p[i] != i:\n c += 1\n\nif c > 2:\n print("NO")\nelse:\n print("YES")', 'n = int(input())\np = list(map(int, input().split()))\n\nc = 0\nfor i in range(n):\n if p[i] != i + 1:\n c += 1\n\nif c > 2:\n pr...
['Wrong Answer', 'Accepted']
['s182071491', 's240892415']
[3060.0, 3060.0]
[17.0, 17.0]
[161, 165]
p02958
u217582166
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()))\nsample = sorted(p)\ncount = 0\nfor j in range(len(p)):\n if p[j] != sample[j]:\n count += 1\nif count < 3:\n print('Yes')\nelse:\n print('No')", "n = int(input())\np = list(map(int, input().split()))\nsample = sorted(p)\ncount = 0\nfor j in range(len(p)):\n...
['Wrong Answer', 'Accepted']
['s768872212', 's770430809']
[3060.0, 3060.0]
[17.0, 18.0]
[193, 193]
p02958
u217627525
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\nans="Yes"\nfor i in range(1,n+1):\n p_i=p.index(i)\n if p_i!=i-1:\n if p[i-1]==p_i+1 and count<=2:\n count+=1\n else:\n ans="No"\n break\nprint(ans) ', 'n=int(input())\np=list(map(int,input().split()))\ncou...
['Wrong Answer', 'Accepted']
['s214340356', 's413694013']
[3060.0, 3060.0]
[17.0, 17.0]
[249, 248]
p02958
u219086885
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())\nxn = map(int,input().split())\nk = 0\nfor i in range(1,n+1)\n\tif xn[i-1] != i:\n \tk += 1\nprint("NO" if k > 2 else "YES")', 'n = int(input())\nxn = [int(x) for x in input().split()]\nk = 0\nfor i in range(1,n+1):\n\tif xn[i-1] != i:k += 1\n \nprint("NO" if k > 2 else "YES")']
['Runtime Error', 'Accepted']
['s119438053', 's601174108']
[2940.0, 2940.0]
[17.0, 17.0]
[136, 149]
p02958
u220064149
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())\nlist1=list(map(int,input().split()))\nlist2=[]\nfor i in range(1,N):\n list2.append(i)\na=N\nfor j in range(0,N-1):\n if list1[j]==list[j]:\n a=a-1\nif a>2:\n print("NO")\nelse:\n print("YES")', 'N=int(input())\nlist1=list(map(int,input().split()))\nlist2=[]\nfor i in range(1,N):\n list2.appen...
['Runtime Error', 'Accepted']
['s547939956', 's381118108']
[3064.0, 3060.0]
[17.0, 17.0]
[203, 208]
p02958
u220119489
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()))\nc = 0\nfor i in range(N):\n d = int(p[i] != i + 1)\n c = c + d\nif c == 0 or c == 2:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\np = list(map(int, input().split()))\nc = 0\nfor i in range(N):\n d = int(p[i] != i + 1)\n c = c + d\nif...
['Wrong Answer', 'Accepted']
['s607166595', 's870603714']
[3060.0, 3060.0]
[17.0, 17.0]
[178, 178]