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
u222668979
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nmax_p=p[0]\ncnt=0\nfor i in range(n):\n if p[i]!= i+1:\n cnt+=2\nif cnt>2:\n print('NO')\nelse :\n print('YES')\n", "n=int(input())\np=list(map(int,input().split()))\nmax_p=p[0]\ncnt=0\nfor i in range(n):\n if p[i]!= i+1:\n cnt+=1\nif cnt>2:\...
['Wrong Answer', 'Accepted']
['s983679403', 's815513291']
[2940.0, 2940.0]
[17.0, 17.0]
[168, 168]
p02958
u222801992
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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:\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("YES")\nelse:\n print("NO")']
['Wrong Answer', 'Accepted']
['s623223322', 's090984115']
[3060.0, 2940.0]
[17.0, 17.0]
[143, 145]
p02958
u223555291
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nimport sys\na=list(input())\nb=a\nb.sort()\nc=0\nfor i in range(N):\n if a[i]!=b[i]:\n c+=1\n if c>=2:\n d='No'\n sys.exit()\nprint('Yes')\n\n ", "N=int(input())\np=list(map(int,input().split()))\n\na=sorted(p)\nb=0\n\nimport sys\nfor i in range(N):\n if p[i]!=a[i]:\n b+=1\...
['Wrong Answer', 'Accepted']
['s004136363', 's872634680']
[2940.0, 3060.0]
[17.0, 17.0]
[163, 204]
p02958
u223904637
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\n\ndef shou(a):\n for i in range(len(a)-1):\n if a[i]>a[i+1]:\n \treturn -1\n return 1\n\nf=0\nfor i in range(n):\n for j in range(i):\n \ttmp=a[i]\n a[i]=a[j]\n a[j]=tmp\n if shou(a)==1:\n f=1\n tmp=...
['Runtime Error', 'Runtime Error', 'Accepted']
['s506733354', 's648862149', 's632488595']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 20.0]
[403, 404, 393]
p02958
u224119985
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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="No"\nm=0\nfor i in range(n-1):\n if p[i]<p[i+1]:\n ans="Yes"\n break\n else:\n for j in range(i+1,n):\n if p[i]>p[j]:\n m=p[i]\n p[i]=p[j]\n p[j]=m\n for k in range(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s042373503', 's164243544', 's970034595']
[3064.0, 3064.0, 3060.0]
[18.0, 18.0, 17.0]
[420, 420, 175]
p02958
u224554402
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["a = int(input())\nb = input().split()\ncount=0\nfor i in range(a):\n if int(b[i]) is not i + 1:\n count += 1\nif count == 0 or count == 2:\n print('Yes')\nelse:\n print('No')", "a = int(input())\nb = input().split()\ncount=0\nfor i in range(a):\n if int(b[i]) is not i + 1:\n count += 1\nif c...
['Wrong Answer', 'Accepted']
['s014348521', 's027970855']
[3060.0, 2940.0]
[17.0, 17.0]
[181, 181]
p02958
u225388820
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nask=0\nfor x in range(0,N):\n if A[x]!=N-x:\n ask=ask+1\nif ask==0 or ask==2:\n print('Yes')\nelse:\n print('No')\n", "N = int(input())\nA=list(map(int,input().split()))\nask=0\nfor x in range(0,N):\n if A[x]!=x+1:\n ask=ask+1\nif ask==0 or...
['Wrong Answer', 'Accepted']
['s717355154', 's561531485']
[2940.0, 2940.0]
[17.0, 17.0]
[173, 173]
p02958
u226191225
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nA = 0\nfor i in range (N):\n if s[i] != i+1:\n A+=1\n print(A)\nif A <= 2 :\n print('YES')\nelse:\n print('NO')", "N = int(input()) \ns = list(map(int, input().split()))\nA = 0\nfor i in range (N - 1):\n if s[i] == i:\n continue\n else:\n A+=1\n...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s316893143', 's829520558', 's969941774', 's338006912']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[166, 178, 172, 153]
p02958
u226233437
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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(N):\n if(p[i]!=i+1):\n num+=1\nif(num>2):\n print("No")\nelse:\n print("Yes")', 'N = int(input())\np = list(map(int,input().split()))\nnum = 0\nfor i in range(N):\n if(p[i]!=i+1):\n num+=1\nif(num>2):\n print("NO")\nelse:\n prin...
['Wrong Answer', 'Accepted']
['s680166550', 's372689225']
[2940.0, 2940.0]
[17.0, 17.0]
[152, 152]
p02958
u226912938
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 n in range(N-1):\n if P[n] > max(P[n+1:]):\n ans += 1\n\nif ans == 0 or ans == 1:\n print('YES')\nelse:\n print('NO')", "N = int(input())\nP = list(map(int, input().split()))\n\nans = 0\n\nfor n in range(N):\n if P[n] != n + 1:...
['Wrong Answer', 'Accepted']
['s121184595', 's513874744']
[3060.0, 2940.0]
[17.0, 17.0]
[193, 185]
p02958
u230416699
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\n\nN = int(input())\nP = list(map(int, input().split()))\nP = np.array(P)\n\nflip = np.sum(P==np.arange(1, 1+N))\nif flip<=2:\n print('YES')\nelse:\n print('NO')", "import numpy as np\n\nN = int(input())\nP = list(map(int, input().split()))\nP = np.array(P)\n\nflip = np.sum(P==np.arange(1, 1+...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s378486907', 's872349921', 's072482043']
[20860.0, 12488.0, 20372.0]
[313.0, 149.0, 317.0]
[176, 176, 176]
p02958
u231685196
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\n\n\nn = int(input())\narr = list(map(int,input().split()))\nbase = [i+1 for i in range(n)]\n\ncount = 0\nfor i in range(n):\n if arr[i] != base[i]:\n count += 1\n\nif count <= 2:\n print("Yes")\nelse:\n print("No")\n', 'import numpy as np\n\nn = int(input())\narr = list(map(int, in...
['Wrong Answer', 'Accepted']
['s860521755', 's155347355']
[22404.0, 21648.0]
[333.0, 308.0]
[236, 237]
p02958
u233437481
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()]\nindex = []\nfor i in range(N):\n index.append(P.index(i+1))\ncount = 0\nfor i, j in enumerate(index):\n if i != j:\n count += 1\nif count > 2:\n print("No")\nelse:\n print("Yes")\n', 'N = int(input())\nP = [int(s) for s in input().split()]\ni...
['Wrong Answer', 'Accepted']
['s425710803', 's216151506']
[9076.0, 9080.0]
[25.0, 27.0]
[243, 243]
p02958
u234582237
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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-1):\n if p[i]!=i+1\n count=count+1\nif count<2:\n print('YES')\nelse:\n print('NO')", 'n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nanswer=0\nfor i in range(n):\n if a[i]>=b[i]:\n answer+=b[i...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s126632063', 's438359158', 's670791380', 's926094747', 's564038220']
[2940.0, 3064.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[158, 380, 218, 159, 159]
p02958
u237316771
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()]\nq = sorted(p)\nd = [(pi, qi) for pi, qi in zip(p, q) if pi != qi]\nprint("YES" if len(d) == 0 or len(d) == 2 and d[0][0] == d[1][1] and d[1][0] == d[0][1] else "NO")', 'input()\np = [int(x) for x in input().split()]\nq = sorted(p)\nd = [(pi, qi) for pi, qi in zip(p, q) if pi !=...
['Runtime Error', 'Accepted']
['s910428223', 's740209873']
[3060.0, 3060.0]
[18.0, 17.0]
[201, 209]
p02958
u238084414
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nP = list(input(). split())\nQ = sorted(P)\ncnt = 0\ni = 0\n\nwhile cnt <= 2 and i < len(P):\n if Q[i] != P[i]:\n cnt += 1\n i += 1\n\nprint(cnt)\nif cnt <= 2:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\nP = list(map(int, input(). split()))\nQ = sorted(P)\ncnt = 0\ni = 0\n\nwhile ...
['Wrong Answer', 'Accepted']
['s111293288', 's138810478']
[3060.0, 3064.0]
[17.0, 19.0]
[204, 203]
p02958
u238956837
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 k,v in enumerate(p):\n if k+1 != v:\n cnt += 1\n\nif cnt > 1:\n print('NO')\nelse:\n print('YES')", "n = int(input())\np = list(map(int, input().split()))\nsort = sorted(p)\n\ncnt = 0\nfor i in range(n-1):\n if p[i]+1 != p[i+1]:\n cnt += ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s057501854', 's140449683', 's798413257']
[3064.0, 3060.0, 3060.0]
[19.0, 17.0, 17.0]
[162, 183, 162]
p02958
u241159583
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = "YES"\ncnt = 0\nfor i in range(n):\n if p[i] != i+1:\n if p[p[i]-1] == i+1:\n if cnt == 0:\n cnt += 1\n else:\n ans = "NO"\n break\n else: \n ans = "NO"\n ...
['Wrong Answer', 'Accepted']
['s205190030', 's406140351']
[9112.0, 9200.0]
[27.0, 28.0]
[325, 322]
p02958
u245960901
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\n\ns = input().split()\nN=int(s[0])\ns = input().split()\na=np.array(range(1,N+1))\ns=[int(i) for i in s]\nif np.count_nonzero(a != s)<2:\n print('YES')\nelse:\n print('NO')", "import numpy as np\n\ns = input().split()\nN=int(s[0])\ns = input().split()\na=np.array(range(1,N+1))\ns=[int(i) for...
['Wrong Answer', 'Accepted']
['s890163883', 's936304979']
[21156.0, 21176.0]
[326.0, 307.0]
[188, 189]
p02958
u246975555
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nl_s = sorted(l)\na = 0\nfor i in range(n):\n if l[i] == l_s[i]:\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()))\nl_s = sorted(l)\na = 0\nfor i in range(n):\n if not l[i] == l_s[i]:\n...
['Wrong Answer', 'Accepted']
['s517474321', 's667326796']
[3060.0, 3060.0]
[18.0, 17.0]
[180, 184]
p02958
u249218227
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nli = list(map(int, input().split()))\ntmp = list()\nans = 'Yes'\nfor i in range(1, N):\n if li[i-1] > li[i]:\n tmp.append(li[i-1])\nif len(tmp) != 2:\n ans == 'No'\nelse:\n t = li[li.index(tmp[0])]\n li[li.index(tmp[0])] = li[li.index(tmp[1])+1]\n li[li.index(tmp[1])+1] = t\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s264373346', 's729915638', 's766661743']
[3064.0, 3064.0, 3060.0]
[17.0, 20.0, 17.0]
[389, 377, 181]
p02958
u252828980
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nli = [x+1 for x in range(n)]\ncnt = 0\nfor i in range(n):\n if L[i] != li[i]:\n cnt +=1\nprint("Yes" if (cnt == 2 or cnt == 0) else "No")', 'n = int(input())\nL = list(map(int,input().split()))\nli = [x+1 for x in range(n)]\n\ncnt = 0\nfor i in range(n):...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s098504276', 's640016214', 's267182319']
[3060.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0]
[194, 213, 194]
p02958
u254871849
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['# 2019-11-15 14:37:47(JST)\nimport sys\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float...
['Wrong Answer', 'Accepted']
['s859572245', 's077221310']
[2940.0, 2940.0]
[17.0, 17.0]
[643, 280]
p02958
u263734237
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\nv = sorted(p)\ncou=0\nfor i in range(n):\n if not p[i] == v[i]:\n cou+=1\n\nif cou <= 2:\n print("YES")\nelse:\n print("NO")', "p = map(int, '1 2 3 4 5 6 7'.split())\nv = sorted(p)\ncou=0\nif p==v:\n cou =2\nelse:\n for i in range(len(p)):\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s216863155', 's261306027', 's294133274', 's369645598', 's383406885', 's455739462', 's766708083', 's823584637', 's954765929', 's955675784', 's729934574']
[3060.0, 2940.0, 3064.0, 2940.0, 3060.0, 3060.0, 3060.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 18.0, 17.0, 18.0]
[183, 232, 179, 183, 225, 225, 187, 239, 183, 227, 185]
p02958
u264508862
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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,list(open(0))[1].split()))\nm=sorted(n)\na=b=0\nfor _ in range(len(n)):a+=0if n[_]==m[_]else 1\nb=1if a>2else 0\nprint('YNeos'[b::2])", "n=list(map(int,list(open(0))[1].split()))\nm=sorted(n)\na=b=0\nfor _ in range(len(n)):a+=0if n[_]==m[_]else 1\nb=1if a>2else 0\nprint('YNEOS'[b::2])"]
['Wrong Answer', 'Accepted']
['s948362665', 's090930873']
[3060.0, 3060.0]
[17.0, 17.0]
[143, 143]
p02958
u265118937
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 bubble(input_list):\n cnt = 0\n flg = 0\n for i in range(len(input_list)):\n if i != input_list[i]:\n cnt +=1\n flg = 1\n if flg == 1:\n return False, cnt\n else:\n return True, 0\na, b = bubble(p)\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s566885540', 's597167082', 's708739239']
[9184.0, 9216.0, 9124.0]
[24.0, 30.0, 29.0]
[354, 474, 355]
p02958
u267222408
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\np = list(map(int, input().split()))\ncount = 0\n#print(p)\n\nq = sorted(p)\n#print(q)\n\nfor i in range(N):\n if p[i] != q[i]:\n count += 1\n \nif count <= 1:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\np = list(map(int, input().split()))\ncount = 0\n#print(p)\n\nq = sorted(p)\...
['Wrong Answer', 'Accepted']
['s082098785', 's943129697']
[2940.0, 3060.0]
[17.0, 17.0]
[206, 206]
p02958
u273242084
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\nans = "Yes"\nfor i in range(n-1):\n if p[i]+1 != p[i+1]:\n cnt += 1\nif cnt >2:\n ans = "No"\nprint(ans)', 'n = int(input())\np = list(map(int,input().split()))\ncnt = 0\nfor i in range(n):\n if p[i] != i+1:\n cnt +=1\nif cnt > 2:\n ...
['Wrong Answer', 'Accepted']
['s817587215', 's626657011']
[9144.0, 9100.0]
[24.0, 29.0]
[171, 173]
p02958
u276204978
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = input()\n\nn = 0\nfor i in range(N):\n if L[i] > L[i+1]:\n n += 1\n\nif n == 1 or n == 0:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\nL = input()\n\nn = 0\nfor i in range(N):\n if L[i] > L[i+1]:\n n += 1\n\nif n == 2 or n == 0:\n print("YES")\nelse:\n print("NO")', 'n = ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s212310936', 's952234006', 's487533024']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[142, 142, 183]
p02958
u276686572
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\narr = list(map(int, input().split()))\n\narr2 = sorted(arr)\n\ncount = 0 \n\nfor i in range(0,n):\n if arr[i] != arr2[i]: count += 1\nif count <= 2: print("Yes")\nelse: print("No")\n', 'n = int(input())\n\narr = list(map(int, input().split()))\n\narr2 = sorted(arr)\n\ncount = 0 \n\nfor i in range...
['Wrong Answer', 'Accepted']
['s075403951', 's581189951']
[9176.0, 9116.0]
[23.0, 29.0]
[191, 191]
p02958
u277353449
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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=input().split()\nfor i in range (0,N):\n a[i]=int(a[i])\ncount=0\nfor i in range(0,N):\n if a[i]!=i+1:\n count=count+1\nif count==2:\n print('Yes')\nelif count==0:\n print('Yes')\nelse:\n print('No')", "N=int(input())\na=input().split()\nfor i in range (0,N):\n a[i]=int(a[i])\ncount=0\nfor ...
['Wrong Answer', 'Accepted']
['s920013846', 's072210669']
[3064.0, 3060.0]
[17.0, 17.0]
[212, 212]
p02958
u278057806
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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)\nk = 0\nfor i in range(1, N + 1):\n if p[i] - q[i] != 0:\n k += 1\n\nif k > 2:\n print("NO")\nelse:\n print("YES")\n', 'N = int(input())\np = list(map(int, input().split()))\nq = sorted(p)\nk = 0\nfor i in range(1, N + 1):\n if p[...
['Runtime Error', 'Runtime Error', 'Accepted']
['s083953128', 's681062687', 's635213471']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[189, 189, 182]
p02958
u278855471
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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)\nflg = False\nfor i in range(N - 1):\n for j in range(i, N):\n temp_p = p.copy()\n temp = temp_p[i]\n temp_p[i] = temp_p[j]\n temp_p[j] = temp\n if temp_p == sorted_p:\n print('Yes')\n ...
['Wrong Answer', 'Accepted']
['s021961560', 's609062696']
[9072.0, 9124.0]
[25.0, 25.0]
[386, 386]
p02958
u281303342
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['# Python3 (3.4.3)\nimport sys\ninput = sys.stdin.readline\n\n# -------------------------------------------------------------\n# function\n# -------------------------------------------------------------\n\n\n# -------------------------------------------------------------\n# main\n# ------------------------------------...
['Wrong Answer', 'Accepted']
['s178584189', 's488226929']
[3060.0, 3060.0]
[17.0, 17.0]
[545, 544]
p02958
u283520984
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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(input()) for i in range(N)]\nq=[]\ncnt=0\nfor i in range(N):\n q.append(i+1)\nfor i in range(N):\n if p[i]==q[i]:\n cnt=cnt\n else:\n cnt=cnt+1\nif cnt==2:\n print('YES')\nelse:\n print('NO')", "N = int(input())\np = list(map(int, input().split()))\nq=[]\ncnt=0\nfor i in range(N)...
['Runtime Error', 'Accepted']
['s630342028', 's709713415']
[3064.0, 3064.0]
[18.0, 18.0]
[215, 224]
p02958
u283751459
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\nsort_p = sorted(p)\n\nfor i in range(n):\n if p[i] != sort_p[i]:\n count += 1\n \nif count == 2:\n print("Yes")\n exit()\nelif count == 0:\n print("Yes")\n exit()\nelse:\n print("No")\n exit()', 'n = int(input())\np = list(map(int,input(...
['Wrong Answer', 'Accepted']
['s219549015', 's523468647']
[9192.0, 9176.0]
[31.0, 32.0]
[255, 256]
p02958
u289288647
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import sys\nN = int(input())\np = list(map(int, input().split()))\nq = sorted(p)\n\ncount = 0\nfor i, j in zip(p, q):\n if i != j:\n count += 1\n if count > 2:\n print("No")\n sys.exit()\nprint("Yes")\n\n\n', 'import sys\nN = int(input())\np = list(map(int, input().split()))\nq ...
['Wrong Answer', 'Accepted']
['s952043792', 's112835964']
[3064.0, 2940.0]
[17.0, 17.0]
[230, 230]
p02958
u294385082
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = list(range(1,n+1))\nfor i in N:\n if N[i-1] != p[i-1]:\n break\nif N[i-1] == p[N[i-1]]:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\np = list(map(int,input().split()))\nN = list(range(1,n+1))\nfor i in N:\n if N[i-1] != p[i-1]:\n break\ni...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s073974682', 's191891722', 's612257801', 's811261691']
[3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[178, 178, 188, 187]
p02958
u296518383
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input()) \nc=list(map(int, input().split())) \nd=[i for i in range(1,n+1)]\nf=0\nfor i in range(n):\n if d[i]-d[i]:\n f+=1\nif f == 0 or f == 2:\n print("YES")\nelse:\n print("NO)', 'n=int(input()) \n#n= 5 \nc=list(map(int, input().split())) \n#c=[5, 2, 3, 4, 1]\nd=[i for i in range(1,n+1)]...
['Runtime Error', 'Accepted']
['s407217940', 's917195965']
[3060.0, 3060.0]
[17.0, 17.0]
[318, 401]
p02958
u298945776
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import copy\n\nN = int(input())\nP = list(map(int, input().split()))\nX = copy.copy(P)\nY = copy.copy(P)\nX.sort()\n\ndef f(P):\n for i in range(N):\n for j in range(N):\n P = copy.copy(Y)\n P[i],P[j] = P[j],P[i]\n\n if X == P:\n return "Yes"\n return "NO"\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s054699481', 's402810331', 's409297295', 's992741574', 's944331472']
[3700.0, 3444.0, 3444.0, 3444.0, 3444.0]
[29.0, 25.0, 27.0, 24.0, 28.0]
[324, 260, 337, 324, 337]
p02958
u300109915
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = [int(i) for i in input().split()]\nscore == 0\nfor i in range(N):\n if list[i] != i+1:\n score =+ 1\nif score == 0 or 2:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\nlist = [int(i) for i in input().split()]\nscore == 0\nfor i in range(N):\n if list[i] != i+1:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s116684299', 's368091293', 's794885583']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[188, 188, 181]
p02958
u305732215
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np_list = input().split()\n\ncount = 0\n\nfor i in range(n):\n if i+1 != int(p_list[i]):\n count = count + 1\n\nprint(count)\nif count <= 2:\n print('YES')\nelse:\n print('NO')\n", "n = int(input())\np_list = input().split()\n\ncount = 0\n\nfor i in range(n):\n if i+1 != p_list[i]:...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s069474445', 's848638943', 's250399926']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[197, 179, 184]
p02958
u306033313
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = []\nl = input().split()\nl = list(map(int,l))\n\nlist_up = []\nfor i in range(1,n+1):\n list_up += [i]\nprint(list_up)\nx = 0\nfor i in range(n):\n if l[i] != list_up[i]:\n x += 1\nprint(list_up)\nif x == 0 or x == 2:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\nl ...
['Wrong Answer', 'Accepted']
['s965673145', 's563928603']
[3064.0, 3064.0]
[17.0, 17.0]
[277, 249]
p02958
u306060982
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = [i for i in map(int,input().split())]\n#print(p_list)\na_list = p_list.copy()\nb_list = p_list.copy()\n#print(a_list)\na_list.sort()\nb_list.sort()\n#print(a_list)\nif p_list == a_list:\n print('YES')\n exit()\nmax = p_list.index(max(p_list))\nmin = p_list.index(min(p_list))\nx = p_list[mi...
['Wrong Answer', 'Accepted']
['s710804740', 's347819033']
[3064.0, 3060.0]
[17.0, 18.0]
[404, 197]
p02958
u309039873
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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_s = list(map(int,input().split()))\ncnt = 0\nfor i,p in enumerate(p_s):\n \tif i+1 != p:\n \tcnt += 1\n if cnt > 2:\n \tbreak\nelse:\n \tprint("YES")\nprint("NO")', 'import sys\nN = int(input())\np_s = list(map(int,input().split()))\ncnt = 0\nfor i,p in enumerate(p_s):\n if i+1 !...
['Runtime Error', 'Accepted']
['s418698424', 's931424837']
[2940.0, 2940.0]
[17.0, 17.0]
[183, 214]
p02958
u309120194
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\n\nN = int(input())\np = list(map(int, input().split()))\n\nq = sorted(p)\np, q = np.array(p), np.array(q)\n\nif np.sum(p != q) <= 1: print('YES')\nelse: print('NO')", "N = int(input())\np = list(map(int, input().split()))\n\n\n\n\n\n\n\nq = list(range(1, N+1))\n\nk = 0\nfor i in range(N):\n if p[...
['Wrong Answer', 'Accepted']
['s426352319', 's785049299']
[27196.0, 9080.0]
[117.0, 29.0]
[175, 484]
p02958
u309141201
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nmiss = 0\nfor i in range(n):\n if i+1 != p[i]:\n miss += 1\n\nif miss > 3:\n print('No')\nelse:\n print('Yes')", "n = int(input())\np = list(map(int, input().split()))\nmiss = 0\nfor i in range(n):\n if i+1 != p[i]:\n miss += 1\n\nif mis...
['Wrong Answer', 'Accepted']
['s752693116', 's058093730']
[2940.0, 2940.0]
[18.0, 17.0]
[171, 171]
p02958
u317508154
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(map(int,input().split()))\ncount = 0\nfor i in range(n):\n if p[i] != i + 1:\n count += 1\nif count == 0 or count == 2:\n print('Yes')\nelse:\n print('No')", "n = int(input())\np = list(map(int,input().split()))\ncount = 0\nfor i in range(n):\n if p[i] != i + 1:\n ...
['Wrong Answer', 'Accepted']
['s767742375', 's053589971']
[9136.0, 9084.0]
[27.0, 30.0]
[189, 189]
p02958
u317779196
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()]\nans = 'YES'\nk = 0\nfor i in range(n):\n if p[i] != i + 1:\n if k == 1:\n ans = 'NO'\n break\n else:\n if p[p[i] - 1] == i + 1: \n k = 1\n else:\n ans = 'NO'\n ...
['Wrong Answer', 'Accepted']
['s433717811', 's136656306']
[3060.0, 3064.0]
[17.0, 17.0]
[329, 393]
p02958
u318042557
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\n\nN = int(input())\np = list(map(int, input().split()))\nsort_p = sorted(p)\nif p == sort_p:\n print('Yes')\nelse:\n p = np.array(p)\n sort_p = np.array(sort_p)\n index = np.where(p != sort_p)\n if len(p[index]) == 2:\n p[index[0][0]],p[index[0][1]] = p[index[0][1]],p[index[0...
['Wrong Answer', 'Accepted']
['s412195962', 's799535957']
[14420.0, 12500.0]
[149.0, 149.0]
[479, 478]
p02958
u323045245
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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(map(int, input().split()))\nnum_sort = sorted(num)\nflug = 0\nfor i in range(n):\n if num[i] == num_sort[i]:\n continue\n else:\n flug += 1\n if flug <= 2:\n continue\n else:\n print("No")\n exit()\nprint("Yes")', 'n = int(input())\nnum = list(map(int, input()...
['Wrong Answer', 'Accepted']
['s246115275', 's884417758']
[3060.0, 3060.0]
[17.0, 17.0]
[255, 255]
p02958
u327532412
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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*P, = map(int, input().split())\na = 0\nfor i in range(N):\n if P[i] != i + 1:\n a += 1\nif a < 2:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\n*P, = map(int, input().split())\na = 0\nfor i in range(N):\n if P[i] != i + 1:\n a += 1\nif a < 1:\n print("YES")\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s114156579', 's484179267', 's606096191']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[159, 159, 160]
p02958
u328510800
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\ns = list(map(int, input().split()))\n\ncount = 0\nfor i in range(n-1):\n if s[i] > s[i+1]:\n count += 1\n\nprint("YES" if count < 2 else "NO")', 'n = int(input())\ns = map(int, input().split())\n\ncount = 0\nfor i in range(n-1):\n if s[i] > s[i+1]:\n count += 1\n\nprint("YES" if count < 3 el...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s218588454', 's230746944', 's751668596', 's610910570']
[3060.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0, 17.0]
[156, 150, 142, 150]
p02958
u329143273
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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_s = sorted(p)\ncnt = 0\nfor i in range(n):\n if p[i] != p_s[i]:\n cnt += 1\nif cnt > 2:\n print('No')\nelse:\n print('Yes')", "n=int(input())\np=list(map(int,input().split()))\np_sort=sorted(p)\ncnt=0\nfor i in range(n):\n if p[i]!=p_sort[i]:\n cnt+=1\...
['Wrong Answer', 'Accepted']
['s617397188', 's431379195']
[3060.0, 3060.0]
[17.0, 17.0]
[175, 182]
p02958
u330799501
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\n\n\nma= max(List)\nmi = min(List)\n\nmaIndex=List.index(ma)\nmiIndex=List.index(mi)\nList[maIndex] = mi\nList[miIndex] = ma\n\nList2=sorted(List)\n\n\nif (List != List2):\n print("No")\nelse:\n print("Yes")\n\n\n\n\n', '#k = int(input())\n#s = input()\n#a, b ...
['Wrong Answer', 'Accepted']
['s388449459', 's928696271']
[3060.0, 9116.0]
[17.0, 28.0]
[364, 326]
p02958
u331997680
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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-1):\n if i+1 == P[i]:\n continue\n elif i+1 != P[i] and P[P[i]] == i+1:\n cnt = 1\n elif cnt == 0:\n print('NO')\n cnt = 2\n break\nprint('YES' if cnt!=2)", " = int(input())\nP = list(map(int, input().split()))\ncnt = 0...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s191921683', 's356951600', 's555520632', 's555661629', 's388183692']
[3064.0, 2940.0, 2940.0, 3064.0, 2940.0]
[17.0, 17.0, 18.0, 18.0, 18.0]
[241, 244, 141, 244, 143]
p02958
u333404917
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()]\ncnt = 0\nfor i in range(len(a)):\n if a == sorted(a):\n break\n for j in range(len(a)-1, i, -1):\n if a[j] < a[j-1]:\n a[j], a[j-1] = a[j-1], a[j]\n cnt += 1\n\nprint("YES" if cnt < 2 else "NO")', 'n = int(input())\na = [int(x)...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s427846659', 's719766304', 's277067994']
[3064.0, 3064.0, 2940.0]
[18.0, 17.0, 17.0]
[274, 278, 151]
p02958
u333731247
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N=int(input())\np=list(map(int,input().split()))\n\nP=sorted(p)\nprint(p)\nprint(P)\nflag=0\n\nfor i in range(0,N):\n if p[i]!=P[i]:\n flag+=1\n\nif (flag==2)or(flag==0):\n print('YES')\nelse :\n print('NO')", "N=int(input())\np=list(map(int,input().split()))\n\nP=sorted(p)\nprint(p)\nprint(P)\nflag=0...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s316633733', 's627333014', 's921299771', 's095454879']
[3064.0, 3064.0, 3064.0, 3060.0]
[17.0, 18.0, 17.0, 20.0]
[208, 208, 226, 208]
p02958
u336408262
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nm=0\nfor i in range(n):\n print(p[p[i]-1])\n if p[i]==i+1 :\n continue\n elif p[p[i]-1]==i+1 and m<2 :\n m+=1\n continue\n else :\n print ("NO")\n exit()\nprint("YES")\n', 'n=input()\np=list(map(int,input().split()))\ndef func...
['Runtime Error', 'Accepted']
['s190540874', 's646303770']
[3060.0, 3060.0]
[17.0, 17.0]
[247, 270]
p02958
u337626942
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nt=1\nfor i in range(N):\n if t==p[i]:\n t+=1\n else:\n index=p.index(t)\n p[index]=i+1\n p[i]=p[index]\n break\n\nfor j in range(N-1):\n if p[j]+1==p[j+1]:\n pass\n else:\n print("NO")\n exit()\nprin...
['Wrong Answer', 'Accepted']
['s995928693', 's254354986']
[3064.0, 3060.0]
[18.0, 18.0]
[308, 247]
p02958
u337820403
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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)\ncount = 0\n\nfor i, j in zip(p, s):\n if i != j:\n count += 1\n\nif count <= 2:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\np = list(map(int, input().split()))\ns = sorted(p)\ncount = 0\n\nfor i, j in zip(p, s):\n if...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s577598115', 's597763552', 's968938137', 's590308183']
[3060.0, 3060.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0, 18.0]
[189, 188, 197, 189]
p02958
u338821626
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\n\nfor i, j in enumerate(A)\n if i + 1 != j:\n cnt +=1\nif cnt <= 2:\n print('YES')\nelse:\n print('NO')\n ", "n = int(input())\nA = list(map(int, input().split()))\ncnt = 0\n \nfor i, j in enumerate(A):\n if i + 1 != j:\n cnt +=1\nif cnt <= 2:...
['Runtime Error', 'Accepted']
['s478903763', 's980150563']
[2940.0, 2940.0]
[17.0, 17.0]
[166, 165]
p02958
u340153434
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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(1,N+1):\n if p[i-1] != i:\n count += 1\n if count >2:\n print('NO')\n exit(0)\nprint('Yes')", "N = int(input())\np = list(map(int,input().split()))\ncount = 0\nfor i in range(1,len(p)):\n if p[i-1] != i:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s379117068', 's763320870', 's939028861', 's865528626']
[3060.0, 2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 18.0]
[189, 193, 194, 190]
p02958
u343292604
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nc = 0\n\nfor i, v in enumerate(p):\n if i + 1 != v:\n c += 1\n\nif c > 2:\n print("No")\nelse:\n print("Yes")\n', 'N = int(input())\np = map(int, input().split())\nc = 0\n\nfor i, v in enumerate(p):\n if i + 1 != v:\n c += 1\n\nif c > 2:\n ...
['Wrong Answer', 'Accepted']
['s932721949', 's461010489']
[2940.0, 2940.0]
[17.0, 18.0]
[164, 164]
p02958
u343489490
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()]\ntmp=0\ns=0\ncnt=0\ne=0 \n\nfor i in range(0,n-1):\n # print(p[i])\n if p[i] > p[i+1]:\n if i == 0:\n cnt+=1\n s=i\n \n else:\n cnt+=1\n e=i+1\n \n if i == n-1 and cnt==2:\n tmp=p[s]\n p[s...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s570766189', 's825325807', 's536635518']
[3064.0, 3060.0, 3060.0]
[18.0, 18.0, 17.0]
[444, 295, 563]
p02958
u343977188
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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=[i for i in range(1,N+1)]\n\ncount=0\nfor i in range(N):\n if P[i]!=Q[i]:\n count+=1\nif count>=3:\n print("No")\nelse:print("Yes")', 'N=int(input())\nP=list(map(int,input().split()))\n\nQ=[i for i in range(1,N+1)]\n\ncount=0\nfor i in range(N):\n if P[i]!=Q...
['Wrong Answer', 'Accepted']
['s434792330', 's601753438']
[3060.0, 3060.0]
[17.0, 17.0]
[179, 179]
p02958
u346308892
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\ndef acinput():\n return list(map(int,input().split(" ")))\n\ndef bubble_sort(arr):\n global count\n change = True\n while change:\n change = False\n for i in range(len(arr) - 1):\n if arr[i] > arr[i + 1]:\n arr[i], arr[i + 1] = arr[i + 1], arr[i]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s715685289', 's943198665', 's622980826']
[20636.0, 20000.0, 21144.0]
[313.0, 280.0, 285.0]
[484, 324, 237]
p02958
u347920118
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['num = int(input())\norder = []\nfor i in range(1,num+1):\n order.append(i)\n#print(order)\n\nq_num = list(map(int,input().split()))\n#print(q_num)\ncnt = 0\nfor j in range(num):\n if order[j]==q_num[j]:\n cnt = cnt+1\n else:\n pass\nif cnt <=2:\n print("Yes")\nelse:\n print("No")\n ', ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s617162602', 's738796178', 's063751410']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 20.0]
[297, 297, 297]
p02958
u353919145
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()\n g = input()\n a = list(map(str, g.split()))\n b = list(map(int, g.split()))\n if sorted(b) == b:\n print("YES")\n else:\n m = 0\n for i in range(len(b)):\n if b[i] == sorted(b)[i]:\n m+=1\n if m==len(b)-2:\n print("YES")\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s125645702', 's295972920', 's569685938']
[2940.0, 9048.0, 3064.0]
[17.0, 24.0, 17.0]
[340, 820, 165]
p02958
u354567428
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n=int(input())\np=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n if p[i] != i+1:\n count += 1\n if count == 2:\n print('NO')\n exit()\nprint('YES')\n", "n=int(input())\np=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n if p[i] != i+1:\n cou...
['Wrong Answer', 'Accepted']
['s537763890', 's038679027']
[2940.0, 2940.0]
[17.0, 18.0]
[193, 193]
p02958
u356701928
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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)\np=0\nfor i in range(n):\n if a[i]==b[i]:\n p+=1\nif p==n or p==n-2:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\na=list(map(int,input().split()))\nb=sorted(a)\np=0\nfor i in range(n):\n if a[i]==b[i]:\n p+=1\nif p==n or p==n-2:\n print("YES")\...
['Wrong Answer', 'Accepted']
['s910367751', 's386478857']
[3060.0, 3060.0]
[17.0, 18.0]
[157, 157]
p02958
u357005212
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nnums = [int(N) for N in input().split()]\ndiff = 0\n\nfor i in range(N):\n if (i + 1) != nums[i]:\n diff += 1\n if diff >= 3:\n break\n\nif diff == 0 or diff == 2:\n print('Yes')\nelse:\n print('No')\n", "N = int(input())\np = [int(x) for x in input().split()]\ndiff = 0\n\n...
['Wrong Answer', 'Accepted']
['s428907828', 's079370269']
[2940.0, 2940.0]
[18.0, 19.0]
[231, 225]
p02958
u357230322
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 < n-2:\n print("No")\nelse:\n print("Yes")', 'n=int(input())\nP=list(map(int,input().split()))\nt=len(P)\nm=0\nfor i in range(t):\n if P[i]!=P.index(i+1)+1:\n m+=1\nif m=2:\n print("YES")\nelse:\n...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s180734613', 's907587065', 's935687849', 's212134891']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[150, 158, 149, 150]
p02958
u361381049
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = list(p)\n\nans = []\nfor i in range(1,n+1):\n ans.append(i)\n\n \n\nfor i in range(n):\n for j in range(n):\n a[i] = p[j]\n a[j] = p[i]\n if a == ans:\n print('YES')\n exit()\n else:\n a = list(p)\n print(p) \n \n ...
['Wrong Answer', 'Accepted']
['s524153131', 's309739532']
[3444.0, 3064.0]
[30.0, 18.0]
[322, 313]
p02958
u363599046
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 sys import stdin \n\nn = int(input())\np = [int(x) for x in stdin.readline().rstrip().split()]\nc= 0\nq = sorted(p)\nprint(q)\nprint(p)\nfor i in range(n):\n\tif p[i] != q[i]:\n\t\tc += 1\n\nif c>2:\n\tprint("NO")\n\nelse:\n\tprint("YES")', 'from sys import stdin \n\nn = int(input())\np = [int(x) for x in stdin....
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s382990246', 's388603693', 's526146220', 's588780381', 's605751478', 's630923726', 's148436501']
[3060.0, 3060.0, 3064.0, 3064.0, 3060.0, 3064.0, 3316.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 20.0]
[222, 223, 231, 213, 205, 231, 205]
p02958
u363836311
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nt=tuple(p)\np.sort()\nc=0\nfor i in range(n):\n if p[i]!=t[i]:\n c+=1\nif c==0 or c==2:\n print('Yes')\nelse:\n print('No')\n", "n=int(input())\np=list(map(int, input().split()))\nt=tuple(p)\np.sort()\nc=0\nfor i in range(n):\n if p[i]!=t[i]:\n c+=1\nif c==...
['Wrong Answer', 'Accepted']
['s819920649', 's359031684']
[3060.0, 3060.0]
[17.0, 17.0]
[170, 170]
p02958
u363995337
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\nli = list(map(int,input().split()))\ncount = 0\njudge = True\n\nfor i in range(N-1):\n if (li[i] > li[i+1]):\n swp = li[i]\n index_swp = li.index(min(li[i+1:]))\n li[i] = min(li[i+1:])\n li[index_swp] = swp\n count = count + 1\n if(count > 1):\n ...
['Wrong Answer', 'Accepted']
['s522876068', 's155551465']
[3064.0, 3572.0]
[18.0, 23.0]
[395, 311]
p02958
u365491796
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['#ABC135B\nN = int(input())\nP = list(map(int, input().split()))\nflg = 0\nfor i in range(0, N):\n if i+1 != P[i]:\n flg += 1\nprint("Yes" if flg == 0 or flg == 2 else "No")', '#ABC135B\nN = int(input())\nP = list(map(int, input().split()))\nflg = 0\nfor i in range(0, N):\n if i+1 != P[i]:\n flg +=...
['Wrong Answer', 'Accepted']
['s636825145', 's511652022']
[2940.0, 2940.0]
[18.0, 17.0]
[175, 175]
p02958
u366482170
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = input().split()\nprint(s)\nb =[str(i+1) for i in range(len(s))]\nprint(b)\ncount=0\nfor i in range(len(s)):\n if s[i]!=b[i]:\n count+=1\nif count==0: print("YES")\nelif count==2: print("YES")\nelse: print("NO")', 'n = int(input())\ns = input().split()\nb =[str(i+1) for i in range(len(s))]\nc...
['Wrong Answer', 'Accepted']
['s236423782', 's583383914']
[3064.0, 3064.0]
[17.0, 17.0]
[225, 207]
p02958
u367130284
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n,*a=map(int,open(0))\n*l,=range(1,n+1)\nc=0\nfor i in range(n):\n if a[i]!=l[i]:\n c+=1\nif c<=2:\n print("YES")\nelse:\n print("NO")\n ', 'n,*a=map(int,open(0).read().split())\n*l,=range(1,n+1)\nc=0\nfor i in range(n):\n if a[i]!=l[i]:\n c+=1\nif c<=2:\n print("YES")\nelse:\n prin...
['Runtime Error', 'Accepted']
['s006939873', 's695226974']
[2940.0, 2940.0]
[17.0, 17.0]
[146, 161]
p02958
u368016155
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["import sys\n\nN = int(input())\np = [int(_) for _ in input().split()]\n\ncorrect = [int(_) for _ in range(1,N+1)]\n\nif p == correct:\n print('YES')\nelse:\n for i in range(N):\n for j in range(i+1,N):\n a = p[:]\n c = a[i]\n a[i] = a[j]\n a[j] = c\n print(a)\n if ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s296204550', 's413128676', 's896371382', 's913937986', 's725437326']
[3316.0, 2940.0, 3188.0, 3188.0, 3064.0]
[24.0, 17.0, 24.0, 24.0, 18.0]
[392, 199, 390, 395, 373]
p02958
u368796742
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 i != l[i]:\n count += 1\n if count >=3:\n print("NO")\nprint("YES")', 'n = int(input())\nl = list(map(int,input().split()))\ncount = 0\nfor i in range(n):\n if i+1 != l[i]:\n count += 1\n\n if count >2:\n ...
['Wrong Answer', 'Accepted']
['s934806397', 's630967636']
[3060.0, 2940.0]
[17.0, 17.0]
[156, 226]
p02958
u371530330
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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((int, input().split()))\ncnt = 0\n \nfor i in range(N):\n if p[i] != i+1:\n cnt += 1\n \nif cnt==0 or cnt==2 :\n print('YES')\nelse:\n print('NO')", "N = int(input())\np = map(int, input().split())\ncnt = 0\n\nfor i in range(1,1+N):\n if p[i]+1 != p[i+1]:\n cnt += 1\n\nif cnt <= 3...
['Runtime Error', 'Runtime Error', 'Accepted']
['s076937285', 's898377121', 's895657145']
[2940.0, 3316.0, 3060.0]
[17.0, 21.0, 17.0]
[168, 163, 171]
p02958
u372144784
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import sys\nN = int(input())\np = input()\nlist1 = list(map(int,p.split()))\n\nlist2 = []\nfor i in range(1,N + 1):\n list2.append(i)\n\nif list1 == list2:\n print("Yes")\n sys.exit()\nfor i in range(0,N):\n if list1[i] != i+1:\n if i+1 == list1[list1[i]-1]:\n list1[list1[i]-1] = list1[i...
['Wrong Answer', 'Accepted']
['s763695614', 's574038342']
[3064.0, 3064.0]
[17.0, 17.0]
[481, 458]
p02958
u372550522
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = [int(i) for i in input().split()]\nmis = 0\nfor i in range(n):\n if l[i] != i:\n mis += 1\nprint('YES' if mis<3 else 'NO')", "n = int(input())\nl = [int(i) for i in input().split()]\nmis = 0\nfor i in range(n):\n if l[i] != i+1:\n mis += 1\nprint('YES' if mis<3 else 'NO')"]
['Wrong Answer', 'Accepted']
['s424800250', 's779481245']
[2940.0, 2940.0]
[19.0, 18.0]
[148, 150]
p02958
u373047809
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nt = 0\nfor i in range(n):\n t += 1 if p[i] != sorted(p)[i] \nprint("YES" if t == 0 or t == 2 else "NO")', 'n, *p = map(int, open(0).read().split())\nt = 0\nfor i in range(n):\n t += p[i] != sorted(p)[i]\nprint("YES" if t == 0 or t == 2 else "NO")']
['Runtime Error', 'Accepted']
['s627507221', 's507731932']
[2940.0, 2940.0]
[17.0, 18.0]
[144, 138]
p02958
u374765578
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = [int(i) for i in input().split()]\nscore == 0\nfor i in range(N):\n if list[i] != i+1:\n score += 1\nif score == 0 or 2:\n print("YES")\nelse:\n print("NO")', 'a = int(input())\n\np = list(map(int, input().split()))\n\nd = 0\nfor i in range(a):\n if not p[i] == a-i:\n d +=...
['Runtime Error', 'Runtime Error', 'Accepted']
['s868399096', 's949673062', 's383204507']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[188, 197, 184]
p02958
u376328830
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nlst1 = list(map(int,input().split()))\nlst2 = copy.copy(sorted(lst1))\n\nc=0\nfor i in range(n):\n if lst1[i]==lst2[i]:\n pass\n else:\n c+=1\n if c > 2:\n print("No")\n break\nprint("Yes")', 'import copy\nimport sys\nn = int(input())\n...
['Wrong Answer', 'Accepted']
['s599819835', 's989911880']
[3444.0, 3444.0]
[22.0, 22.0]
[256, 284]
p02958
u379535139
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["num = input()\ninput_list = [int(i) for i in input().split()] \nsorted_list = sorted(input_list)\n\ncount = 0\nfor input, sort in zip(input_list, sorted_list):\n if input != sort:\n count += 1\n\nif count < 2:\n print('YES')\nelse:\n print('NO')", "num = int(input())\nif num >= 2:\n input_list = [int(i) for i ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s878784019', 's948599649', 's401934934']
[3064.0, 3060.0, 3060.0]
[19.0, 17.0, 17.0]
[239, 290, 298]
p02958
u379981698
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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=list(range(1,a+1))\ncount = 0\nfor i in range(a):\n if c[i]!=b[i]:\n count+=1\nif count<=2:\n print("Yes")\nelse:\n print("No")', 'a=int(input())\nb=list(map(int,input().split()))\nc=list(range(1,a+1))\ncount = 0\nfor i in range(a):\n if c[i]!=b[i]:\n coun...
['Wrong Answer', 'Accepted']
['s008130539', 's000105824']
[3060.0, 3060.0]
[17.0, 17.0]
[175, 175]
p02958
u385309449
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['x = int(input())\nfor i in range(x):\n exec("a_%d = int(input())" %(i))\na_list = [eval("a_%d" %(i)) for i in range(x)]\na_list.sort()\nbe_list = [eval("a_%d" %(i)) for i in range(x)]\ncount = 0\nfor i in range(x):\n if a_list[i] == be_list[i]:\n count += 1\nif count >= x-2:\n print(\'YES\')\nelse:\n print...
['Runtime Error', 'Accepted']
['s451932573', 's505064498']
[3064.0, 3060.0]
[17.0, 17.0]
[309, 199]
p02958
u386089355
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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_p = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(n):\n if ls_p[i] != i + 1:\n cnt +=1\n\nif cnt > 2:\n print("No")\nelse:\n print("Yes")', 'n = int(input())\nls_p = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(n):\n if ls_p[i] != i + 1:\n ...
['Wrong Answer', 'Accepted']
['s939729403', 's411739592']
[2940.0, 2940.0]
[17.0, 17.0]
[177, 177]
p02958
u386170566
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['#ABC135B - 0 or 1 Swap\nN = int(input())\np = list(map(int,input().split()))\nfor i in range(N):\n if p[i] != i+1:\n a = p[i]\n p[i] = i+1\n p[a-1] = a\n break\nprint(p)\nif p == [i for i in range(1,N+1,1)]:\n print("YES")\nelse:\n print("NO")', '#ABC135B - 0 or 1 Swap\nN = int(in...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s050026888', 's138500956', 's085866549']
[3064.0, 3060.0, 3060.0]
[18.0, 18.0, 18.0]
[267, 243, 230]
p02958
u389679466
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import sys\n\nn = int(input())\n\np = list(map(int, input().split()))\n\nps = sorted(p)\n\ncount = 0\n\nfor a, b in zip(p, ps):\n print(a, b)\n if(a != b):\n count += 1\n if(count > 2):\n print("NO")\n sys.exit()\n break\n\nprint("YES")\n', 'import sys\n\nn = int(input())\n\np = l...
['Wrong Answer', 'Accepted']
['s378622617', 's188729674']
[3060.0, 3060.0]
[17.0, 17.0]
[255, 239]
p02958
u391675400
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\nhikaku = list(range(1,n+1))\ncount = 0\nfor i in range(n):\n if hikaku[i] != p[i]:\n count += 1\nif count >3:\n print("No")\nelse:\n print("Yes")\n', 'n = int(input())\np = list(map(int,(input().split())))\n\nhikaku = list(range(1,n+1))\ncount ...
['Wrong Answer', 'Accepted']
['s676169375', 's124703044']
[2940.0, 2940.0]
[17.0, 17.0]
[209, 224]
p02958
u391819434
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nA=[a-b for a,b in zip(range(1,N+1),P)]\nprint('YNeos'[len(set(A))!=1 and len(set(A))!=3::2])", "N,*P,=map(int,open(0).read().split())\nA=[a!=b for a,b in zip(range(1,N+1),P)]\nprint('YNEOS'[sum(A)!=0 and sum(A)!=2::2])"]
['Wrong Answer', 'Accepted']
['s039322212', 's229598252']
[2940.0, 2940.0]
[17.0, 18.0]
[129, 120]
p02958
u393881437
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\n\nfor i in range(1,n):\n if p[i] != (i+1):\n cnt += 1\n\nprint('YES' if cnt == 0 or cnt == 2 else 'NO')", "n = int(input())\np = list(map(int,input().split()))\ncnt = 0\n\nfor i in range(n):\n if p[i] != (i+1):\n cnt += 1\n\nprint('YES...
['Wrong Answer', 'Accepted']
['s165072059', 's296389587']
[9116.0, 9100.0]
[29.0, 29.0]
[168, 167]
p02958
u396495667
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()]\ncnt =0\nfor i in range(2, len(p)):\n if p[i]-p[i-1] !=1:\n cnt +=1\nprint('Yes' if cnt <=1 else 'No')", "n =int(input())\np = [int(_) for _ in input().split()]\ncnt =0\nfor i in range(len(p)):\n if p[i] !=(i+1):\n cnt +=1\nprint('Yes' if cnt <=2 else '...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s690058177', 's771678095', 's313061512']
[3064.0, 2940.0, 2940.0]
[24.0, 18.0, 17.0]
[156, 150, 150]
p02958
u396961814
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\ncnt = 0\n\nQ = sorted(P)\n\nfor i in range(N):\n if P[i] != Q[i]:\n cnt +=1\n\nif cnt==0 or cnt==2:\n print('yes')\nelse:\n print('no')\n ", "N = int(input())\nP = [int(x) for x in input().split()]\n\ncnt = 0\n\nQ = sorted(P)\n\nfor i in range...
['Wrong Answer', 'Accepted']
['s614662244', 's623842811']
[2940.0, 2940.0]
[17.0, 17.0]
[198, 206]
p02958
u397496203
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\ntmp = 0\n\nfor i in range(N-1):\n if l[i] != i:\n tmp +=1\n\nif tmp <=1: \n print("YES")\nelse:\n print("NO")', 'N = int(input())\nl = list(map(int,input().split()))\ntmp = 0\n\nfor i in range(N-1):\n if l[i] != i:\n tmp +=1\n\nif tmp <=2: \n print("YES...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s625066815', 's708638811', 's852722865', 's540068810']
[3060.0, 2940.0, 3064.0, 2940.0]
[17.0, 17.0, 18.0, 19.0]
[158, 158, 296, 158]