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
u763177133
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()\np = list(map(int,input().split()))\n\nps = sorted(p)\n\nd_p = []\nd_ps = []\nfor i,q in enumerate(p):\n if q != ps[i]:\n d_p.append(q)\n d_ps.append(ps[i])\nif len(d_p) > 2:\n print('No')\nelif len(d_p) == 2:\n d_p.sort()\n if d_p == d_ps:\n print('Yes')\n else:\n print('No')\nelse:\n p...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s079277695', 's444048516', 's993179520']
[9116.0, 9128.0, 9088.0]
[28.0, 25.0, 26.0]
[309, 309, 169]
p02958
u763249708
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\nsorted_p = sorted(p)\ncnt = 0\nfor i in range(n):\n if p[i] != sorted_p[i]:\n cnt += 1\n\nif cnt <= 2: print("Yes")\nelse: print("No")', 'n = int(input())\np = list(map(int, input().split()))\n\nsorted_p = sorted(p)\ncnt = 0\nfor i in range(n):\n i...
['Wrong Answer', 'Accepted']
['s387645725', 's210873270']
[3060.0, 3060.0]
[17.0, 17.0]
[191, 191]
p02958
u765590009
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 = [int(num) for num in input().split()]\n\nk = 0\nfor i in range(1, len(pn)):\n if (i+1) != pn[i]:\n k += 1\n\nif k <= 2:\n print("Yes")\nelse :\n print("No")\n', 'n = int(input())\npn = [int(num) for num in input().split()]\n\nk = 0\nfor i in range(0, len(pn)):\n if (i+1) != pn[i]:\...
['Wrong Answer', 'Accepted']
['s814637172', 's940152260']
[8972.0, 9176.0]
[28.0, 30.0]
[179, 179]
p02958
u765758367
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('No')\nelse:\n print('Yes')\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 > ...
['Wrong Answer', 'Accepted']
['s503531362', 's011234047']
[2940.0, 2940.0]
[17.0, 17.0]
[170, 170]
p02958
u772588522
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\nindex = []\n\nfor i in range(n-1):\n if p[i] < p[i+1]:\n pass\n else:\n count += 1\n index.append(i)\n\nif count == 0:\n print('YES')\nelif count == 2:\n print('NO')\nelse:\n p[index[0]], p[index[1] + 1] = p[index[1] + 1], p[index[0]]...
['Runtime Error', 'Accepted']
['s256295642', 's723178553']
[3064.0, 3064.0]
[17.0, 17.0]
[384, 386]
p02958
u773440446
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()))\nans = [i for i in range(1,n+1)]\ncnt = 0\n\nfor i in range(n):\n if p[i] != ans[i]:\n cnt += 1\n if cnt > 2:\n print('No')\n exit()\n \nprint('Yes')", "n = int(input())\np = list(map(int,input().split()))\nans = [i for i in range(1,n+1)]\ncnt = 0\n\n...
['Wrong Answer', 'Accepted']
['s478806764', 's712435539']
[9088.0, 9172.0]
[25.0, 28.0]
[204, 205]
p02958
u773686010
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 = list(map(int,input().split()))\ncnt = 0\nfor i in range(N):\n if i + 1 != N_List[i]:\n cnt += 1\nprint(("No","Yes")[cnt<=2])', 'N = int(input())\nN_List = list(map(int,input().split()))\ncnt = 0\nfor i in range(N):\n if i + 1 != N_List[i]:\n cnt += 1\nprint(("NO","YES")[...
['Wrong Answer', 'Accepted']
['s386292664', 's357202951']
[9068.0, 9072.0]
[28.0, 31.0]
[155, 155]
p02958
u780420070
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()\nfor i in range(len(p)):\n p[i]=int(p[i])\np1=sorted(p)\ncount=0\nfor i in range(n):\n if p[i]!=p1[i]:\n count+=1\nif count==2 or count==0:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\np=input().split()\nfor i in range(len(p)):\n p[i]=int(p[i])\np1=sor...
['Wrong Answer', 'Accepted']
['s861075408', 's753905264']
[3064.0, 3064.0]
[17.0, 17.0]
[216, 216]
p02958
u782616557
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()))\nfalse_num=0\nfor i in range(N-1):\n if p[i]+1 != i+1:\n \n false_num+=1\n\nif false_num==0 or false_num==2:\n print('YES')\nelse:\n print('NO')\n\n ", "N=int(input())\np=list(map(int,input().split()))\nfalse_num=0\nfor i in range(N-1):\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s294696373', 's318006660', 's079965797']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[215, 228, 211]
p02958
u785066634
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()))\ncount=0\nfor i in range(1,n+1):\n if i !=l[i-1]:\n count+=1\n \nif count<=2:\n print('Yes')\nelse:\n print('No')\n \n \n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s036413032', 's067880424', 's407610349', 's597913590', 's088575755']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[19.0, 17.0, 17.0, 17.0, 17.0]
[353, 349, 353, 353, 272]
p02958
u788703383
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())\nans = 0\nfor i in range(n):\n if i+1 != p[i]:\n if i+1 == p[p[i]-1]:\n ans += 1\n\nprint('Yes' if ans == 0 or 2 else 'No')", "n,*p = map(int,open('abc135.txt').read().split())\nans = 0\nfor i in range(n):\n if i+1 != p[i]:\n if i+1 == p[p[i]-1]:\n...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s622965723', 's741154801', 's906268023', 's913066068', 's923918075']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 17.0, 18.0]
[176, 187, 136, 187, 149]
p02958
u788997230
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()))\ncheck = {}\ncnt = 0\nans = [i for i in range(n)]\nfor i in range(n):\n if(p[i]==ans[i]+1):\n continue\n elif(p[i]!=ans[i]):\n check[i] = p[i]\n if(cnt<3):\n cnt += 1\n else:\n break\nif(cnt==0):\n print("Y...
['Wrong Answer', 'Accepted']
['s577101822', 's686775368']
[3064.0, 3064.0]
[17.0, 17.0]
[383, 383]
p02958
u790301364
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 main37():\n num = int(input())\n data = input().split()\n retu = []\n for i in range(num):\n retu.append(int(data[i]))\n kari = list(retu)\n kari.sort()\n kosu = 0\n for i in range(num):\n if retu[i] != kosu[i]:\n kosu = kosu + 1\n if kosu == 2 or kosu == 0:\n ...
['Runtime Error', 'Accepted']
['s727722403', 's291490419']
[3064.0, 3064.0]
[18.0, 18.0]
[394, 394]
p02958
u790922244
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=P[:]\nQ.sort()\nprint(P)\nprint(Q)\n\nnot_equal_count=0\nfor i in range(N):\n if P[i] != Q[i]:\n not_equal_count += 1\nif not_equal_count in [0, 2]:\n print("YES")\nelse:\n print("NO")', 'N=int(input())\nP=list(map(int, input().split()))\nQ=P[:]\nQ.sort()\n\n...
['Wrong Answer', 'Accepted']
['s773737245', 's927908803']
[3188.0, 3064.0]
[18.0, 17.0]
[229, 211]
p02958
u797488725
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()\ns = input().split()\ns=[int(i) for i in s]\ncount=-1\nfor i in range(int(n)//2):\n if s[i] + s[count] ==int(n)+1:\n count-=1\n \telse:\n print("No")\n\nif int(n) %2 ==0:\n print("YES")\nelse:\n if s[count]*2 == n :\n print("YES")\n else:\n print("NO")\n ', 'n = input()\nN=li...
['Runtime Error', 'Accepted']
['s009906981', 's507406292']
[2940.0, 2940.0]
[17.0, 18.0]
[281, 163]
p02958
u798475526
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()))\nans = "YES"\nfor i in range(N-1):\n if p[i] > p[i+1]:\n ans ="NO"\n break\n\nif ans != "YES":\n for i in range(N-1):\n for j in range(i+1,N-1):\n pcopy = p.copy()\n pcopy[i],pcopy[j] = pcopy[j],pcopy[i]\n flg...
['Wrong Answer', 'Accepted']
['s415959105', 's463601729']
[3064.0, 3064.0]
[27.0, 28.0]
[508, 506]
p02958
u799428010
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()))\nans=0\nfor i in range(n):\n if p[i]!=i+1:\n ans=ans+1\nif ans<=2:\n print('Yes')\nelse:\n print('No')", "n=int(input())\np=list( map(int, input().split()))\nans=0\nfor i in range(n):\n if p[i]==i+1:\n ans=ans+1\nif ans<=2:\n print('No')\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s021013245', 's133173690', 's303647540', 's338200539', 's821650809']
[9044.0, 8988.0, 8976.0, 9000.0, 8976.0]
[29.0, 31.0, 31.0, 26.0, 30.0]
[160, 160, 174, 160, 174]
p02958
u802341442
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(k) for k in input().split()]\n\ncnt = 0\nfor i in range(n):\n if p[i] != i+1:\n cnt += 1\nprint('Yes' if cnt == 0 and 2 else 'No')\n#print('Yes' if cnt <= 2 else 'No')", "n = int(input())\np = [int(k) for k in input().split()]\n\ncnt = 0\nfor i in range(n):\n if p[i] != i+1:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s031562717', 's576694773', 's653391917', 's093727590']
[2940.0, 2940.0, 3060.0, 2940.0]
[17.0, 17.0, 19.0, 17.0]
[196, 160, 196, 166]
p02958
u802563409
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...
['# stdin\nINPUT_SENTENCES = 2\nss = [input() for i in range(INPUT_SENTENCES)]\nN = int(ss[0])\np = list(map(lambda x: int(x), ss[1].split()))\nrev_index = []\nfor i in range(N-1):\n if p[i] > p[i+1]:\n if len(rev_index) > 0:\n rev_index.append(i+1)\n else:\n rev_index.append(i)\n...
['Runtime Error', 'Accepted']
['s644290630', 's990924745']
[2940.0, 3064.0]
[17.0, 17.0]
[469, 468]
p02958
u805535424
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\nf = False\nfor i in range(n-1):\n for j in range(i+1, n):\n q = p[:]\n b = q.pop(j)\n a = q.pop(i)\n q.insert(i, b)\n q.insert(j, a)\n r = sorted(q[:])\n if q == r:\n f = True\n break\n ...
['Wrong Answer', 'Accepted']
['s889549773', 's294674412']
[3064.0, 3064.0]
[24.0, 23.0]
[403, 402]
p02958
u806855121
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()))\nsort_P = sorted(P)\n\ndiff = 0\nfor p, sp in zip(P, sort_P):\n if p != sp:\n diff += 1\nprint(diff)\nif diff == 2 or diff == 0:\n print('YES')\nelse:\n print('NO')", "N = int(input())\nP = list(map(int, input().split()))\nsort_P = sorted(P)\n\ndif...
['Wrong Answer', 'Accepted']
['s338222712', 's403187880']
[3060.0, 2940.0]
[17.0, 17.0]
[222, 219]
p02958
u806976856
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()))\nf=0\nfor i in range(n):\n if p[i]!=i+1:\n f+=1\nprint("Yes" if f<=2 else "No")\n ', 'n=int(input())\np=list(map(int,input().split()))\nf=0\nfor i in range(n):\n if p[i]!=i+1:\n f+=1\nprint("YES" if f<=2 else "NO")']
['Wrong Answer', 'Accepted']
['s180721956', 's406123306']
[2940.0, 2940.0]
[17.0, 17.0]
[129, 126]
p02958
u809192419
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\nimport math\n\nn = int(input())\np = [int(i) for i in input().split()]\n\nr = []\n\nfor i in range(1, n + 1):\n\tif i != p[i - 1]:\n\t\tr.append(p[i - 1])\n\nif len(r) <= 2:\n\tprint("Yes")\nelse:\n\tprint("No")\n', '#!/usr/bin/env python\nimport math\n\nn = int(input())\np = [int(i) for i in i...
['Wrong Answer', 'Accepted']
['s261962170', 's106581065']
[3060.0, 3060.0]
[18.0, 17.0]
[215, 215]
p02958
u809457879
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()))\nl1=sorted(l)\nprint(l1)\nans=0\nfor i in range(N):\n if l[i]!=l1[i]:\n ans+=1\nif ans==0 or ans==2:\n print('YES')\nelse:\n print('NO')", "N=int(input())\nl=list(map(int,input().split()))\nl1=sorted(l)\nans=0\nfor i in range(N):\n if l[i]!=l1[i]:\n ans+=1\n ...
['Wrong Answer', 'Accepted']
['s210333131', 's074670024']
[3060.0, 3064.0]
[17.0, 17.0]
[180, 180]
p02958
u812817085
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()\np=input()\nN=int(N.split()[0])\np=p.split()\np=[int(p) for p in p]\nnumlist=sorted(p)\n\nif numlist==p:\n output="YES"\nelse: \n dist=0 \n for s,t in zip(numlist,p):\n if s!=t:\n dist=dist+1\n else:\n# dist=dist+0\n pass\n if dist=2:...
['Runtime Error', 'Accepted']
['s261570214', 's564808150']
[2940.0, 3064.0]
[17.0, 18.0]
[375, 376]
p02958
u813102292
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\n\nfor i in range(N-1):\n if P[i] > P[i+1]:\n cnt += 1\n if cnt > 1:\n print('NO')\n exit()\n\nprint('YES')\n", "N = int(input())\nP = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(N):\n if i+1 != P[i]:\n ...
['Wrong Answer', 'Accepted']
['s696004932', 's355421103']
[9020.0, 9168.0]
[26.0, 30.0]
[188, 183]
p02958
u813953440
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 i in range(N-1):\n if P[i]>P[i+1]:\n A.append([(P[i],i),(P[i+1],i+1)])\nl = len(A)\nif l > 2:\n print("NO")\nelif l ==1:\n print("NO")\nelif l == 0:\n print("YES")\nelse:\n a = max(A[0])\n b = min(A[1])\n P[a[1]],P[b[1]] = b...
['Wrong Answer', 'Accepted']
['s755178658', 's228896442']
[3064.0, 3064.0]
[17.0, 17.0]
[488, 451]
p02958
u813993459
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())\ns = list(map(int,input().split()))\na = np.array(list(range(1,n+1)))\nb = np.array(s)\nif len(a[a==b]) > n-2:\n print("YES")\nelse:\n print("NO")', 'import numpy as np\nn = int(input())\ns = list(map(int,input().split()))\na = np.array(list(range(1,n+1)))\nb = np.array(s)\n...
['Wrong Answer', 'Accepted']
['s994082444', 's143594701']
[12508.0, 12508.0]
[151.0, 152.0]
[181, 182]
p02958
u814265211
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 in range(1, N+1):\n if P[i] != i:\n cnt += 1\n \nprint('YES' if cnt == 2 else 'NO')", "N = int(input())\nP = list(map(int, input().split()))\n\ncnt = 0\nfor i in range(N):\n if P[i] != i + 1:\n cnt += 1\n\nprint('YES' i...
['Runtime Error', 'Accepted']
['s118913043', 's632498297']
[9112.0, 9092.0]
[25.0, 30.0]
[164, 167]
p02958
u818078165
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()))\nprint(n)\n\np2 = p.copy()\np2.sort()\n\np = np.asarray(p)\np2 = np.asarray(p2)\np3 = [p!=p2]\nc = np.count_nonzero(p3)\nif c == 2 or c == 0:\n print("YES")\nelse:\n print("NO")\n', 'import numpy as np\nn = int(input())\np = list(map(int,...
['Wrong Answer', 'Accepted']
['s203912689', 's818744135']
[14548.0, 21896.0]
[150.0, 332.0]
[243, 234]
p02958
u819407764
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())\nnew_s = sorted(s)\ncount = 0\n\nfor i in range(N):\n if s[i]-new_s[i]!=0:\n count += 1\n\nif count>2:\n print('NO')\nelse:\n print('YES')", "N = int(input())\ns = list(map(int, input().split()))\nnew_s = sorted(s)\ncount = 0\n\nfor i in range(N):\n...
['Runtime Error', 'Accepted']
['s246956552', 's980504367']
[3064.0, 3060.0]
[17.0, 17.0]
[195, 196]
p02958
u821590705
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())\n\nswap = 0\ndone = False\nok = True\nfor i in range(n):\n p = next(ps)\n if p != i+1:\n if done:\n ok = False\n break\n elif swap != 0:\n if swap == i+1:\n done = True\n swap = 0\n ...
['Wrong Answer', 'Accepted']
['s650381108', 's037862451']
[3060.0, 3064.0]
[17.0, 17.0]
[410, 446]
p02958
u821712904
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()]\nn1=[i for i in range(1,n+1)]\nfor i in n1:\n for k in n1:\n n1=n1.replace(i,k)\n if n1==p:\n print('YES')\n exit()\nelse:\n print('NO')\n \n ", "n=int(input())\np=[int(i) for i in input().split()]\nn1=[i for i in range(1,n+1)]\nfor i in range(n...
['Runtime Error', 'Accepted']
['s164082840', 's307485697']
[3060.0, 3060.0]
[18.0, 23.0]
[203, 254]
p02958
u821989875
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(int(i) for i in input().split())\ns = l.copy()\ns.sort()\n\nflag = False\nif s == l:\n flag = True\nelse:\n for i in range(n):\n for j in range(i+1, n):\n t = l.copy()\n t[i], t[j] = t[j], t[i]\n if s == t:\n flag = True\n\nif flag:\n print("Yes")\nelse:\n print...
['Wrong Answer', 'Accepted']
['s250904653', 's345173284']
[3064.0, 3064.0]
[18.0, 18.0]
[305, 305]
p02958
u825541307
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\nimport math\nfor i in range (math.ceil(N / 2)):\n\tif p[i] != i + 1:\n\t\tj = p.index(i + 1)\n\t\tp[i], p[j] = p[j], p[i]\n\t\tbreak\n\t\t\nprint(p)\n\t\t\nif p == [i for i in range(1, N + 1)]:\n\tprint('YES')\nelse:\n\tprint('NO')", "N = int(input())\np = list(...
['Wrong Answer', 'Accepted']
['s900386366', 's932883240']
[3060.0, 3060.0]
[18.0, 17.0]
[259, 219]
p02958
u829203929
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\nn = int(input())\np_list = list(map(int, input().split()))\n\ncount = 0\nfor i in range(n):\n if p_list[i] != (i+1):\n count += 1\n\nif count <= 2:\n print("Yes")\nelse:\n print("No")\n', '# coding: utf-8\nn = int(input())\np_list = list(map(int, input().split()))\n\ncount = 0\nfor i ...
['Wrong Answer', 'Accepted']
['s659840249', 's988065400']
[2940.0, 2940.0]
[17.0, 17.0]
[205, 205]
p02958
u829356061
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())\nre = 0\nB = list(map(int, input().split()))\nC = [i for i in range(1, A+1)]\nfor B, C in zip(B, C):\n if B != C:\n re += 1\n\nif re >= 2:\n print('NO')\nelse:\n print('YES')\n ", "A = int(input())\nre = 0\nB = list(map(int, input().split()))\nC = [i for i in range(1, A+1)]\nfor B, C in zip(B,...
['Wrong Answer', 'Accepted']
['s628824954', 's510582727']
[2940.0, 3060.0]
[17.0, 17.0]
[189, 189]
p02958
u830054172
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\ndic = {}\nfor i in range(n-1):\n a = p[i+1]-p[i]\n if a in dic and a != 1:\n dic[a] += 1\n elif a not in dic and a != 1:\n dic[a] = 1\n\nflag = False\nfor i in dic.values():\n if i == 2 and len(dic) == 2:\n flag = True\n b...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s079094870', 's439810090', 's845345842']
[3064.0, 3064.0, 3060.0]
[17.0, 17.0, 18.0]
[441, 426, 195]
p02958
u830162518
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=[]\nfor i in range(1,N+1):\n m.append(i)\nm.sort()\na=0\nfor j in range(N):\n if L[j]!=m[j]:\n a+=1\nif a<=2:\n print('Yes')\nelse:\n print('No')\n ", "N=int(input())\nL=list(map(int,input().split()))\nm=[]\nfor i in range(1,N+1):\n m.append(i)\nm.sort()\na...
['Wrong Answer', 'Accepted']
['s324010403', 's930195323']
[3060.0, 3060.0]
[18.0, 17.0]
[194, 194]
p02958
u834832056
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_arr = [input() for i in range(2)]\nN = input_arr[0]\np_arr = input_arr[1].split(\' \')\n\nfor i in range(len(p_arr)):\n k = 0\n if int(p_arr[i]) == i + 1:\n pass\n else:\n k += i\n\nif k < 2:\n print("YES")\nelse:\n print("NO")', 'input_arr = [input() for i in range(2)]\nN = input_a...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s041839219', 's063582807', 's385273182', 's842830566', 's859072630', 's880713365', 's052819574']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 17.0]
[246, 242, 254, 241, 241, 250, 243]
p02958
u835482198
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)\ncnt = 0\nfor a, b in p, sorted_p:\n if a != b:\n cnt += 1\nif cnt > 2:\n print("NO")\nelse:\n print("YES")\n', 'n = int(input())\np = list(map(int, input().split()))\nsorted_p = sorted(p)\ncnt = 0\nfor a, b in zip(p, sorted_p...
['Runtime Error', 'Accepted']
['s135206060', 's735276457']
[2940.0, 2940.0]
[17.0, 18.0]
[190, 195]
p02958
u839110000
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)\ncnt = 0\nfor i in range(n):\n if p[i] != q[i]:\n cnt += 1\nif cnt == 2 or cnt == 0:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\np = list(map(int, input().split()))\nq = sorted(p)\ncnt = 0\nfor i in range(n):\n if p[i...
['Wrong Answer', 'Accepted']
['s709086457', 's651713429']
[3060.0, 3060.0]
[17.0, 17.0]
[195, 195]
p02958
u840841119
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):\n ans += P[i] != i+1\n\nprint('No' if ans > 2 else 'Yes')", "N = int(input())\nP = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(N):\n ans += P[i] != i+1\n\nprint('NO' if ans > 2 else 'YES')"]
['Wrong Answer', 'Accepted']
['s717706980', 's116261581']
[9052.0, 9104.0]
[28.0, 27.0]
[139, 139]
p02958
u841021102
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()))\nanswer = 0\nfor i in range(n):\n if p[i] != (i + 1):\n \tanswer += 1\n \nif answer <= 2:\n print('Yes')\nelse:\n print('No')", "n = int(input())\np = list(map(int, input().split()))\nanswer = 0\nfor i in range(n):\n if p[i] + 1 != p[i + 1]:\n \tanswer += ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s039952350', 's251369470', 's288641522']
[9080.0, 9120.0, 9140.0]
[28.0, 24.0, 30.0]
[174, 183, 174]
p02958
u842388336
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())\nnum_list = list(map(int,input().split()))\n\ncnt = 0\nfor i in range(N):\n if num_list[i]!=i+1:\n cnt+=1\n if cnt>2:\n print("NO")\n break\n if i==N:\n print("YES")\n', 'N = int(input())\nnum_list = list(map(int,input().split()))\n \ncnt = 0\nfor i in range(N):\n if num_list[i]!=i+1:...
['Wrong Answer', 'Accepted']
['s841233941', 's051336493']
[2940.0, 3064.0]
[17.0, 17.0]
[187, 189]
p02958
u843318346
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\ncount = 0\nfor i in range(n):\n if arr[n]!=i+1:\n count += 1\n\nif count<=2:\n print('YES')\nelse:\n print('NO')", "n = int(input())\narr = list(map(int,input().split()))\n\ncount = 0\nfor i in range(n):\n if arr[i]!=i+1:\n count += 1\n\nif count<=2:...
['Runtime Error', 'Accepted']
['s781957722', 's494246491']
[2940.0, 2940.0]
[17.0, 18.0]
[165, 166]
p02958
u844895214
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\nfrom collections import deque\nimport numpy as np\nimport math\nsys.setrecursionlimit(10**6)\ndef S(): return sys.stdin.readline().rstrip()\ndef SL(): return map(str,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef IL(): return map(int,sys.stdin.readline().rs...
['Wrong Answer', 'Accepted']
['s934586699', 's340171954']
[27168.0, 9144.0]
[116.0, 28.0]
[576, 399]
p02958
u846652026
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()))\nll=sorted(l)\ncnt=0\nfor l1,l2 in zip(l,ll):\n if l1 != l2:\n cnt+=1\n \nprint("Yes" if cnt <= 2 else "No")', 'n=int(input())\nl=list(map(int,input().split()))\nll=sorted(l)\ncnt=0\nfor l1,l2 in zip(l,ll):\n if l1 != l2:\n cnt+=1\n \nprint("YES" if cnt <...
['Wrong Answer', 'Accepted']
['s063239548', 's561149442']
[2940.0, 2940.0]
[17.0, 17.0]
[156, 156]
p02958
u847165882
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(s) for s in input().split(" ")]\n\ncount=0\nfor i in range(N):\n if P[i]!=i+1:\n count+=1\n\nprint("Yes" if count==0 or count==2 else "No")', 'N=int(input())\nP=[int(s) for s in input().split(" ")]\n\ncount=0\nfor i in range(N):\n if P[i]!=i+1:\n count+=1\n\nprint("YES" if c...
['Wrong Answer', 'Accepted']
['s669247318', 's605727757']
[2940.0, 2940.0]
[17.0, 17.0]
[164, 164]
p02958
u847497464
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() ]\nls = [ _ for _ in range(1, n+1) ]\ncnt = int()\n\nfor i in range(n):\n if p[i] != ls[i]:\n cnt += 1\n print(cnt)\n \nif cnt == 2 or cnt == 0:\n print('YES')\nelse:\n print('NO')", "n = int(input())\np = [ int(_) for _ in input().spli...
['Wrong Answer', 'Accepted']
['s783916358', 's083705712']
[3060.0, 3060.0]
[17.0, 17.0]
[249, 230]
p02958
u847758719
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\nsort_p = sorted(p)\ndict_p = {}\nisOk = True\nfor i in range(N):\n if p[i] == sort_p[i]:\n continue\n elif len(dict_p) == 0:\n dict_p[sort_p[i]] = p[i]\n elif p[i] in dict_p:\n continue\n else:\n isOk = False\n bre...
['Wrong Answer', 'Accepted']
['s723416343', 's546120093']
[3064.0, 3064.0]
[17.0, 17.0]
[354, 354]
p02958
u850200768
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 = [i+1 for i in range(N)]\ncnt = len([_ for a, b in zip(p, ans) if a != b])\n\nif cnt == 2 or cnt == 0:\n print('YES')\nelse:\n print('NO')", "N = int(input())\np = list(map(int,input().split()))\n\nans = [i+1 for i in range(N)]\ncnt = len([a for a, b ...
['Runtime Error', 'Accepted']
['s643130411', 's787031968']
[3060.0, 3060.0]
[17.0, 17.0]
[196, 196]
p02958
u851279551
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\nSortedP = P.copy()\nSortedP.sort()\ncount=0\nfor i in range(N):\n if(P[i]!=SortedP[i]):\n count = count + 1\n if(count>2):\n print("NO")\n break\nelse:print("Yes")', 'N=int(input())\nP=list(map(int,input().split()))\n\nSortedP = P.copy()\n...
['Wrong Answer', 'Accepted']
['s640987984', 's268486516']
[3060.0, 3064.0]
[18.0, 17.0]
[230, 230]
p02958
u854685063
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(k) for k in input().split()]\ncnt = 0\nfor i in range(n):\n if a[i] != i+1:cnt += 1\nprint("YES" if k <= 2 else "NO")', 'n = int(input())\na = [int(k) for k in input().split()]\ncnt = 0\nfor i in range(n):\n if a[i] != i+1:cnt += 1\nprint("YES" if cnt <= 2 else "NO")\n']
['Runtime Error', 'Accepted']
['s652359779', 's618645385']
[2940.0, 2940.0]
[17.0, 17.0]
[140, 143]
p02958
u856169020
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()))\nnum = 0\nfor i in range(len(p)):\n if p[i] != i+1:\n num += 1\nif num < 2:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\np = list(map(int, input().split()))\nnum = 0\nfor i in range(len(p)):\n if p[i] != i+1:\n num += 1\nif num <= 2:\n print...
['Wrong Answer', 'Accepted']
['s107029131', 's579295589']
[2940.0, 2940.0]
[17.0, 17.0]
[162, 163]
p02958
u857070771
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...
["from copy import copy\nn=int(input())\n*a,=map(int,input().split())\nf=[i for i in range(1,n+1)]\nfor i in range(n):\n\tx=copy(a)\n\tfor j in range(i):\n\t\tx[i],x[j]= x[j],x[i]\n\t\tif x == f:\n\t\t\tprint('Yes')\n\t\t\texit(0)\nprint('No')\n", "n=int(input())\n*p,=map(int,input().split())\nwng=0\na=sorted(p)\nfor i...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s495224347', 's945392128', 's270743277']
[3572.0, 2940.0, 2940.0]
[22.0, 17.0, 17.0]
[219, 142, 142]
p02958
u857330600
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()))\ncount=0\nfor i in range(n):\n if l[i]!=i+1:\n count+=1\nif count<=2:\n print('Yes')\nelse:\n print('No')", "n=int(input())\nl=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n if l[i]!=i+1:\n count+=1\nif count<=2:\n print('YES')\nelse:\n print...
['Wrong Answer', 'Accepted']
['s943809755', 's437288872']
[2940.0, 2940.0]
[17.0, 18.0]
[151, 151]
p02958
u858670323
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(intput())\nA = list(map(int,input().split()))\nB = A.sorted()\ndif = 0\nfor i in range(n):\n if A[i]!=B[i]:\n dif+=1\nif dif==0 or dif==2:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\nA = list(map(int,input().split()))\nB = sorted(A)\ndif = 0\nfor i in range(n):\n if A[i]!=B[i]:\n dif+=1...
['Runtime Error', 'Accepted']
['s365478496', 's928186893']
[8964.0, 9152.0]
[25.0, 27.0]
[178, 176]
p02958
u859448927
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())\nlis = list(map(int,input().split()))\ncounter = 0\nfor i in N:\n if lis[i-1] - N != 0:\n counter += 1\nif counter > 2:\n print('NO')\nelse:\n print('YES')", "N = int(input())\nlis = list(map(int,input().split()))\ncounter = 0\nfor i in range(N):\n if lis[i] - i-1 != 0:\n counter += 1\nif c...
['Runtime Error', 'Accepted']
['s765913549', 's328671369']
[3060.0, 2940.0]
[17.0, 17.0]
[169, 177]
p02958
u859773831
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=[int(x) for x in input().split(\' \')]\narr2=sorted(arr)\nfor x in range(n):\n if x+1==arr[x]:\n continue\n else:\n swap(arr[x],arr[arr[x]-1])\n break\nif arr==arr2:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\narr=[int(x) for x in input().split(\' \')]\narr2=sorted(arr)\nfo...
['Runtime Error', 'Accepted']
['s054913293', 's898255444']
[3060.0, 3060.0]
[17.0, 17.0]
[220, 241]
p02958
u861274887
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()\nN = int(a)\np = list(map(int,input().split()))\n\ncount = 0\nfor i in range(N):\n if p[i] != i:\n count = count + 1\n if count == 3:\n break\nif count == 3:\n print('NO')\nelse:\n print('YES')\n", "a = input()\nN = int(a)\np = list(map(int,input().split()))\n\ncount = 0\nfor i i...
['Wrong Answer', 'Accepted']
['s484036853', 's100285719']
[9112.0, 9020.0]
[24.0, 31.0]
[219, 221]
p02958
u861886710
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(1, N+1):\n if i == p[i]:\n c += 1\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(1, N+1):\n if i == p[1]:\n c += 1\nif c == ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s650854376', 's763216235', 's926560839', 's167684382']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 17.0]
[175, 175, 177, 177]
p02958
u863370423
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 check(n, list1): \n new = [] \n for i in range(n): \n new.append(list1[i]) \n \n new.sort()\n swaps = 0\n for i in range(n): \n if list1[i] != new[i]: \n swaps += 1\n \n if swaps == 0 or swaps == 2: \n return True\n else: \n return ...
['Wrong Answer', 'Accepted']
['s088178208', 's759911031']
[9084.0, 9092.0]
[27.0, 29.0]
[467, 227]
p02958
u864013199
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()))\nr = list()\nfor k in range(n):\n r.append(k+1)\nif p == r:\n print("YES")\n exit()\nfor i in range(0,n-1):\n for j in range(i+1,n):\n q = copy.copy(p)\n q[j] = p[i]\n q[i] = p[j]\n print(q)\n if q == r:\n...
['Wrong Answer', 'Accepted']
['s602836936', 's402062652']
[3700.0, 3444.0]
[30.0, 24.0]
[358, 341]
p02958
u867604473
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()))\nans=list(range(N) + 1)\n\nans_mix=[]\nis_possible = False\nfor i in range(0, n-1):\n for j in range(1, n):\n a=ans.copy()\n tmp=a[i]\n a[i]=a[j]\n a[j]=tmp\n if a==p:\n is_possible = True\n \nif is_possible:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s505191461', 's897504060', 's780400313']
[3060.0, 3064.0, 3064.0]
[18.0, 17.0, 19.0]
[347, 368, 368]
p02958
u867826040
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()))\nsa = sorted(a)\nif a==sa:\n print("Yes")\nelse:\n for ai,si,i in zip(a,sa,range(n)):\n if ai!=si:\n a[ai-1],a[i]=a[i],a[ai-1]\n break\n if a==sa:\n print("Yes")\n else:\n print("No")', 'n = int(input())\na = list(map(int,input().split()))\ns...
['Wrong Answer', 'Accepted']
['s610087624', 's936958816']
[3060.0, 3064.0]
[18.0, 17.0]
[246, 246]
p02958
u868418093
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())\nnum_list = list(map(int,input()))\n\nsorted_num_list = sorted(num_list)\ncnt = 0\nfor i in range(len(num_list)):\n\tif num_list[i] != sorted_num_list[i]:\n\t\tcnt += 1\nif cnt < 3:\n\tprint("YES")\nelse:\n\tprint("NO")', 'n = int(input())\nnum_list = list(map(int,input().split()))\nsorted_num_list =...
['Runtime Error', 'Accepted']
['s478135772', 's699954874']
[3060.0, 3060.0]
[18.0, 17.0]
[220, 227]
p02958
u868600519
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 = list(map(int, input().split()))\nprint(p)\ncount = 0\nfor i in range(N):\n if p[i] != i + 1:\n count += 1\n\nif count <= 2:\n print('YES')\nelse:\n print('NO')", "N, *P = list(map(int, open(0).read().split()))\ncount = sum(p != i + 1 for i, p in enumerate(P))\n\nprint('YES' if count <= 2 else 'NO')"]
['Runtime Error', 'Accepted']
['s502383511', 's673777527']
[3064.0, 2940.0]
[17.0, 17.0]
[163, 133]
p02958
u870906509
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())) \np2 = sorted(p) \n\nif p == p2:\n print('YES')\nelse:\n for i in range(1,n-1):\n if p[i] == p2[n-i]:\n p3 = p.remove(p[i],p[n-1])\n p4 = sorted(p3)\n if p3 == p4:\n print('YES')\n else:\n...
['Runtime Error', 'Accepted']
['s343118043', 's820643801']
[3060.0, 3060.0]
[17.0, 17.0]
[369, 234]
p02958
u873839198
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(0, N - 1):\n if p[i + 1] != p[i] + 1:\n count += 1\n\nprint("No") if count > 2 else print("Yes")', 'N = int(input())\np = list(map(int, input().split()))\ncount = 0\nfor i in range(0, N):\n if p[i] != i + 1:\n count +...
['Wrong Answer', 'Accepted']
['s790862826', 's014040374']
[3060.0, 3060.0]
[17.0, 19.0]
[180, 169]
p02958
u881472317
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()))\nnu = [i for i in range(1, n + 1)]\nan = 0\nprint(nu)\nfor i in range(n):\n if p[i] != nu[i]:\n an += 1\n else:\n pass\nif an == 2:\n print("YES")\nelse:\n print("NO")\n', 'n = int(input())\np = list(map(int, input().split()))\nnu = [i fo...
['Wrong Answer', 'Accepted']
['s760900958', 's674676729']
[3060.0, 3060.0]
[17.0, 17.0]
[235, 236]
p02958
u882370611
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)\nc = 0\nfor i in range(n):\n if p[i] != q:\n c += 1\nprint('Yes' if c==2 else 'No')", "n=int(input())\np=list(map(int,input().split()))\nq=sorted(p)\nc = 0\nfor i in range(n):\n if p[i] != q:\n c += 1\nprint('Yes' if c<=2 else 'No')\n", "from heapq...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s159982259', 's481652104', 's544197709', 's102939720']
[3060.0, 2940.0, 3060.0, 2940.0]
[17.0, 17.0, 18.0, 18.0]
[142, 143, 215, 138]
p02958
u883203948
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\ndata = [int(s) for s in input().split()]\ncount = 0\nfor i in range(n):\n if (i+!)!= data[i]:\n count += 1\nif count<= 2:\n print("YES")\nelse:\n print("NO")\n \n \n"""\nmx = max(data)\nmn = min(data)\n\nif (mx == n-1 and mn == 0) or \n for i in range(1,n-1):\n if data[i] < data[i+1]...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s307273467', 's932026603', 's919236588']
[2940.0, 3064.0, 2940.0]
[17.0, 17.0, 17.0]
[367, 362, 367]
p02958
u883621917
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(sys.stdin.readline())\np = [int(i) for i in sys.stdin.readline().split()]\n\nif p == sorted(p):\n print('YES')\nelif: len(p) == 2:\n print('YES')\nelse:\n swap_index = []\n for i, v in enumerate(p[:-1]):\n if v > p[i + 1]:\n if len(swap_index) == 0:\n s...
['Runtime Error', 'Accepted']
['s158133564', 's012081430']
[2940.0, 3064.0]
[17.0, 17.0]
[606, 634]
p02958
u886571850
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\nq = sorted(p)\n\n\nfor i in range(n):\n if p[i] != q[i]:\n count += 1\n\nif count ==0 or count == 2:\n print('Yes')\nelse:\n print('No')", "n = int(input())\np = list(map(int,input().split()))\ncount = 0\nq = sorted(p)\n\n\nfor i in rang...
['Wrong Answer', 'Accepted']
['s374122653', 's701169926']
[3064.0, 2940.0]
[17.0, 18.0]
[204, 206]
p02958
u886907961
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 = list(map(int,input().split()))\nx = 0\nfor i in range(len(n)):\n if n[i]!=i+1:\n x+=1\n \nif(x==0 or x==2):print("yes")\nelse: print("no")\n', 'n = list(map(int,input().split()))\nx = 0\nfor i in range(len(n)):\n if n[i]!=i+1:\n x+=1\n \nif(x==0 or x==2):print("YES")\nelse: print...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s143080383', 's568231922', 's723151679', 's212305590']
[2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0, 18.0]
[153, 153, 153, 168]
p02958
u890461092
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...
["i = int(input())\nl = list(map(int, input().split()))\ns = sorted(l)\nf = 0\n\nif l == s:\n print('YES')\n exit()\n\nfor n in range(i-1):\n if l[n] == s[n]:\n continue\n else:\n f = f + 1\n continue\n\nif f == 2:\n print('YES')\nelse:\n print('NO')", "i = int(input())\nl = list(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s201256526', 's828066147', 's755490124']
[3060.0, 3064.0, 3060.0]
[17.0, 18.0, 17.0]
[268, 267, 255]
p02958
u891422384
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 = np.array(list(map(int, input().split())))\n\npp = np.array(sorted(p))-p\nsum_=0\nfor i in pp:\n if i!=0: sum_+=1\nif sum_>2: print('No')\nelse: print('Yes')", "import numpy as np\nn = int(input())\np = np.array(list(map(int, input().split())))\n\npp = np.array(sorted(p))-p\n...
['Wrong Answer', 'Accepted']
['s857123820', 's621999836']
[12500.0, 12500.0]
[148.0, 150.0]
[190, 190]
p02958
u892227843
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())\np=[int(i) for i in input().split()]\n\ndef judge():\n flag = 1\n for j in range(N-1):\n if p[j]>p[j+1]:\n flag = 0\n return flag\n\nif judge() == 0:\n temp_max = max(p)\n ind_max = p.index(max(p))\n ind_min = p.index(min(p))\n p[ind_max...
['Wrong Answer', 'Accepted']
['s090133485', 's224393563']
[3064.0, 3064.0]
[18.0, 18.0]
[395, 425]
p02958
u894312115
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())\nar=list(map(int,input().split()))\ncnt=0\nfor i in range(n):\n for j in range(i,n):\n if(ar[i]>ar[j]):\n cnt+=1\nif(cnt<=1):\n print("YES")\nelse:\n print("NO")\n', 'n=int(input())\nar=list(map(int,input().split()))\ndef srt(ar):\n return ar==sorted(ar)\nb=0\nif(srt(ar)):...
['Wrong Answer', 'Accepted']
['s028056305', 's201277408']
[2940.0, 3064.0]
[18.0, 22.0]
[194, 286]
p02958
u894381129
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 numpy as np\nimport sys\n\nn = int(input())\np = np.array(list(map(int, input().split())))\np_s = np.array(sort(p))\n\nif all(p==p_s):\n print("YES")\nelse:\n diff = p_s - p\n diff_index = np.where(diff!=0)\n #print(diff_index[0][1])\n if len(diff_index[0]) != 2:\n print("NO")\n el...
['Runtime Error', 'Accepted']
['s128298657', 's062007648']
[12504.0, 12504.0]
[150.0, 150.0]
[512, 511]
p02958
u895536501
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)\ncount=0\nfor i in range(N):\n if A[i]!=B[i]:\n count+=1\nif count<=2:\n print("Yes")\nelse:\n print("No")', 'N=int(input())\nA=list(map(int,input().split()))\nB=sorted(A)\ncount=0\nfor i in range(N):\n if A[i]!=B[i]:\n count+=1\n...
['Wrong Answer', 'Accepted']
['s973760134', 's741074551']
[2940.0, 3060.0]
[18.0, 17.0]
[174, 174]
p02958
u896847891
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()))\nfor i in range(n-1):\n if a[i]!=i+1:\n c+=1\nprint("YES" if c<3 else "NO")\n \n', 'n=int(input())\na=list(map(int,input().split()))\nc=0\nfor i in range(n-1):\n if a[i]>a[i+1]:\n c+=1\nprint("YES" if c<2 else "NO")', 'n=int(input())\na+=list(map(int,input()....
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s210840027', 's593808309', 's607796088', 's688042104', 's776509736', 's929970679', 's975159126']
[2940.0, 2940.0, 2940.0, 3064.0, 3064.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 18.0, 18.0, 17.0]
[128, 129, 132, 267, 248, 151, 150]
p02958
u899975427
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 = [int(i) for i in input().split()]\ncnt = 0\n\nfor i in range(1,n+1):\n if i != pn[i-1]:\n cnt += 1\nif cnt > 2:\n print('No')\nelse:\n print('Yes')", "n = int(input())\npn = [int(i) for i in input().split()]\ncnt = 0\n\nfor i in range(1,n+1):\n if i != pn[i-1]:\n cnt += 1\nif cnt == 2...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s109581064', 's739219999', 's562495344']
[3060.0, 2940.0, 2940.0]
[17.0, 20.0, 17.0]
[166, 167, 166]
p02958
u901447859
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,*x=map(int,open(0).read().split())\nsoreted_x=sorted(x)\ncnt=0\nfor a,b in zip(x,soreted_x):\n if a != b:\n cnt+=1\nprint('Yes' if cnt==2 else 'No')", "n,*x=map(int,open(0).read().split())\nsoreted_x=sorted(x)\ncnt=0\n\nfor a,b in zip(x,soreted_x):\n if a != b:\n cnt+=1\n\nprint('YES' if cnt<=2 else 'NO')"]
['Wrong Answer', 'Accepted']
['s573829521', 's726712540']
[3064.0, 3064.0]
[17.0, 18.0]
[148, 150]
p02958
u901598613
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()))\nlis=l.sorted()\nlis.reverse()\nans=0\nfor i ,j in zip(l,lis):\n if i!=j:\n ans+=1\nif ans==2:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\nl=list(map(int,input().split()))\nlis=sorted(l)\n\nans=0\nfor i ,j in zip(l,lis):\n \n if i!=j:\n ...
['Runtime Error', 'Accepted']
['s491412239', 's859922287']
[3060.0, 3060.0]
[17.0, 17.0]
[182, 174]
p02958
u904943473
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())\nlst = list(map(int, input().split()))\nlst2 = sorted(lst)\nsum = 0\nfor i in range(N):\n if (lst[i] != lst2[i]):\n sum += 1\nif (sum == 0 and sum == 2):\n print('YES')\nelse:\n print('NO')\n", "import copy\n\nN = int(input())\nlst = list(map(int, input().split()))\nlst2 = sorted...
['Wrong Answer', 'Accepted']
['s336135497', 's412155017']
[3572.0, 3444.0]
[29.0, 22.0]
[216, 215]
p02958
u906195369
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())\nb = a.sorted()\nc = list(filter(a[i]!=b[i], range(len(a)))\nprint('YES' if len(c)==2 else 'NO')", "n = int(input())\na = list(map(int, input().split()))\nb = sorted(a)\nc = list(filter(lambda i: a[i]!=b[i], range(n)))\nprint('YES' if len(c) in [0,2] else 'NO')"]
['Runtime Error', 'Accepted']
['s031211430', 's888115833']
[2940.0, 3060.0]
[17.0, 17.0]
[140, 157]
p02958
u907997483
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 = list(range(1, n+1, 1))\n\ncnt = 0\nfor i in range(n) : \n if P[i] != C[i] : \n cnt += 1\n\nif cnt == 0 or cnt == 2 : \n print("Yes")\nelse : \n print("No")', 'n = int(input())\nP = list(map(int, input().split()))\nC = list(range(1, n+1, 1))\n\...
['Wrong Answer', 'Accepted']
['s990593692', 's685537621']
[3060.0, 3060.0]
[18.0, 17.0]
[218, 218]
p02958
u911562010
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(j) for j in input().split()]\ns=range(n)\nx=0\n \nc=0\n\nfor a in range(n):\n if p[a]!=s[a]:\n c=c+1\n \n\nif c>2:\n print('NO')\n \nif c<=2:\n print('YES')", "n=int(input())\np=[int(j) for j in input().split()]\ns=range(n+1)\nx=0\n \nc=0\n\nfor a in range(n):\n if p[a]!=s[a+1]:\n ...
['Wrong Answer', 'Accepted']
['s497777629', 's454513214']
[9124.0, 9088.0]
[29.0, 28.0]
[172, 176]
p02958
u912318491
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 quicksort_count(arg):\n left = []\n right = []\n\n if len(arg)<=1:\n return arg\n\n p = random.choice(arg)\n p_count = 0\n \n for ele in arg:\n if ele < p:\n left.append(ele)\n elif ele > p:\n right.append(ele)\n else:\n p_count+=1\...
['Wrong Answer', 'Accepted']
['s438829284', 's733885556']
[4208.0, 2940.0]
[35.0, 17.0]
[584, 163]
p02958
u913662443
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().rstrip().split()))\npp = sorted(p)\ncnt = 0\nfor i in range(n):\n if p[i]!=pp[i]:\n cnt+=1\nif cnt>2:\n print("No")\nelse:\n print("Yes")', 'n = int(input())\np = list(map(int,input().rstrip().split()))\npp = sorted(p)\ncnt = 0\nfor i in range(n):\n if p[i...
['Wrong Answer', 'Accepted']
['s489463197', 's961176760']
[9144.0, 9168.0]
[30.0, 27.0]
[186, 186]
p02958
u914330401
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(li):\n count = 0\n for i in range(len(li)):\n if li[i] != i + 1:\n count += 1\n if count in [0,2]:\n return True\n else:\n return False\n \n \nif __name__ == '__main__':\n li = list(map(int, input().split()))\n if main(li):\n print('YES')\n else:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s022123847', 's649947870', 's255391182']
[3060.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[316, 325, 334]
p02958
u918935103
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 = count + 1\nif count == 2 or count == 0:\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] != i + 1:\n ...
['Wrong Answer', 'Accepted']
['s187249547', 's395888964']
[2940.0, 2940.0]
[18.0, 17.0]
[196, 196]
p02958
u920032768
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 = list(range(1,N+1))\ntmp = [i for i in range(N) if P[i] - p[i] != 0]\n\nif not tmp:\n print('YES')\nelif len(tmp) == 2:\n print(tmp)\n p[tmp[0]], p[tmp[1]] = p[tmp[1]], p[tmp[0]]\n tmp = [i for i in range(N) if P[i] - p[i] != 0]\n if tmp:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s312737969', 's325420755', 's844899934']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[373, 260, 331]
p02958
u920103253
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()]\n\nb=sorted(a)\n\nans=0\nfor i in range(n):\n if a[i]!=b[i]:\n ans+=1\nprint("Yes" if ans<=2 else "No")', '\ndef s0():return input()\ndef s1():return input().split()\ndef s2(n):return [input() for x in range(n)]\ndef s3(n):return [input().split() for _ in range(...
['Wrong Answer', 'Accepted']
['s039819587', 's418462417']
[2940.0, 3064.0]
[17.0, 18.0]
[150, 1045]
p02958
u921811474
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 = list(map(int, input().split()))\nt = sorted(l)\ncount = 0\nfor i in l:\n if l[i] == t[i]:\n count += 1\n\nif count == 3:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\nl = [list(map(int, input().split())) for _ in range(1)][0]\nt = sorted(l)\ncount = 0\nfor i in range(len(l)...
['Runtime Error', 'Accepted']
['s939757895', 's741131275']
[2940.0, 3064.0]
[17.0, 17.0]
[178, 236]
p02958
u926678805
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 check(a):\n for i in range(1,len(n)):\n if a[i-1]>a[i]:\n return False\n return True\nn=int(input())\na=list(map(int,input().split()))\nif check(a):\n print('YES')\n exit()\nfor i in range(n):\n for j in range(n):\n if i==j:\n continue\n a[i],a[j]=a[j],a[i]\n if check(a):\n print('...
['Runtime Error', 'Accepted']
['s904254567', 's933298960']
[3064.0, 3064.0]
[25.0, 19.0]
[356, 356]
p02958
u927530154
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()\np = [int(x) for x in input().split()]\n\np_sorted = p.sorted()\n\ndiff = 0\nfor p_elem, p_sorted_elem in zip(p, p_sorted):\n \tif p_elem !+ p_sorted_elem:\n \tdiff += 1\n\nif diff == 0 or diff == 2:\n \tprint('YES')\nelse:\n \tprint('NO')", " input()\n p = [int(x) for x in input().split()]\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s055367917', 's716065613', 's756464466']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0]
[238, 538, 254]
p02958
u931394483
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()))\nm = list(range(1,n+1))\ncount = 0\nfor i in range(n):\n if p[i] != m[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()))\nm = list(range(1,n+1))\ncount = 0\nfor ...
['Wrong Answer', 'Accepted']
['s505798199', 's554451011']
[3060.0, 3060.0]
[17.0, 17.0]
[211, 211]