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
u573754721
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\ng=sum((1 for i in range(n) if i+1 !=p[i]))\nprint("YNeos"[::2] if g==2 or g==0 else "YNeos"[1::2])', 'n=int(input())\np=list(map(int,input().split()))\ng=sum((1 for i in range(n) if i+1 !=p[i]))\nprint("YNEOS"[::2] if g==2 or g==0 else "YNEOS"[1::2])']
['Wrong Answer', 'Accepted']
['s506319006', 's817150075']
[3064.0, 3060.0]
[17.0, 18.0]
[145, 145]
p02958
u577138895
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\nctr = 0\nfor i in range(N):\n if i + 1 != P[i]:\n ctr += 1\nif ctr <= 2:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nP = list(map(int, input().split()))\nctr = 0\nfor i in range(N):\n if i + 1 != P[i]:\n ctr += 1\nif ctr <= ...
['Wrong Answer', 'Accepted']
['s902004409', 's190912414']
[2940.0, 2940.0]
[17.0, 17.0]
[170, 170]
p02958
u579324544
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()) \ns = list(map(int, input().split()))\ns2 = copy.copy(s)\ns.sort(reverse=True)\nn = 0\nfor i in range(0, len(x)):\n if x[i] - x2[i] != 0:\n n+=1\nif n == 2:\n print("YES")\nelse:\n print("NO")', 'import copy\n\nN = int(input()) \ns = list(map(int, input().split()))\ns2 = co...
['Runtime Error', 'Accepted']
['s211810521', 's513179452']
[3444.0, 3444.0]
[22.0, 22.0]
[223, 274]
p02958
u580236524
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_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\ndif = []\nfor i in range(1,n+1):\n if p[i-1] != i:\n dif.append(i)\n\nif len(dif) == 0 or len(dif) == 2:\n print('YES')\nelse:\n print('NO')\n ", "n = input()\np = [int(input()) for i in range(3)]\n\ndif = []\nfor i in range(1,n+1):\n if p[i-1] != i:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s211187334', 's804885192', 's947778147', 's730776553']
[2940.0, 3056.0, 3056.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[192, 193, 186, 197]
p02958
u580404776
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(input())\nP=list(map(int,input().split()))\ncnt=0\nfor i in range(N):\n if i+1 != P[i]:\n cnt +=1\nprint("Yes" if cnt==0 or cnt ==2 else "No")', 'N=int(input())\nP=list(map(int,input().split()))\ncnt=0\nfor i in range(N):\n if i+1 != P[i]:\n cnt +=1\nprint("YES" if cnt==0 or cnt ==2 else "NO...
['Wrong Answer', 'Accepted']
['s268526536', 's021511099']
[3060.0, 2940.0]
[17.0, 17.0]
[152, 152]
p02958
u580904613
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 collections\nn = int(input())\np = [int(i) for i in input().split()]\nps = sorted(p)\nx = [p[i]-ps[i] for i in range(len(p))]\ntmp = []\nc = collections.Counter(x)\nif len(c) == 1:\n print('YES')\nelif len(c) ==3:\n for i in range(n):\n if x[i] != 0:\n tmp.append(x[i])\n if sum(tmp) == 0:\n print...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s097432354', 's684911900', 's707564183', 's254388062']
[3316.0, 3316.0, 3316.0, 3316.0]
[20.0, 20.0, 20.0, 21.0]
[355, 291, 298, 261]
p02958
u586662847
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 itertools\n# import math\n\nimport sys\ninput = sys.stdin.readline\n\n\ndef solve(N, P):\n NN = sorted(N)\n cnt = 0\n for l1, l2 in zip(N, NN):\n if l1 != l2:\n cnt += 1\n\n return 'YES' if cnt <= 2 else 'NO'\n\n\nN = int(input())\n# S = input()\n# A, B = map(int, input().split(...
['Runtime Error', 'Accepted']
['s169482956', 's972073087']
[3056.0, 2940.0]
[17.0, 17.0]
[477, 477]
p02958
u593761424
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 itertools\nimport copy\n\n\ndef is_sorted(arr):\n for i in range(len(arr) - 1):\n if arr[i] > arr[i + 1]:\n return False\n return True\n\n\ndef main():\n n = int(input())\n ps = list(map(int, input().split()))\n\n if is_sorted(ps):\n print('Yes')\n return\n\n f...
['Wrong Answer', 'Accepted']
['s756986555', 's965257095']
[3696.0, 3568.0]
[153.0, 68.0]
[525, 525]
p02958
u595289165
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int, input().split()))\na = 0\nfor i in range(n):\n if p[i] == i + 1:\n pass\n else:\n a += 1\nif a <= 2:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\np = list(map(int, input().split()))\na = 0\nfor i in range(n):\n if p[i] == i + 1:\n pas...
['Wrong Answer', 'Accepted']
['s051482417', 's982129882']
[2940.0, 3060.0]
[17.0, 17.0]
[187, 187]
p02958
u597455618
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\ncheck = 0\ntmp = 0\nfor i in range(n-1):\n if p[i+1] - p[i] == 1:\n cnt += 1\n else:\n if check == 0:\n tmp = i + 2\n check += 1\n else :\n if tmp == p[i+1]:\n check += 1\n else :\n cnt += 1\n\nif cnt == n-1 o...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s459651741', 's549658403', 's558726796', 's921895583', 's299471696']
[3064.0, 3060.0, 3064.0, 3316.0, 2940.0]
[18.0, 18.0, 17.0, 20.0, 17.0]
[351, 237, 349, 170, 180]
p02958
u597622207
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_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()))\ns = sorted(l)\nout = 0\nfor i in range(len(l)-1):\n out += 1 if l[i] != s[i] else 0\n\nprint('YES') if out == 2 or out == 0 else print('NO')", "n = input()\nl = list(map(int, input().split()))\ns = sorted(l)\nout = 0\nfor i in range(len(l)):\n out += 1 if l[i] != s[...
['Wrong Answer', 'Accepted']
['s552744066', 's723426235']
[3060.0, 3060.0]
[18.0, 19.0]
[184, 183]
p02958
u600588566
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(inpuit())\n\np=list(map(int,input().split()))\nsort=list(range(1,N+1))\ncount=[p[i]==sort[i] for i in range(N)].count(True)\nif count > 2:\n print("NO")\nelse:\n print("YES")', 'N=int(input())\n\np=list(map(int,input().split()))\nsort=list(range(1,N+1))\ncount=list(p[i]==sort[i] for i in range(N)).count(T...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s142574510', 's200411523', 's296621275']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 18.0]
[178, 181, 182]
p02958
u600717568
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(input())\nList=list(map(int,input().split()))\ncount=0\nfor i in range(N-1):\n if List[i]!=i+1:\n count+=1\nif count<=2:\n print("Yes")\nelse:\n print("NO")', 'N=int(input())\nList=list(map(int,input().split()))\ncount=0\nfor i in range(N):\n if List[i]!=i+1:\n count+=1\nif count<=2:\n print("Yes")\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s073767280', 's155027116', 's342627759', 's838923797', 's430619363']
[3060.0, 2940.0, 3060.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[159, 157, 157, 167, 208]
p02958
u600935366
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nres = 'YES'\nfor i in range(n-1):\n if p[i] > p[i+1]:\n cnt+=1\n if cnt == 2:\n res = 'NO'\n \nprint(res)", "n = int(input())\np = list(map(int, input().split()))\n\ncnt = 0\nres = 'Yes'\nfor i in range(n-1):\n if p[i] > p...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s270616355', 's862045417', 's093889945']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[187, 187, 187]
p02958
u601235270
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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_l = sorted(p)\ncount =0\n\nif p == p_l:\n print("Yes")\n\nelse:\n for i in range(n):\n if not p[i] == p_l[i]:\n count +=1\n\n if count ==2:\n print("Yes")\n else:\n print("No")', 'n = int(input())\np = list(map(int, i...
['Wrong Answer', 'Accepted']
['s156925992', 's192977055']
[3060.0, 3060.0]
[17.0, 17.0]
[261, 261]
p02958
u601825761
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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(0,n):\n if p[i]!=i+1:\n cnt+=1\nif cnt>2:\n print("NO")\nelse:\n print("YES")', 'n = int(input())\np = list(map(int, input().split()))\ncnt = 0\nfor i in range(0,n):\n if p[i]!=i+1:\n cnt+=1\nif cnt>2:\n print("...
['Runtime Error', 'Accepted']
['s508497485', 's126127259']
[2940.0, 2940.0]
[17.0, 17.0]
[162, 164]
p02958
u602252807
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nif count <= 2:\n print('Yes')\nelse:\n print('No') ", "n = int(input())\np = list(map(int,input().split()))\ncount = 0\nfor i in range(n):\n if p[i] != i + 1:\n count += 1\...
['Wrong Answer', 'Accepted']
['s457256117', 's585233512']
[3060.0, 2940.0]
[17.0, 17.0]
[177, 178]
p02958
u609814378
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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 if P[i] != i + 1:\n ans += 1\nif ans <= 2:\n print('YES')\nelse:\n print('NO')", '\n\n\n\n\n\n\nN = int(input())\nP = list(map(int, input().split()))\n\n\n\n\nascending_order = P.sort()\n\n\n\n\nTest_P = P[1:N-1]\n\n\nascen...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s123932147', 's292207794', 's996500271', 's253845658']
[2940.0, 3060.0, 3064.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[162, 757, 771, 154]
p02958
u612975321
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\na = np.arange(1, n+1)\ntmp = p - a\ncnt = np.count_nonzero(tmp != 0)\n\nflg = False\nif cnt == 0 or (cnt == 2 and tmp.sum() == 0):\n flg = True\n\nprint('Yes') if flg else print('No')", "import numpy as np\nn = int(input())\np = ...
['Wrong Answer', 'Accepted']
['s279389269', 's593844441']
[27328.0, 26964.0]
[117.0, 117.0]
[260, 260]
p02958
u614734359
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\nP = [int(i) for i in input().split()]\ncnt = 0\nfor i in range(1,n+1):\n if P[i-1] != i:\n idx = P[i-1]\n if P[idx-1] != i:\n print('No')\n exit()\n else:\n P[i-1] = i\n P[idx-1] = idx\n cnt += 1\n#print(P)\nif cnt <= 1: ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s171537589', 's483998310', 's791704415', 's951276949']
[3060.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[335, 196, 159, 196]
p02958
u618107373
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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):\n for j in range(i+1,n):\n a[i],a[j]=a[j],a[i]\n for k in range(n-1):\n if a[k]>a[k+1]:\n a[i],a[j]=a[j],a[i]\n break\n else:\n i,j=n,n\nif i==n:\n print("YES")\nelse:\n print("NO")', 'import sys\nsys.setrecursion...
['Runtime Error', 'Accepted']
['s613266407', 's249009552']
[3064.0, 3064.0]
[18.0, 18.0]
[272, 386]
p02958
u619785253
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nP_r = sorted(P)\nfor i in range(0,N):\n if P[i] != P_r[i]:\n ans +=1\n \nif ans<=2:\n print('YES')\nelse:\n print('NO')\n\nprint(P)\nprint(P_r)\n ", "N = int(input())\nP = list(map(int,input().split(' ')))\nans = 0\nP_r = sorted(P)\n#print(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s132505271', 's575945631', 's832952720']
[3060.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[209, 200, 184]
p02958
u623953567
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nlist_p = [i for i in range(1,N+1) ]\nflag = 0\n\nif p == list_p:\n print("Yes")\n\nelse:\n for i in range(N):\n for j in range(i+1,N):\n p[i],p[j] = p[j],p[i]\n\n if p == list_p:\n flag = 1\n break...
['Wrong Answer', 'Accepted']
['s364808276', 's265723572']
[3064.0, 3064.0]
[18.0, 18.0]
[424, 424]
p02958
u624075921
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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 = []\nc=0\nfor i in range(0,n):\n\tif arr[i]!= i+1 :\n\t\tc+=1\n \nif c > 2:\n\tprint('NO')\nelse:\n\tprint('YES')", "n = int(input())\narr =list(map(int,input().split()))\nc=0\nfor i in range(0,n):\n\tif arr[i]!= i+1 :\n\t\tc+=1\n \nif c > 2:\n\tprint('NO')\nelse:\n\tprint('YE...
['Runtime Error', 'Accepted']
['s959488577', 's319092111']
[2940.0, 3060.0]
[17.0, 17.0]
[130, 157]
p02958
u625963200
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = [int(i) for i in input().split()][0]\nP = [int(i) for i in input().split()]\n\nflag=0\nsave=0\nfor i in range(N-1):\n if flag==0 and P[i]>P[i+1]:\n save=i\n flag=1\n if flag==1 and P[i]>P[i+1]:\n tmp=P[i]\n P[i]=P[save]\n P[save]=tmp\n break\n\nflag=0\nfor i in range(N-1):\n if P[i]>P[i+1]:\n...
['Wrong Answer', 'Accepted']
['s925738279', 's501241690']
[3064.0, 3064.0]
[17.0, 17.0]
[364, 382]
p02958
u626228246
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nH = list(map(int,input().split()))\nC = 0\n\nif sorted(H) == H:\n print("YES")\n sys.exit()\n \nfor i in range(0,N-1):\n for j in range(1,N):\n tmp = H.replace(H[i],H[j])\n if tmp == sorted(H):\n print("YES")\n sys.exit()\nprint("NO")', 'import copy\nimport sys\nN = i...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s372576579', 's740428197', 's829105342']
[3064.0, 3444.0, 3444.0]
[17.0, 33.0, 33.0]
[269, 279, 279]
p02958
u626684023
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()]\ncount = 0 \nres = "yes"\np_sorted = sorted(p)\nfor i in range(N):\n if p_sorted[i] != p[i]:\n count += 1\n if count > 2:\n res = "no"\n break\nprint(res)', 'N = int(input())\np = [int(i) for i in input().split()]\ncount = 0 \nres = "YES"\np_sor...
['Wrong Answer', 'Accepted']
['s501915746', 's181331892']
[3060.0, 3060.0]
[19.0, 17.0]
[216, 216]
p02958
u627234757
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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)\ncount = 0\nfor i in range(N):\n if p[i] != sorted_p[i]:\n count += 1\nif count <= 2:\n print('Yes')\nelse:\n print('No')", "N = int(input())\np = list(map(int, input().split()))\nsorted_p = sorted(p)\ncount = 0\nfor i in rang...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s501309182', 's508065741', 's524828070']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[203, 203, 203]
p02958
u628158887
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = list(map(int,input().split()))\np_sorted = sorted(p)\n\ncnt = 0\n\nfor i in range(N):\n if p[i] != p_sorted[i]:\n cnt += 1\n if cnt==3:\n print("No")\n sys.exit()\n\nprint("Yes")\n', 'import sys\n\nN = int(input())\np = list(map(int,input().split()))\np_s...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s092693811', 's128587271', 's851052491']
[3060.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0]
[227, 227, 225]
p02958
u628965061
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nlist_p=list(map(int,input().split()))\nnp_list_p=np.array(list_p)\nnp_list_s =np.array(sorted(list_p))\nminus=list(np_list_p - np_list_s)\nprint("Yes" if minus.count(0) == N or minus.count(0)== N-2 else "No")\nprint(minus.count(0))', 'import numpy as np\nN=int(input())\nlist_p=list...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s225003430', 's447782455', 's671394859', 's707650692']
[12508.0, 12504.0, 12504.0, 12504.0]
[155.0, 151.0, 150.0, 150.0]
[260, 238, 235, 238]
p02958
u629540524
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n = int(input())\np = list(map(int,input().split()))\nx = sorted(p)\nc = 0\nfor i in range(n):\n if x[i] == p[i]:\n c+=1\nif c >=2:\n print('Yes')\nelse:\n print('No')", "n = int(input())\np = list(map(int,input().split()))\nx = sorted(p)\nc = 0\nfor i in range(n):\n if x[i] != p[i]:\n c+=1\...
['Wrong Answer', 'Accepted']
['s709784933', 's276283611']
[9100.0, 9048.0]
[30.0, 29.0]
[173, 172]
p02958
u631429391
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\nnlst = [x for x in range(1,n+1)]\nlst = [0]*n\nfor i in range(n):\n if nlst[i] == p[i]:\n lst[i] = 1\nprint('YES' if sum(lst) in [0,2] else 'NO')", "n = int(input())\np = list(map(int,input().split()))\nnlst = [x for x in range(1,n+1)]\nlst = [0]*n\n#print(nls...
['Wrong Answer', 'Accepted']
['s520818300', 's737374856']
[3060.0, 3064.0]
[17.0, 17.0]
[196, 235]
p02958
u631579948
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N=int(input())\nM=list(map(int,input().split()))\nans=0\nlist_= sorted(M)\nfor i in range(N):\n if M[i]==list_[i]:\n ans+=1\nif ans>=N-2:\n print('Yes')\nelse:\n print('No')\n \n", "N=int(input())\nM=list(map(int,input().split()))\nans=0\nlist_= sorted(M)\nfor i in range(N):\n if M[i]==list_[i]:\n ans+=1\n...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s097585471', 's411129513', 's536370160', 's279305173']
[3060.0, 2940.0, 2940.0, 3064.0]
[17.0, 18.0, 17.0, 19.0]
[173, 175, 176, 177]
p02958
u634079249
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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, os, math, bisect, itertools, collections, heapq, queue\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\nfrom decimal import Decimal\nfrom collections import defaultdict, deque\n\n# import fractions\n\nsys.setrecursionlimit(10000000)\n\nii = lambda: int(sys.stdin.buffer.readline().rs...
['Runtime Error', 'Accepted']
['s013256924', 's817316348']
[10060.0, 10124.0]
[36.0, 35.0]
[1221, 1136]
p02958
u634576930
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(input())\nP=list(map(int,input().split()))\ncnt=0\nfor n in range(N):\n if n+1!=P[n]:\n cnt+=1\n if cnt>2:\n print("No")\n exit()\n\nprint("Yes")\n', 'N=int(input())\nP=list(map(int,input().split()))\ncnt=0\nfor n in range(N):\n if n+1!=P[n]:\n cnt+=1\n if...
['Wrong Answer', 'Accepted']
['s556574109', 's580064948']
[2940.0, 2940.0]
[18.0, 17.0]
[181, 181]
p02958
u635252313
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\np=list(map(int,input().split()))\nP=sorted(p)\nflag=0\nfor i in range(1,n):\n if p[i]!=P[i]:\n flag+=1\nprint("YES" if flag==2 or flag==0 else "NO")', 'n=int(input())\np=list(map(int,input().split()))\nP=sorted(p)\nflag=0\nfor i in range(n):\n if p[i]!=P[i]:\n flag+=1\nprint("YES" ...
['Wrong Answer', 'Accepted']
['s929243027', 's038630727']
[3064.0, 3060.0]
[17.0, 17.0]
[167, 165]
p02958
u640123177
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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_p = list(map(int, input().split()))\nli = set(li_p)\nli_a = []\nli_b = []\nfor i in range(N):\n if li_p[i] != li[i]:\n li_a.append(li_p[i])\n li_b.append(li[i])\n if len(li_a) == 2:\n if li_a[0] == li_b[1]:\n print("YES")\n else:\n print("NO")\n elif len(li_a)...
['Runtime Error', 'Accepted']
['s065103249', 's163810214']
[3064.0, 3060.0]
[17.0, 17.0]
[382, 213]
p02958
u640603056
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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())\ncnt = 0\nfor i in range(n):\n\tif i+1 != i:\n\t\tcnt+=1\nif cnt == 0 or cnt == 2:\n\tprint("YES")\nelse:\n\tprint("NO")\n\t', 'n = int(input())\np = map(int, input().split())\ncnt = 0\nfor i in range(n):\n\tif i+1 != i:\n\t\tcnt+=1\nif cnt == 0 or cnt == 2:\n\tprint("Y...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s180952749', 's980828294', 's590636406']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[156, 167, 180]
p02958
u642418876
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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)\ncount=0\nfor i in range(N):\n if p[i]!=q[i]:\n count+=1\n if count<=2:\n print('YES')\n else:\n print('NO')\n ", "N=int(input())\np=list(map(int,input().split()))\nq=sorted(p)\ncount=0\nfor i in range(N):\n if p[i]!=q[i]:\n count+=1\nif...
['Wrong Answer', 'Accepted']
['s711860416', 's285457917']
[2940.0, 2940.0]
[18.0, 17.0]
[177, 167]
p02958
u643714578
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\na=0\nfor i in range(n):\n if li[i]==i+1:\n a+=1\nif a==2:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\nli=list(map(int,input().split()))\na=0\nfor i in range(n):\n if li[i]!=i+1:\n a+=1\nif a==2 or a==0:\n print("YES")\nelse:\n print("NO")']
['Wrong Answer', 'Accepted']
['s196227104', 's857105100']
[2940.0, 2940.0]
[19.0, 17.0]
[141, 149]
p02958
u646030721
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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())\ncount=0\nfor i in range(N):\n if p[i] == i:\n count+=1\nif count<=2 : \n print("YES")\nelse:\n print("NO")', 'N = int(input())\np = input().split()\ncount=0\nfor i in range(N):\n if p[i] != i:\n count+=1\nif count<=2 : \n print("YES")\nelse...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s670836625', 's806826822', 's082844385']
[3060.0, 2940.0, 2940.0]
[18.0, 18.0, 17.0]
[162, 153, 175]
p02958
u648422705
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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 = input()\nlist_input = input().split(" ")\nN = int(num_input)\ncount = 0\nfor i in range(0,N-1):\n check = int(list_input[i])-int(list_input[i+1])\n if check > 1:\n count += 2\n break\n else:\n count += max(check,0)\nif count >= 2:\n print(\'NO\')\nelse:\n print(\'YES\')\n\n', 'num_input = in...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s113080553', 's219975186', 's764244656']
[3060.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0]
[280, 277, 257]
p02958
u655048024
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\njudge = 0\nfor i in range(N):\n if (p[i] == i):\n None\n else:\n judge += 1\nif judge <= 2:\n print("YES")\nelse:\n print("NO")\n\n ', 'N = int(input())\np = list(map(int,input().split()))\ncou = 0\nfor i in range(1,N+1):\n if(p[i-1]==n):\n None\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s238927243', 's292464750', 's650611612']
[2940.0, 2940.0, 2940.0]
[19.0, 18.0, 17.0]
[184, 179, 179]
p02958
u656246389
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['if __name__ == \'__main__\':\n n = int(input()\n ps = [int(x) for x in input().split()]\n\n dis = []\n\n for n, p in enumerate(ps):\n if n + 1 != p:\n dis.append(p)\n\n if len(dis) == 2 or len(dis) == 0:\n print("YES")\n else:\n print("NO")', ' n = int(input()\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s281683362', 's744031980', 's887593826']
[2940.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0]
[275, 248, 276]
p02958
u656803083
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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):\n if i+1 != p[i]:\n count += 1\n\nif count == 2:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\np = list(map(int,input().split()))\ncount = 0\nfor i in range(n):\n if i+1 != p[i]:\n count += 1\n\nif count <= 2:\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s505653020', 's595983464', 's628442066', 's245258456']
[9036.0, 9092.0, 9116.0, 9116.0]
[27.0, 26.0, 29.0, 29.0]
[166, 164, 180, 164]
p02958
u657329920
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()\np = [int(num) for num in p]\nif p == sorted(p):\n print("Yes")\nelse:\n t = 0\n for i in range(N-1):\n if p[i+1] == p[i] + 1:\n continue\n else:\n t += 1\n print(t)\n if t == 2 or t == 3 or t == 4:\n print("Yes")\n else:\n print("No")', 'N = int(inp...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s030787332', 's106929909', 's143651196', 's146704596', 's178713686', 's351787170', 's443645288', 's476711604', 's850546685', 's900081603', 's955332661', 's226730682']
[3064.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0, 18.0, 17.0, 17.0, 18.0, 27.0, 17.0, 17.0, 17.0, 17.0]
[287, 267, 254, 254, 277, 254, 227, 331, 237, 254, 227, 278]
p02958
u658987783
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nT=sorted(S)\n\ncount=0\nfor i in range (len(S)):\n if S[i]!=T[i]:\n count+=1\nif count<=2:\n print("Yes")\nelse:\n print("No")', 'N=int(input())\nS=list(map(int,input().split()))\n\nT=sorted(S)\n\ncount=0\nfor i in range (len(S)):\n if S[i]!=T[i]:\n count+...
['Wrong Answer', 'Accepted']
['s471165997', 's454736991']
[3060.0, 3060.0]
[17.0, 17.0]
[172, 172]
p02958
u662430503
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['import math\ndef main():\n n=int(input())\n p = list(map(int,input().split()))\n first=-1\n last=-1\n \n for i in range(0,n-1):\n if p[i]>p[i+1]:\n first=i\n break\n for i in reversed(range(1,n)):\n if p[i]<p[i-1]:\n last=i\n break\n \n if first!=-1 and last!=-1:\n tmp=p[first]\n...
['Wrong Answer', 'Accepted']
['s861978808', 's271176223']
[8952.0, 9168.0]
[27.0, 30.0]
[455, 455]
p02958
u663014688
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\ncnt = 0\n\nfor i in range(len(L)):\n if L[i] != i+1:\n cnt += 1\n print(L[i])\n print(i+1)\nif cnt >= 3:\n print('NO')\nelse:\n print('YES')", "N = int(input())\nL = list(map(int, input().split()))\ncnt = 0\n\nfor i in range(len(L)):\n if...
['Wrong Answer', 'Accepted']
['s136421764', 's380529659']
[3060.0, 2940.0]
[17.0, 17.0]
[205, 174]
p02958
u664907598
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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()))\nflag = True\nfor i in range(1,n):\n if p[i] < p[i-1]:\n flag = False\n continue\nif flag:\n print('YES')\n sys.exit()\n\nfor i in range(n-1):\n for j in range(i,n):\n pp = p\n pp[i] = p[j]\n ...
['Wrong Answer', 'Accepted']
['s318442096', 's841735467']
[3064.0, 3444.0]
[28.0, 91.0]
[529, 612]
p02958
u665598835
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nsuuretsu_str = input().split()\nsuuretsu = [int(i) for i in suuretsu_str]\nsuuretsu_order = [i for i in range(1,N+1)]\ncount = 0\nfor i in range(N):\n if suuretsu[i] != suuretsu_order[i]\n count += 1\nif count == 2:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\nsuuretsu_str = ...
['Runtime Error', 'Accepted']
['s237178257', 's992815059']
[2940.0, 3064.0]
[17.0, 17.0]
[270, 289]
p02958
u668503853
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\nli=[]\nfor i in range(N):\n if A[i]!=AA[i]:\n li.append(A[i])\nif len(li)>2:\n print("NO")\nelse:\n print("YES")', 'N=int(input())\nA=list(map(int,input().split()))\nAA=sorted(A)\nli=[]\nfor i in range(N):\n if A[i]!=AA[i]:\n li.append(A[i])\nif len(li)>2:\n...
['Runtime Error', 'Accepted']
['s998099208', 's724172700']
[3060.0, 2940.0]
[17.0, 17.0]
[159, 173]
p02958
u668705838
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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 numpy as np\np = np.array(list(map(int, input().split())))\nps = np.array(sorted(p))\ns = np.sum(p==ps)\nif s==0 or s==2:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\nimport numpy as np\np = np.array(list(map(int, input().split())))\nps = np.array(sorted(p))\ns = np.sum(p!=ps)\n...
['Wrong Answer', 'Accepted']
['s320338216', 's379178285']
[21804.0, 21420.0]
[820.0, 314.0]
[176, 177]
p02958
u671211357
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\nB = list(reversed(S))\nB.sort()\ncount = 0\nfor i in range(len(S)):\n if S[i] != B[i]:\n count += 1\nif count == 2 or count == 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nS = list(map(int,input().split()))\nB = list(reversed(S))\nB....
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s296686387', 's789655727', 's018350955']
[3064.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[224, 224, 225]
p02958
u672494157
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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\nsys.setrecursionlimit(4100000)\n\n\ndef inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef solve(inputs):\n p = string_to_int(inputs[0])\n\n diff_point = []\n for i, num in enumerate(range(1, len(p)+1)):\n if num != p[i]:\n diff_po...
['Runtime Error', 'Accepted']
['s532211351', 's714855612']
[2940.0, 3064.0]
[17.0, 17.0]
[574, 573]
p02958
u672542358
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\nr=list(range(1,n+1))\ns=0\nm=0\nif l==r:\n m=1\n print("YES")\nelse:\n while s<n:\n for i in range(n):\n r=list(range(1,n+1))\n d=r[s]\n r[s]=r[i]\n r[i]=d\n if l==r:\n print("Yes")\n s=n\n m=1\n break\n s=...
['Wrong Answer', 'Accepted']
['s407468613', 's193433143']
[3064.0, 3064.0]
[20.0, 20.0]
[328, 328]
p02958
u674052742
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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"""\nCreated on Fri May 15 00:38:52 2020\n\n@author: Kanaru Sato\n"""\n\nn = int(input())\np = list(map(int,input().split()))\n\nyesflag = 1\na = [p[i] for i in range(n)]\nfor k in range(n-1):\n if a[k] > a[k+1]:\n yesflag = 0\n break\n\nif yesflag == 0:\n for i in range(n...
['Wrong Answer', 'Accepted']
['s347323718', 's955089728']
[3064.0, 3064.0]
[22.0, 22.0]
[746, 746]
p02958
u674959776
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n=int(input())\np=list(map(int,input().split()))\n\nl=list(range(1,n+1))\nk=0\nfor i in range(n):\n if p[i]==l[i]:\n k+=1\nif k==0 or k==2:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\np=list(map(int,input().split()))\n\nl=list(range(1,n+1))\nk=0\nfor i in range(n):\n if p[i]!=l[i]:\n ...
['Wrong Answer', 'Accepted']
['s467150703', 's577367826']
[3060.0, 3060.0]
[18.0, 17.0]
[180, 180]
p02958
u677267454
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\ntmp1 = -1\ntmp2 = -1\nswap = False\nans = True\nfor i in range(1, N):\n if p[i - 1] > p[i]:\n if tmp1 < 0 and not swap:\n tmp1 = p[i - 1]\n tmp2 = p[i]\n elif not swap:\n if p[i] < tmp2 and p[i - 1] < tmp1:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s192400579', 's825551012', 's646641125']
[3064.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[501, 214, 214]
p02958
u677577916
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nvalue = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n if value[i] != i + 1:\n count += 1\nif count > 2:\n ans = "No"\nelse:\n ans = "Yes"\nprint(ans)', 'N = int(input())\nvalue = list(map(int, input().split()))\ncount = 0\nans = "Yes"\nfor i in range(N-1):\n if ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s034089573', 's080306153', 's441374048', 's808453906', 's198717121']
[3060.0, 3060.0, 3060.0, 3060.0, 2940.0]
[18.0, 17.0, 18.0, 17.0, 17.0]
[192, 184, 182, 293, 192]
p02958
u685410538
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()]\ncount = 0\nfor j in range(N):\n if(List[j] != j+1):\n count+=1\nif(count <=2):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nList = [int(i) for i in input().split()]\ncount = 0\nfor j in range(N):\n if(List[j] != j+1):\n ...
['Wrong Answer', 'Accepted']
['s326305341', 's245195830']
[2940.0, 3060.0]
[17.0, 26.0]
[181, 181]
p02958
u685662874
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["n=int(input())\nplist=list(map(int, input().split()))\nk=0\nfor i in range(n):\n if i != plist[i]:\n k+=1\nif k <= 2:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nplist=list(map(int, input().split()))\nk=0\nfor i in range(1,n+1):\n if i != plist[i]:\n k+=1\nif k <= 2:\n print('Y...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s687919223', 's819340742', 's314483561']
[2940.0, 3060.0, 2940.0]
[17.0, 18.0, 17.0]
[160, 164, 166]
p02958
u686230543
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nwrong = 0\nfor i, p in enemerate(map(int, input().split()), start=1):\n wrong += int(i != p)\n\nif wrong == 0 or wrong == 2:\n print('YES')\nelse:\n print('NO')", "n = int(input())\n\nwrong = 0\nfor i, p in enumerate(map(int, input().split()), start=1):\n wrong += int(i != p)\n\nif wrong == 0 ...
['Runtime Error', 'Accepted']
['s387511692', 's397409250']
[3060.0, 2940.0]
[17.0, 17.0]
[174, 174]
p02958
u688219499
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nk = sorted(p)\ncount = 0\nfor i in range(n):\n if q[i] != k[i]:\n count += 1\nif count == 2 or count ==0:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\np = list(map(int,input().split()))\nq = p\nk = sorted(p)\ncount = 0\nfor i in ...
['Wrong Answer', 'Accepted']
['s174147249', 's092329795']
[9068.0, 9048.0]
[28.0, 26.0]
[207, 207]
p02958
u688375653
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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())\nnum = list(map(int, input().split() ))\n\ntrue_num = copy.deepcopy(num)\ntrue_num = sorted(true_num)\n\nswap_org=[]\nswap_true=[]\n\ncount=0\nfor x,y in zip(num,true_num):\n if x != y:\n count += 1\n swap_org.append(x)\n swap_true.append(y)\n\nif count!=0:\n ...
['Wrong Answer', 'Accepted']
['s192478580', 's311344470']
[3444.0, 3444.0]
[22.0, 23.0]
[335, 461]
p02958
u690536347
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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())\n\nv = sum(1 for i,j in zip(range(1, N+1), p) if i!=j)\nprint("Yes" if v<=2 else "No")', 'N = int(input())\n*p, = map(int, input().split())\n\nv = sum(1 for i,j in zip(range(1, N+1), p) if i!=j)\nprint("YES" if v<=2 else "NO")']
['Wrong Answer', 'Accepted']
['s160669023', 's646553683']
[3060.0, 2940.0]
[18.0, 17.0]
[132, 132]
p02958
u692054751
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nprint('Yes' if sum(map(lambda x: x[0] == x[1], zip(p, sorted(p)))) >= N - 2 else 'No')\n", "N = int(input())\np = [int(s) for s in input().split()]\n\nprint('YES' if sum(map(lambda x: x[0] == x[1], zip(p, sorted(p)))) >= N - 2 else 'NO')"]
['Wrong Answer', 'Accepted']
['s196695657', 's880062638']
[2940.0, 3064.0]
[17.0, 18.0]
[143, 142]
p02958
u692258787
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N=int(input())\nfalse=0\np=[int(N) for N in input().split()]\nfor i in range(N):\n if p[i]!=i+1:\n false+=1\nif false>2:\n print("No")\nelse:\n print("Yes")\n', 'N=int(input())\nfalse=0\np=[int(N) for N in input().split()]\nfor i in range(N):\n if p[i]!=i+1:\n false+=1\nif false>2:\n...
['Wrong Answer', 'Accepted']
['s360481945', 's272974926']
[2940.0, 2940.0]
[17.0, 17.0]
[169, 169]
p02958
u692453235
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nP = list(map(int, input().split()))\ncount = 0\n\nfor i in range(N):\n if P[i] == i+1:\n continue\n else:\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\n\nfor i in range(N):\n if P[i] ==...
['Wrong Answer', 'Accepted']
['s947588476', 's233595692']
[2940.0, 2940.0]
[18.0, 18.0]
[201, 201]
p02958
u695655590
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["N = int(input())\nA = list(map(int, input().split()))\n\ncount = 0 \nfor i in range(N):\n if A[i] != i + 1:\n count = count + 1\n\nif count == 0 or count == 2:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nA = list(map(int, input().split()))\n \ncount = 0 \nfor i in range(N):\n if A[i] != i + 1:\n...
['Wrong Answer', 'Accepted']
['s853926553', 's613503010']
[2940.0, 2940.0]
[17.0, 17.0]
[191, 193]
p02958
u698919163
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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] < p[i+1]:\n count += 1\n \nif count == 2:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\np = list(map(int,input().split()))\ncount = 0\nfor i in range(n-1):\n if p[i] > p[i+1]:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s003643274', 's416482227', 's504744007', 's882619124', 's954508530']
[2940.0, 3060.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0, 17.0, 17.0]
[186, 186, 192, 187, 190]
p02958
u699296734
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nwrong = 0\nfor i in range(1, n + 1):\n if i == p[i - 1]:\n pass\n else:\n wrong += 1\n\nif wrong <= 2:\n print("Yes")\nelse:\n print("No")\n', 'n = int(input())\np = list(map(int, input().split()))\n\nswap = 0\n\nfor i in range(n):\n ...
['Wrong Answer', 'Accepted']
['s553974947', 's965519851']
[9024.0, 9104.0]
[26.0, 26.0]
[209, 382]
p02958
u703130195
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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_p = list(map(int, input().split()))\ncount = 0\nflag = True\nfor i in range(N):\n if li_p[i] != i+1:\n count += 1\n if count > 2:\n flag = False\n break\nif flag:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nli_p = list(map(int, input().spl...
['Wrong Answer', 'Accepted']
['s393195662', 's818292312']
[3060.0, 3060.0]
[17.0, 17.0]
[251, 251]
p02958
u703890795
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\nerr = 0\nfor i in range(N):\n if p[i]!=i:\n err += 1\nif err == 0:\n print("YES")\nelif err == 2:\n print("YES")\nelse:\n print("NO")', 'N = input(int())\np = list(map(int, input().split()))\nerr = 0\nfor i in range(N):\n if p[i]!=i:\n err+=0\nif err =...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s490176479', 's551197504', 's352537218']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[184, 182, 188]
p02958
u707030679
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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)\nc=0\nans="No"\nfor i in range(n):\n if P[i]!=S[i]:\n c+=1\nif c<=2 :\n ans ="Yes"\nprint(ans)', 'n=int(input())\nP=list(map(int,input().split()))\nS=sorted(P)\nc=0\nans="NO"\nfor i in range(n):\n if P[i]!=S[i]:\n c+=1\nif c<=2 :\n ...
['Wrong Answer', 'Accepted']
['s541613025', 's154119842']
[9104.0, 9048.0]
[27.0, 25.0]
[159, 159]
p02958
u707225322
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["list = [for int(i) in input.split()]\n\ncount = 0\nfor i in range(0, len(list)-1):\n if list[i] < list[i+1]:\n count += 1\n \t\nif count > 2:\n print('NO')\nelse:\n print('YES')", "a = [for int(i) in input.split()]\n \ncount = 0\nfor i in range(0, len(a)-1):\n if a[i] > a[i+1]:\n count += 1\n if count >...
['Runtime Error', 'Runtime Error', 'Accepted']
['s038495797', 's109236260', 's334256493']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[173, 198, 192]
p02958
u707870100
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and 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#B\nimport sys\nimport math\n\n\nn = int(input())\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\n\n#print(hoge)\n\nfor i in range(0,n-1):\n\tif(hoge[i]<hoge[i+1]):\n\t\tif(i==n-2):\n\t\t\tprint("YES")\n\t\t\tsys.exit()\n\telse:\n\t\tbreak\n\nfor i in range(0,n-1):\n\tfor j i...
['Wrong Answer', 'Accepted']
['s649752544', 's784527829']
[3064.0, 3064.0]
[18.0, 19.0]
[474, 517]
p02958
u712868001
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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 A=p[i+1]\n B=p[i]\n print(A)\n print(B)\n if A < B:\n count=count+1\n if count >= 3:\n print('NO')\n break\n if A > B:\n if i == (N-1) and count < 3:\n print('YES'...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s123940111', 's392805814', 's644034235', 's761204791', 's962067061', 's798154371']
[3064.0, 3060.0, 3060.0, 3064.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[322, 272, 270, 479, 296, 182]
p02958
u716530146
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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)]\ncount =0\nfor s,t in enumerate(p):\n\tprint(s,t)\n\tif s !=(t-1):\n\t\tcount+=1\nif count == 2 or count == 0:\n\tprint("YES")\nelse:\n\tprint("NO")', 'n = int(input())\np = [int(input(i)) for i in range(n)]\ncount =0\nfor s,t in enumerate(p):\n\tprint(s,t)\n\tif...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s085596098', 's260751747', 's264921380', 's683717663', 's949517016']
[3060.0, 3060.0, 3060.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[187, 188, 188, 154, 155]
p02958
u716922016
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
["S = int(input())\nslist = input().split()\n\nnew_list = sorted(slist)\nd_count = 0\nfor i,j in zip(slist,new_list):\n if i != j:\n d_count += 1\n \nif d_count == 2:\n print('Yes')\nelif d_count ==0:\n print('Yes')\nelse:\n print('No')\n", "S = int(input())\nslist = input().split()\n\nfor i,a in enumerate(sl...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s006760085', 's118455829', 's127035344', 's321143832', 's494465429', 's924576180', 's587931609']
[2940.0, 3060.0, 3064.0, 2940.0, 2940.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[231, 247, 280, 196, 196, 281, 247]
p02958
u718411265
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_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(input())\nfor i,j in range(N):\n N2=N[i],N[j]=N[j],N[i]\n if N2==N.sort():\n print("YES")\n break\nelse:\n print("NO")\n ', 'N=int(input())\nl=list(map(int,input().split()))\na=l.sort()\ncount=0\nfor i in range(0,len(l)):\n if l[i]==a[i]:\n count+=1\nif count >= N-2:\n print("YES")\nelse:\n pri...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s179519308', 's278377700', 's638190251', 's745390518', 's001679969']
[2940.0, 3060.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 18.0, 17.0, 19.0]
[130, 174, 174, 123, 175]
p02958
u719886494
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['cnt = 0\nn = int(input())\nfor i int rangr(1, n + 1):\n p = map(int, input().split()\n if int(i) != p :\n cnt += 1\n if cnt >= 2:\n break\nif cnt <= 1 :\n print("YES")\nelse :\n print("NO")\n', 'cnt = 0\nn = int(input())\np = list(map(int, input().split())\nfor i in range(1, n + 1):\n if int(i) != p[...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s028131304', 's066078984', 's079987164', 's293738066', 's313083811', 's373847580', 's425885598', 's802359396', 's214883214']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 18.0, 17.0, 18.0, 17.0, 17.0, 18.0]
[195, 205, 196, 183, 198, 183, 193, 182, 206]
p02958
u720065198
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_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()))\ns = sorted(p)\nk = 0\nfor i in range(N):\n if p[i]!=s[i]:\n k += 1\nif k < 3 :\n print("YES")\nelse:\n print("NO")', 'N = int(input())\np = list(map(int,input().split()))\ns = sorted(p)\nk = 0\nfor i in range(N):\n if p[i]!=s[i]:\n k += 1\nif k < 3 :\n pr...
['Runtime Error', 'Accepted']
['s572512898', 's048479218']
[2940.0, 3060.0]
[17.0, 17.0]
[161, 166]
p02958
u720384347
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()\nP = [int(p) for p in P]\n\ncount = 0\nfor i in range(N):\n if(P[i] != i+1):\n count += 1\n\nif(count>2):\n print("No")\nelse:\n print("Yes")', 'N = int(input())\nP = input().split()\nP = [int(p) for p in P]\n\ncount = 0\nfor i in range(N):\n if(P[i] != i+1):\n...
['Wrong Answer', 'Accepted']
['s549083967', 's419353942']
[3060.0, 3060.0]
[17.0, 18.0]
[183, 183]
p02958
u724428568
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nres = "Yes"\nif list(range(1, n+1)) == p:\n res = "Yes"\nelse:\n count = 0\n for n_e, p_e in zip(range(1,n+1), p):\n if n_e != p_e:\n count += 1\n if count == 3:\n res = "No"\n break\n\n\nprint(res)', 'n = int(input())\np = list(map(int,...
['Wrong Answer', 'Accepted']
['s406674285', 's922726505']
[3064.0, 3060.0]
[17.0, 17.0]
[263, 263]
p02958
u728120584
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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_t = [i for i in range(1, N+1)]\ncount = 0\nfor i in range(N):\n if p[i] != p_t[i]:\n count += 1\n\nif count == 2 or count == 0:\n print('Yes')\nelse:\n print('No')", "N = int(input())\np = list(map(int, input().split()))\np_t = [i for i in range...
['Wrong Answer', 'Accepted']
['s043235998', 's347962511']
[3060.0, 3060.0]
[17.0, 17.0]
[225, 225]
p02958
u729535891
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()))\nl = sort(s)\ncnt = 0\nfor i in range(len(s)):\n if s[i] != l[i]:\n cnt += 1\n\nprint('NO' if cnt > 2 else 'YES')", "n = int(input())\ns = list(map(int, input().split()))\nl = sorted(s)\ncnt = 0\nfor i in range(len(s)):\n if s[i] != l[i]:\n cnt...
['Runtime Error', 'Accepted']
['s282545872', 's999868169']
[3060.0, 3060.0]
[17.0, 17.0]
[169, 171]
p02958
u731028462
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['l = int(input())\nps = list(map(int, input().split()))\nc = 0\nfor i in range(1,l):\n if ps[i]<ps[i-1]:\n c+=1\nif c>1:\n print("NO")\nelse:\n print("YES")', 'l = int(input())\nps = list(map(int, input().split()))\nc = 0\nfor i in range(l):\n c += (ps[i]!=i+1)\nif c>2:\n print("NO")\nelse:\n ...
['Wrong Answer', 'Accepted']
['s184995582', 's731003098']
[3060.0, 2940.0]
[17.0, 18.0]
[162, 147]
p02958
u735233212
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\np = list(map(int, input().split()))\n\nl = sorted(p)\ncount = 0\n\nfor a, b in zip(p, l):\n if (a is not b): 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()))\n\nl = sorted(p)\ncount = 0\n\nfor a, b...
['Runtime Error', 'Accepted']
['s637913160', 's943479901']
[3064.0, 3060.0]
[17.0, 17.0]
[209, 208]
p02958
u739843002
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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(lambda x: int(x), input().split(" ")))\n\ncnt = 0\nfor i in range(len(p)):\n cnt += 1 if p[i] != i + 1 else 0\n\nprint("Yes") if cnt in [0, 2] else print("No")', 'N = int(input())\np = list(map(lambda x: int(x), input().split(" ")))\n\ncnt = 0\nfor i in range(len(p)):\n cnt += 1 if p[...
['Wrong Answer', 'Accepted']
['s248044674', 's442410556']
[9172.0, 9156.0]
[30.0, 30.0]
[184, 184]
p02958
u740047492
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()]\ncount=0\nfor i in range(n-1):\n for j in range(1,n):\n if p[i]>p[j]:\n count+=1\nif count>=3:\n print("NO")\nelse:\n print("YES")\n', 'zn=int(input())\np=[int(i) for i in input().split()]\ncount=0\nfor i in range(n-1):\n for j in range...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s008324865', 's141274542', 's483917200', 's872681546', 's167032509']
[2940.0, 2940.0, 2940.0, 3572.0, 3064.0]
[18.0, 17.0, 18.0, 21.0, 17.0]
[200, 229, 202, 227, 190]
p02958
u743384563
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nlN=[]\nfor i in range(1,N+1):\n lN.append(i)\n \ncnt = 0 \nfor i in range(N):\n if lN[i] != P[i]:\n cnt += 1\n \nif cnt == 0 or 2: \n print("Yes")\nelse:\n print("No")', 'N = int(input())\nP = list(map(int,input().split()))\n\nlN=[]\nfor i in ra...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s172885518', 's636956735', 's934317769']
[3060.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[225, 232, 232]
p02958
u746419473
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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())\n\nq = sorted(p)\nans = 0\nfor _p, _q in zip(p, q):\n if _p != _q:\n ans += 1\n\nprint("Yes" if ans <= 2 else "No")\n', 'n=int(input())\np=list(map(int, input().split()))\n\nj=1\nnumofswap=0\nfor i in range(n):\n if p[i] != j:\n numofswap+=1\n j...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s472208235', 's624351849', 's852961727', 's716918094']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[167, 175, 187, 167]
p02958
u746849814
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\nif p == list(range(1, N+1)):\n print('YES')\nelse:\n for i, n in enumerate(p):\n if n != i+1:\n break\n j = p[p.index(i+1)]\n p[p.index(i+1)] = n\n p[i] = j\n if p == list(range(1, N+1)):\n print('Yes')\n else:\n ...
['Wrong Answer', 'Accepted']
['s643337982', 's893041737']
[3064.0, 3064.0]
[17.0, 18.0]
[319, 337]
p02958
u747309718
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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 = 0\nout = 0\n \nfor num in range(n):\n if(m + 1 != l[m]):\n out += 1\n m += 1\n \nif(out > 2):\n print('No')\nelse:\n print('Yes')", "n = int(input())\nl = list(map(int,input().split()))\nm = 0\nout = 0\n\nfor num in range(n):\n if(m + 1 != l[m]):\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s843557412', 's982251342', 's580628641']
[3060.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0]
[181, 182, 181]
p02958
u747427153
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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()]\ns = 0\nfor i in range(n):\n if p[i] != i + 1:\n s += 1\nif s > 2:\n print("No")\nelse:\n print("Yes")', 'n = int(input())\np = [int(i) for i in range(n)]\ns = 0\nfor i in range(n-1):\n if p[i] > p[i+1]:\n s += 1\nif s >= 2:\n print("No")\nelse:\n pr...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s352188981', 's414217495', 's446213303', 's503406633', 's694235196', 's965594352', 's684315129']
[3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 18.0, 17.0, 17.0, 18.0]
[155, 151, 152, 148, 151, 150, 155]
p02958
u748241164
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['N = int(input())\nlist1 = list(map(int, input().split()))\ncount = 0\n \nfor i in range(N-1):\n if list1[i] > list1[i+1]:\n count += 1\nprint(count)\nif count == 0 or count == 1:\n print("YES")\nelif count >= 3:\n print("NO")\nelse:\n count = 0\n list2 = []\n for i in range(N-1):\n if list1[i] > list1[i+1...
['Wrong Answer', 'Accepted']
['s473203152', 's975262800']
[3064.0, 3188.0]
[17.0, 20.0]
[549, 814]
p02958
u756195685
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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\tif p[i + 1] - p[i] != 1:\n count += 1\nif count <= 2:\n print("YES")\nelse:\n print("NO")', 'N = int(input())\np = list(map(int,input().split()))\ns = list(range(1,N+ 1))\ncount = 0\nfor i in range(N):\n if s[i] != p[i]:...
['Runtime Error', 'Accepted']
['s068623263', 's552440874']
[2940.0, 3060.0]
[17.0, 17.0]
[176, 202]
p02958
u757030836
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note that you can also choose not to perform it. Print `YES` if you can sort p in ascending order in th...
['n = int(input())\nplst = list(map(int,input().split()))\nplst_sort = sorted(plst)\ncnt = 0\nfor i in range(N):\n if plst[i] != plst_sort[i]:\n cnt += 1\nif cnt == 2 or cnt == 0:\n print("YES")\nelse:\n print("NO")\n', 'n = int(input())\nplst = list(map(int,input().split()))\nplst_sort = sorted(plst)\n...
['Runtime Error', 'Accepted']
['s673263044', 's001442692']
[2940.0, 2940.0]
[17.0, 17.0]
[220, 229]
p02958
u761087127
2,000
1,048,576
We have a sequence p = {p_1,\ p_2,\ ...,\ p_N} which is a permutation of {1,\ 2,\ ...,\ N}. You can perform the following operation at most once: choose integers i and j (1 \leq i < j \leq N), and swap p_i and p_j. Note 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(n) for n in input().split()]\nX = [n for n in range(1, N+1)]\nans = sum([0 if p==x else 1 for p,x in zip(p,X)])\nprint("Yes" if ans <= 2 else "No")', 'N = int(input())\np = [int(n) for n in input().split()]\nX = [n for n in range(1, N+1)]\nprint("Yes" if sum([0 if p==X else 1 for p,x in zip...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s352600867', 's368206553', 's479281891']
[3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[170, 159, 172]