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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02596 | u955255448 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ['ans = -1\nif K in [2,5]:\n pass\nelse:\n num = 7\n ans = 0\n while True:\n ans += 1\n if num % K == 0:\n break\n else:\n num = (num * 10 + 7)%K\nprint(ans)', 'K = int(input())\nans = -1\nif K%2 == 0:\n pass\nelif K%5 == 0:\n pass\nelse:\n num = 7\n an... | ['Runtime Error', 'Accepted'] | ['s129594112', 's735640349'] | [9004.0, 9116.0] | [26.0, 237.0] | [198, 237] |
p02596 | u956547804 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ['k=int(input())\nif k%2==0 k%5==0:\n print(-1)\n exit()\na=0\nfor i in range(k):\n a=(a*10+7)%k\n if a==0:\n print(i+1)\n exit()', 'k=int(input())\nif k%2==0 or k%5==0:\n print(-1)\n exit()\na=0\nfor i in range(k):\n a=(a*10+7)%k\n if a==0:\n print(i+1)\n exit()'] | ['Runtime Error', 'Accepted'] | ['s552794738', 's338806334'] | [9008.0, 9180.0] | [24.0, 188.0] | [144, 147] |
p02596 | u957799665 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ['k = int(input())\ni = 0\ns = 0\nans = -1\n\nfor z in range(k):\n i += 1\n #s = (7 + 10*s) % k\n s = 7 + 10*s\n if s % k != 0:\n s = s % k\n else:\n ans = i\n\nprint(i)\n', 'b=7\nd=0\ne =-1\ni=1\na = int(input())\nwhile True:\n d = 7 + 10*d\n print(d)\n if a % 2 == 0:\n pri... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s442645837', 's770256332', 's875243061'] | [9056.0, 33996.0, 9024.0] | [275.0, 2259.0, 276.0] | [183, 187, 174] |
p02596 | u958869885 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ['k = int(input())\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\nelse:\n myconst = 7 % k\n cnt = 1\n while True:\n if not myconst:\n print(cnt)\n break\n\t else:\n myconst = ((10 * myconst) + 7) % k\n cnt += 1\n \n \n', "k = int(input())\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\nelse:\n m... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s740875397', 's888591764', 's135537996'] | [9028.0, 8856.0, 9036.0] | [29.0, 25.0, 191.0] | [227, 194, 228] |
p02596 | u966207392 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ["def make_divisors(n):\n lower_divisors , upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\nK = int(input... | ['Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s211588765', 's325925723', 's471977856', 's112147844'] | [9064.0, 9184.0, 9092.0, 9036.0] | [600.0, 586.0, 2206.0, 186.0] | [508, 483, 508, 186] |
p02596 | u975997984 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ["K = int(input())\na = 0\nn = 0\nout = '-1'\nfor _ in range(K):\n a += 7 * (10 ** n)\n if a % K == 0:\n out = n + 1\n break\nprint(out)\n", "K = int(input())\nres = '-1'\na = 0\nfor n in range(K):\n a += 7*(10**n)\n if a%K==0:\n res = n+1\nprint(res)", 'K = int(input())\na = 0\nn = 0\nout = -1\nfor _ in r... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s018296495', 's273333960', 's383876992', 's572474279', 's605129108', 's922419092', 's743283088'] | [9184.0, 9176.0, 9016.0, 9096.0, 9000.0, 9068.0, 48640.0] | [194.0, 2206.0, 27.0, 213.0, 27.0, 172.0, 307.0] | [134, 107, 139, 133, 201, 131, 210] |
p02596 | u977104016 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ["k=input()\nif int(k)%2==0:\n print(-1)\nelse:\n s='7'\n flag=0\n for _ in range(12):\n if int(s)%int(k)==0:\n flag=1\n print(len(s))\n break\n s=s+'7'\n if flag==0 and k[-1]=='3':\n print(int(k)-1)\n else:\n print(-1)", 'k=input()\nif int(... | ['Wrong Answer', 'Accepted'] | ['s153331304', 's152372278'] | [9120.0, 9152.0] | [34.0, 657.0] | [281, 269] |
p02596 | u987155832 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ['cnt = 1\nmod = 7\nk = int(input())\n\nfor i in range(k):\n if mod % k == 0:\n break\n cnt += 1\n mod = (mod * 10 * 7) % k\n\nif mod % k == 0:\n print(cnt)\nelse:\n print(-1)\n', 'cnt = 1\nmod = 7\nk = int(input())\n\nfor i in range(k):\n if mod % k == 0:\n break\n cnt += 1\n mod = (mod * 10 * ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s357718308', 's388277751', 's507503064'] | [9112.0, 9116.0, 9120.0] | [253.0, 256.0, 277.0] | [169, 183, 182] |
p02596 | u995163736 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ['k = int(input())\nif k % 2 == 0:\n print(-1)\nnana = 0\nans = 0\nprint(len(k))\nwhile True:\n nana += (10**ans) * 7\n #print(nana)\n if nana % k == 0:\n print(ans + 1)\n break\n ans += 1', 'k = int(input())\nif k % 2 == 0:\n print(-1)\nelif k in [1,7]:\n \tprint(1)\nelse:\n amari = [7]\n tmp = 7\n f... | ['Runtime Error', 'Accepted'] | ['s893885477', 's212326172'] | [9140.0, 63884.0] | [27.0, 525.0] | [185, 416] |
p02596 | u999799597 | 2,000 | 1,048,576 | Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. | ['limit = pow(10, 7)\nK = int(input())\nnum = "7"\nif K % 2 == 0 or K % 5 == 0:\n print (-1)\nelse:\n total = 0\n flag = False\n for i in range(limit + 1):\n total = (total * 10 + 7) % K\n if total == 0:\n flag = True\n break\n if flag:\n print (i)\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s654211991', 's559311025'] | [9008.0, 9108.0] | [180.0, 194.0] | [318, 321] |
p02597 | u021849254 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n=int(input())\na=list(input())\nc=a.count("W")\nb=a[:n-c]\nd=b.count("W")\nprint(d)\nprint(b)', 'n=int(input())\na=list(input())\nc=a.count("W")\nb=a[:n-c]\nd=b.count("W")\nprint(d)\n'] | ['Wrong Answer', 'Accepted'] | ['s527508144', 's492342537'] | [13868.0, 11876.0] | [54.0, 40.0] | [88, 80] |
p02597 | u021916304 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["def ii():return int(input())\ndef iim():return map(int,input().split())\ndef iil():return list(map(int,input().split()))\nfrom collections import Counter\n\nn = ii()\ns = input()\n\nd = Counter(s)\nnum = d['R']\nans = num\nwcnt = 0\nrcnt = 0\nfor i in s:\n print(i)\n if i == 'W':\n wcnt += 1\n else:\n... | ['Wrong Answer', 'Accepted'] | ['s379981727', 's475691098'] | [9696.0, 9776.0] | [133.0, 98.0] | [449, 459] |
p02597 | u026788530 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\ns = [_ for _ in input()]\n\nl, r = 0, n-1\nif not('R' in s):\n print(0)\n exit()\n\nif not('W' in s):\n print('0')\n exit()\n\nans = 0\nwhile 1:\n while s[l] == 'R':\n l += 1\n\n while s[r] == 'W' and l <= r:\n r -= 1\n\n s[l] = 'r'\n s[r] = 'w'\n l += 1\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s578625284', 's667817210', 's425851627'] | [11024.0, 11012.0, 11000.0] | [72.0, 66.0, 96.0] | [440, 327, 374] |
p02597 | u032798323 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['import sys\nN = int(input())\nc = input()\nans = 0\nexchange = 0\nfor i in range(N):\n if c[i] == "W":\n exchange = i\n break\nelse:\n print(0)\n sys.exit()\n\nfor i in range(N):\n if N-1-i >exchange:\n if c[-(i+1)] =="R":\n c = c[:exchange]+"R"+c[exchange+1:]\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s005221030', 's167020004', 's762359814', 's406374169'] | [1205808.0, 9512.0, 138524.0, 9480.0] | [2223.0, 41.0, 968.0, 97.0] | [541, 812, 709, 744] |
p02597 | u039860745 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nc = input()\nred_to_white = c.count("R")\nans = red_to_white\nwhile_to_red = 0\n\nfor i in c:\n if i == "W":\n while_to_red += 1 \n else:\n red_to_white -= 1\n ans = min(ans,max(while_to_red,red_to_white))\n print(while_to_red)\n print(red_to_white)\n\nprint(ans)', 'N = ... | ['Wrong Answer', 'Accepted'] | ['s108184108', 's366933444'] | [9480.0, 9400.0] | [229.0, 111.0] | [295, 247] |
p02597 | u043035376 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['\nif w_count >= r_count:\n print(w_count)\nelse:\n print(w_count - right_w_count)\n', 'n = int(input())\n\nc = list(input())\n\nw_count = c.count("W")\nr_count = c.count("R")\n\nright_center = c[r_count:]\nright_w_count = right_center.count("W")\n\nprint(w_count - right_w_count)\n'] | ['Runtime Error', 'Accepted'] | ['s025259358', 's291154743'] | [9004.0, 12064.0] | [32.0, 42.0] | [84, 183] |
p02597 | u048238198 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | [' \n import sys\n import math\n \n sys.setrecursionlimit(10 ** 8)\n ini = lambda: int(sys.stdin.readline())\n inm = lambda: map(int, sys.stdin.readline().split())\n inl = lambda: list(inm())\n ins = lambda: sys.stdin.readline().rstrip()\n debug = lambda *a, **kw: print("\\033[33m", *a, "\\033[0m", **dict(file=sys.stde... | ['Runtime Error', 'Accepted'] | ['s120244397', 's900324630'] | [9008.0, 9428.0] | [25.0, 28.0] | [471, 452] |
p02597 | u058259032 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = list(input())\ncnt = 0\n\nfor i in range(n):\n if c[i] == 'W':\n for j in range(n-1,0,-1 ):\n if c[j] == 'R':\n if i < j:\n c[i] = 'R'\n c[j] = 'W'\n cnt += 1\n print(i, j)\n ... | ['Runtime Error', 'Accepted'] | ['s750888135', 's251162017'] | [141216.0, 9384.0] | [2206.0, 68.0] | [356, 184] |
p02597 | u060793972 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n=int(input())\ns=input()\nl=[0]\nfor i in range(n):\n l.append(l[i]+(s[i]=="R"))\nans=n\nprint(l)\nfor i in range(n+1):\n ans=min(ans,abs(l[i]-i)+abs(l[-1]-l[i]))\n #print(ans,i)\n if i==l[-1]:\n ans=min(ans,abs(l[i]-i))\n #print(ans)\nprint(ans)', 'n=int(input())\ns=input()\nl=[0]\nfor i i... | ['Wrong Answer', 'Accepted'] | ['s191235200', 's156384660'] | [19896.0, 17080.0] | [197.0, 173.0] | [260, 262] |
p02597 | u068844030 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\nc = input()\nlists = list(c)\ncnt = 0\nwhile 1:\n if lists[cnt] == "W":\n cnt += 1\n if cnt == len(lists):\n break\n else:\n break\nnumber = 0\nfor i in range(len(lists) - cnt):\n if lists[i + cnt] == "W":\n number += 1\nprint(number)', 'n = int(input(... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s312324233', 's419331499', 's744024586', 's729785507'] | [10772.0, 10764.0, 10628.0, 10676.0] | [68.0, 62.0, 64.0, 69.0] | [285, 238, 238, 212] |
p02597 | u072717685 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["import sys\nsys.setrecursionlimit(10**6)\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\ndef main():\n n = int(input())\n a = input()\n\n if not 'WR' in a:\n print(0)\n else:\n rightmostW = a.rfind('WR')\n wnum = a[rightmostW:].count('R')\n print(wnum + 1)\n\nif __name... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s082177813', 's099472576', 's389613400', 's634115171', 's657453286', 's681648936', 's844691671', 's913171761', 's290414703'] | [9268.0, 9432.0, 10728.0, 10588.0, 9040.0, 9472.0, 9488.0, 9436.0, 13540.0] | [32.0, 26.0, 38.0, 32.0, 25.0, 31.0, 36.0, 32.0, 48.0] | [332, 328, 538, 537, 395, 330, 428, 499, 409] |
p02597 | u078982327 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = str(input())\n\nr_m = c.count('R')\nw_m = c.count('W')\nwr_m = c.count('WR')\n\nprint(min(r_m, w_m) - wr_m //2)\ns = 0\nif r_m >= w_m:\n for i in range(len(c) - 1):\n if c[i] == 'W' and c[i + 1] == 'R':\n c[i + 1] = 'W'\n s += 1", "n = int(input())\nc = str(input())\n\nr_m = ... | ['Runtime Error', 'Accepted'] | ['s903884475', 's365291896'] | [8944.0, 9432.0] | [25.0, 116.0] | [257, 210] |
p02597 | u087470052 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['from collections import deque\n\nN = int,input()\nc = input()\n\nrd = deque([i for i, x in enumerate(c) if x == "R"])\nwd = deque([i for i, x in enumerate(c) if x == "W"])\nif(len(rd) == 0 or len(wd) == 0):\n print(0)\n exit()\ncount = 0\nfor i in range(len(c)):\n if(not(wd[0] < rd[-1])):\n break\n rd.pop()\n ... | ['Runtime Error', 'Accepted'] | ['s613933144', 's368036770'] | [18816.0, 18896.0] | [82.0, 99.0] | [342, 389] |
p02597 | u088553842 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\ns = input()\nred = []\nwhite = []\nfor i in range(n):\n if s[i] == 'W':\n white.append(i)\nfor i in range(n - 1, -1, -1):\n if s[i] == 'R':\n red.append(i)\n#print(white, red)\nif min(len(red), len(white)) == 0:\n print(0)\n exit()\n\nfor i in range(min(len(red), len(white))):\n if white[... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s180979069', 's489900012', 's380968906'] | [17240.0, 20268.0, 17232.0] | [85.0, 105.0, 93.0] | [341, 338, 372] |
p02597 | u094213642 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = input()\n\nwcount = c.count('R')\ncount = 0\n\nfor i in range(n):\n if c[i] == 'W' and i >= wcount:\n count += 1\nprint(count)\n", "n = int(input())\nc = input()\n\ncount = c.count('R')\nans = 0\n\nfor i in range(n):\n if c[i] == 'R' and i >= count:\n ans += 1\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s765845930', 's986478641'] | [9248.0, 9300.0] | [58.0, 53.0] | [150, 142] |
p02597 | u096128910 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\nc = input()\nans = 0\nfs = 0\nls = N - 1\nfor _ in range(N):\n for i in c[fs:ls]:\n if i == 'W':\n break\n fs += 1\n for i in c[fs:ls:-1]:\n if i == 'R':\n break\n ls -= 1\n if fs >= ls:\n break\n ans += 1\n fs += 1\n ls -= ... | ['Wrong Answer', 'Accepted'] | ['s183018930', 's694401133'] | [9340.0, 9192.0] | [508.0, 123.0] | [376, 216] |
p02597 | u101350975 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['K = int(input())\nif K % 2 == 0 or K % 5 ==0:\n print(-1)\n exit()\nelse:\n n = 7\n n_before = 7\n count = 0\n while True:\n count += 1\n n = n % K\n if n == 0:\n print(count)\n exit()\n else:\n n_before = 10 * n_before % K\n n ... | ['Wrong Answer', 'Accepted'] | ['s462143030', 's715604897'] | [9112.0, 12068.0] | [57.0, 65.0] | [330, 180] |
p02597 | u119982001 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nC = input()\n\nans = 0\nw = C.count("W")\nr = C.count("R")\n\nprint(w, r)\n\nif w <= r:\n print(C[0:w].count("W"))\nelse:\n print(C[w:len(C)].count("R"))\n', 'N = int(input())\nC = input()\n\nans = 0\nw = C.count("W")\nr = C.count("R")\n\nCC = r*"R" + w*"W"\n\nfor i in range(N):\n if C[i] !... | ['Wrong Answer', 'Accepted'] | ['s780519510', 's416187922'] | [9416.0, 9404.0] | [33.0, 65.0] | [166, 180] |
p02597 | u123579949 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nS = input()\nn=0\nif S.find("W")==-1 or S.find("R")==-1:\n print(0)\nelse:\n while S.find("W")<=S.rfind("R"):\n S = S[S.find("W")+1:S.rfind("R")]\n n+=1\n print(n)', 'N = int(input())\nS = input()\nn=0\nif S.find("W")==-1 or S.find("R")==-1:\n print(0)\nelse:\n while S.find("W")<S.rfind("... | ['Time Limit Exceeded', 'Accepted'] | ['s514893499', 's139527573'] | [9400.0, 9356.0] | [2205.0, 340.0] | [181, 199] |
p02597 | u129212218 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n=int(input())\ns=input()\nc=0\nfor i in range(len(s)-1):\n if(s[i]=='W' and s[i+1]=='R'):\n c+=1\nprint(c)", 'n=int(input())\ns=input()\nr=0\nfor i in s:\n if(i=="R"):\n r+=1\nans=0\nfor j in range(r):\n if(s[j]=="W"):\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s893085965', 's489449073'] | [9360.0, 9468.0] | [57.0, 63.0] | [105, 127] |
p02597 | u141419468 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nc = list(map(str, input().split()))\n\na=0\nb=0\n\na = c.count("R")\n\nfor i in range(N):\n if S[i] == \'R\':\n a -= 1\n else:\n b += 1\n\n now = max(a,b)\n ans = min(ans, now)\n\nprint(ans)', 'N = int(input())\nc = list(map(str, input().split()))\n\na=0\nb=0\n\na = c.count... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s358807879', 's617218390', 's707754215', 's876543465', 's819307501'] | [9476.0, 9344.0, 9396.0, 10780.0, 10748.0] | [25.0, 26.0, 24.0, 189.0, 128.0] | [215, 233, 216, 228, 215] |
p02597 | u141786930 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["from collections import deque\n\nN = int(input())\nc = list(str(input()))\ndw = deque()\ndr = deque()\n\nfor i, c in enumerate(c, 1):\n if c == 'W':\n dw.append(i)\n else:\n dr.appendleft(i)\n\nans = 0\nwhile dw:\n w = dw.popleft()\n r = dr.popleft()\n print(w, r)\n if w < r:\n ... | ['Runtime Error', 'Accepted'] | ['s957924846', 's342537420'] | [18684.0, 18720.0] | [133.0, 93.0] | [343, 334] |
p02597 | u145145077 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = input()\n\nw = []\nr = []\nfor i in range(n):\n if c[i] == 'W':\n w.append(i+1)\n else:\n r.append(i+1)\n\nw_len = len(w)\nr_len = len(r)\nif w_len == 0 or r_len == 0:\n print(0)\n exit(0)\n\nw_min = w[0]\nr_max = r[r_len-1]\ncount = 0\nfor i in range(n):\n tmp = w[i]\n w[i] = r[r_le... | ['Runtime Error', 'Accepted'] | ['s651154266', 's708905430'] | [17292.0, 17384.0] | [117.0, 136.0] | [454, 658] |
p02597 | u150788544 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\ns = list(input())\nnum = 0\nk = -1\nfor i in range(1,n):\n if i + k >= n-1:\n break\n if s[-i] == 'R':\n j = k+1\n while True:\n if j +i == n-1:\n k = j\n break\n if s[j] == 'W':\n s[j] = 'R'\n s[-i] = 'W'\n k = j\n num += 1\n bre... | ['Wrong Answer', 'Accepted'] | ['s838451608', 's595699240'] | [10584.0, 10728.0] | [83.0, 82.0] | [352, 343] |
p02597 | u165114979 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\ns = input()\na = [str(c) for c in s]\n\ndef sea(a, z, n):\n while z[0] < n-1:\n if a[z[0]] == 'W':\n break\n z[0] += 1\n \n while z[1] > 0:\n if a[z[1]] == 'R':\n break\n z[1] += 1\n \n return(z)\n\nz = [0, n-1]\n\nz = a(a, z, n)\nc = 0\nwhile z[0] < z[1]:\n a[z[0]], a[... | ['Runtime Error', 'Accepted'] | ['s009490871', 's882441619'] | [11012.0, 11032.0] | [49.0, 119.0] | [356, 368] |
p02597 | u168573507 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nlist=[]\nlist = (str(input()))\ncnt = 0\nR = 0\nW = 0\nans = 0\nfor i in range (N):\n if list[i] == "R":\n R += 1\n\nW = N-R\n\ncnt = min(R, W)\n\nif R >= W:\n for i in range(cnt):\n if list[N-cnt-1]=="R":\n ans +=1\n\nif R<W:\n for j in range(cnt):\n if list... | ['Wrong Answer', 'Accepted'] | ['s419779260', 's326623162'] | [9240.0, 9412.0] | [64.0, 63.0] | [343, 347] |
p02597 | u194228880 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['#n = int(input(\'\'))\n#clist = input(\'\')\nn=2\nclist="RR"\n\nwcnt=clist.count("W")\nrcnt=clist.count("R")\n\nclist1 = clist[0:rcnt]\n\nwcnt2 = clist1.count("W")\n\nprint(wcnt2)', 'n = int(input(\'\'))\nclist = input(\'\')\n\nwcnt=clist.count("W")\nrcnt=clist.count("R")\n\nclist1 = clist[0:rcnt]\n\nwcnt2 = clist1.c... | ['Wrong Answer', 'Accepted'] | ['s674073926', 's917577847'] | [9044.0, 9432.0] | [32.0, 30.0] | [163, 146] |
p02597 | u195272001 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["\nN = int(input())\nC = [str(i) for i in input().split()]\nr = 0\nw = 0 \na = 0\nr = int(C.count('R'))\nfor i in range(r):\n if [a] == w:\n b+=1\n a+=1\nprint(w)", "\nN = int(input())\nC = input()\nr = 0\nw = 0 \nb = 0\nr = C.count('R')\nfor i in range(r):\n if (C[i]=='W'):\n b+=1\nprint(b)"] | ['Wrong Answer', 'Accepted'] | ['s482219819', 's316307286'] | [9396.0, 9472.0] | [27.0, 44.0] | [157, 128] |
p02597 | u202317648 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N=int(input())\nc=input()\nW=[]\nR=[]\npw=0\npr=0\nfor i in range(N):\n if c[i]=="W":\n W+=[i]\n pw+=1\n\n if c[N-1-i]=="R":\n R+=[i]\n pr+=1\n\nfor i in range(200000):\n if min(len(W),len(R))==0:\n result=0\n break\n if W[i]+R[i]>=N:\n result=i\n break\nprint(result)\n... | ['Runtime Error', 'Accepted'] | ['s954970412', 's525487116'] | [17236.0, 17484.0] | [123.0, 137.0] | [304, 304] |
p02597 | u206890818 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["import math\nimport collections\nimport bisect\nfrom collections import deque\nfrom copy import copy, deepcopy\n \n \ndef main():\n N = int(input())\n S = input()\n l=0\n r=len(S)-1\n ans=0\n while(1):\n for i in range(l,len(S)):\n if S[i]=='W':\n l=i\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s556489244', 's659787111', 's208080034'] | [9904.0, 9488.0, 9832.0] | [158.0, 24.0, 111.0] | [592, 589, 573] |
p02597 | u218834617 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N=int(input())\ns=input()\n\nans=0\ni,j=0,N-2\nwhile i<j:\n if s[i]=='R':\n i+=1\n elif s[j]=='W':\n j-=1\n else:\n ans+=1\n i+=1\n j-=1\n\nprint(ans)\n", "N=int(input())\ns=input()\n\nans=0\ni,j=0,N-2\nwhile i<j:\n if s[i]=='R':\n i+=1\n elif s[j]=='W':\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s275908326', 's296388305', 's871568194'] | [9452.0, 9332.0, 9332.0] | [64.0, 65.0, 65.0] | [180, 176, 180] |
p02597 | u261427665 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\na = input()\nb = 0\ndef wr(x):\n c = 0\n for i in range(1, n):\n if a[i-1] == "W" and a[i] == "R":\n c = c + 1\n else:\n c = c\n return c\n \nfor i in range(1,n-1):\n if (a[i-1] == "W" and a[i] == "R" and a[i+1] == "R") or (a[i-1] == "W" and... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s041674552', 's847767966', 's679295395'] | [9428.0, 9516.0, 10708.0] | [211.0, 152.0, 70.0] | [493, 479, 168] |
p02597 | u268402865 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['s = input()\nR_num = s.count("R")\ns[:R_num].count("W")\n', 's = input()\nR_num = s.count("R")\nprint(s[:R_num].count("W")\n', 's = input()\nR_num = s.count("R")\nprint(s[:R_num].count("W"))\n', 's = input()\ns = input()\n\nR_num = s.count("R")\nprint(s[:R_num].count("W"))\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s153302159', 's425180271', 's815463282', 's887365140'] | [8976.0, 8944.0, 9084.0, 9324.0] | [27.0, 24.0, 26.0, 29.0] | [54, 60, 61, 74] |
p02597 | u273339216 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\nc = list(input())\na = c.count("R")\nb = 0\ncount = max(a, b)\n\nfor i in range(n+1):\n if c[i] == "R":\n a = a - 1\n else:\n b = b + 1\n ans = max(a, b)\n count = min(ans, count)\nprint(count)\n \n', 'n = int(input())\nc = list(input())\ncount = 0\n\n\nfor i in range(n-1):\n #print(c)\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s261201134', 's651324908', 's971175853', 's815254750'] | [10604.0, 10704.0, 10592.0, 10708.0] | [125.0, 60.0, 124.0, 128.0] | [276, 198, 308, 273] |
p02597 | u274080981 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = input()\nwhite_count, red_count = 0, 0\n\nfor i in range(0, n // 2 + 1):\n if c[i] == 'W':\n white_count += 1\nfor i in range(n // 2+1, n):\n if c[i] == 'R':\n red_count += 1\n\nprint(min(white_count, red_count))\n", "n = int(input())\nc = input()\ncount = 0\n\ni, j = 0, n - ... | ['Wrong Answer', 'Accepted'] | ['s489037263', 's031535162'] | [9480.0, 17156.0] | [53.0, 852.0] | [244, 541] |
p02597 | u292661157 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\n\nc = input()\n\nk = -1\nfor i in range(N):\n if c[i] == 'W' and k == -1:\n k = i \n\nif k == -1 or k == N-1:\n print(0)\nelse:\n w = [0] * N\n r = [0] * N\n\n if c[0] == 'W':\n w[0] = 1\n if c[N-1] == 'R':\n r[N-1] = 1\n for i in range(1,N):\n if c[i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s269633039', 's689806203', 's772370941'] | [18756.0, 21556.0, 18820.0] | [174.0, 219.0, 177.0] | [562, 588, 650] |
p02597 | u310381103 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n=int(input())\ns=input().split()\ns2=sorted(s)\nt=0\nfor i in range(n):\n if s[i]!=s2[i]:\n t+=1\nprint(t)', 'n=int(input())\ns=input()\ns2=sorted(s)\nt=0\nfor i in range(n):\n if s[i]!=s2[i]:\n t+=1\nprint(t//2)\n'] | ['Runtime Error', 'Accepted'] | ['s897151091', 's537622870'] | [9404.0, 11356.0] | [22.0, 69.0] | [104, 100] |
p02597 | u317423698 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["import sys\n\n\ndef resolve(in_):\n n = int(next(in_))\n c = next(in_).strip()\n\n c = c.lstrip('R')\n c = c.rstrip('W')\n if c.count('R') == 0 or c.count('W') == 0:\n return 0\n # print(f'{c=}')\n\n a, b = c[:len(c) // 2], c[len(c) // 2:]\n # while len(a) and len(b) and a.count('W') =... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s304651356', 's373672688', 's985939515'] | [9292.0, 9420.0, 9240.0] | [31.0, 28.0, 50.0] | [666, 666, 469] |
p02597 | u319589470 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['\nimport math\n\ndef I(): return int(input())\ndef LI(): return list(map(int,input().split()))\ndef MI(): return map(int,input().split())\ndef LLI(n): return [list(map(int, input().split())) for _ in range(n)]\n\n\n\n\n\n\n\n\nn,k = MI()\na = LI()\n\ndef cutting_isOK(x,li,k):\n ans = 0\n for i in range(n):\n ... | ['Runtime Error', 'Accepted'] | ['s144123937', 's074164130'] | [9220.0, 12000.0] | [24.0, 36.0] | [1098, 258] |
p02597 | u329319441 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['from math import floor, ceil\nN = int(input())\nWHITE = 0\nRED = 1\nstr = list(map(str, list(input())))\nr = []\nw = []\n\nfor i in range(N):\n w.append(i) if str[i] == "W" else r.append(i)\n str[i] = WHITE if str[i] == "W" else RED\nr.reverse()\n\nmax_count = max(len(r), len(w))\ncount = 0\nfor i in range(max_coun... | ['Runtime Error', 'Accepted'] | ['s768753007', 's951795985'] | [19240.0, 19172.0] | [114.0, 113.0] | [367, 357] |
p02597 | u347640436 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\nc = input()\n\nd = list(c)\n\ni = 0\nj = N - 1\nresult = 0\nwhile i < N and i < j:\n if d[i] == 'W':\n while d[j] != 'R' and i < j:\n j -= 1\n d[i] = 'R'\n d[j] = 'W'\n result += 1\nprint(result)\n", "N = int(input())\nc = input()\n\nd = list(c)\n\ni = 0\nj ... | ['Wrong Answer', 'Accepted'] | ['s160528444', 's781412607'] | [10836.0, 10700.0] | [2206.0, 98.0] | [241, 288] |
p02597 | u350093546 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n=int(input())\ns=list(input())\nx=[]\ny=[]\n\nfor i in range(n):\n if s[i]=='R':\n x+=[i]\n elif s[i]=='W':\n y+=[i]\n \nans=0\nif y==[]:\n print(ans)\nelse:\n while True:\n if x[-1]>y[0]:\n x.pop()\n y.pop(0)\n ans+=1\n continue\n \n else:\n print(ans)\n break", "... | ['Runtime Error', 'Accepted'] | ['s143747109', 's481516698'] | [18660.0, 18772.0] | [817.0, 753.0] | [290, 359] |
p02597 | u363421241 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["from collections import deque\nn = int(input())\nc = deque(input())\n\ncnt = 0\nl = c.popleft()\nr = c.pop()\nwhile c:\n if l == 'R':\n l = c.popleft()\n if r == 'W':\n r = c.pop()\n if l == 'W' and r == 'R':\n cnt += 1\n l = c.popleft()\n if not c:\n break\n ... | ['Runtime Error', 'Accepted'] | ['s670727143', 's765281827'] | [10984.0, 9340.0] | [66.0, 65.0] | [328, 256] |
p02597 | u376754170 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nsaidan = input()\n\nisiall = min(saidan.count('W'), saidan.count('R'))\n\ntesuu = 0\nfor i in range(len(saidan)//2):\n r_iti = saidan.rfind('R')\n w_iti = saidan.find('W')\n \n if r_iti == -1 or w_iti == -1:\n break\n \n saidan = saidan[w_iti+1 : r_iti]\n tesuu += 1\n ... | ['Runtime Error', 'Accepted'] | ['s832301663', 's644008955'] | [138120.0, 9356.0] | [965.0, 324.0] | [359, 346] |
p02597 | u377989038 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\nc = input()\n\nr = c.count("R")\ncnt = 0\nfor i, j in enumerate(c):\n if i + 1 == r:\n break\n if j == "W":\n cnt += 1\nprint(cnt)\n', 'n = int(input())\nc = input()\n\nr = c.count("R")\ncnt = 0\nfor i, j in enumerate(c):\n if i == r:\n break\n if j == "W":\n ... | ['Wrong Answer', 'Accepted'] | ['s614784406', 's797605277'] | [9292.0, 9368.0] | [67.0, 51.0] | [159, 154] |
p02597 | u378349138 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nC = []\nfor c in list(input()):\n a = 0\n if c == "R":\n a = 1\n C.append(a)\nL = -1\nR = N\ncnt = 0\nwhile L < R:\n L += 1\n if L < R:\n break\n if C[L] != 0:\n continue\n while L < R:\n R -= 1\n if L < R:\n break\n if C[R] != 1:\n continue\n cnt += 1\n brea... | ['Wrong Answer', 'Accepted'] | ['s076364656', 's804523757'] | [12344.0, 12348.0] | [61.0, 99.0] | [315, 349] |
p02597 | u393224521 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['import sys\nimport math\n\nn = int(sys.stdin.readline().rstrip("\\n"))\nc = list(sys.stdin.readline().rstrip("\\n"))\nans = 0\nleft, right = 0, len(arr) - 1\n\nwhile(left < right):\n while(c[left] == \'R\'):\n left += 1\n if left >= n:\n break\n while(c[right] == \'W\'):\n right ... | ['Runtime Error', 'Accepted'] | ['s220613472', 's050673990'] | [10664.0, 10788.0] | [32.0, 97.0] | [464, 455] |
p02597 | u399759028 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\ns = input()\nw = s.count('W')\nan1 = s[-w:].count('R')\nan2 = s[:w].count('R')\n\nprint(min(an1, an2))", "n = int(input())\ns = input()\nw = s.count('w')\nprint( s[-w:].count('R') if w != 0 else 0)", "n = int(input())\ns = input()\nw = s.count('W')\nif w == 0:\n print(0)\nelse:\n print(s[-w:].coun... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s362864033', 's862916535', 's873159557'] | [9416.0, 9416.0, 9312.0] | [28.0, 27.0, 30.0] | [114, 88, 101] |
p02597 | u401487574 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['ma = lambda :map(int,input().split())\nni = lambda:int(input())\nyn = lambda fl:print("Yes") if fl else print("No")\nimport collections\nimport math\nimport itertools\nimport heapq as hq\nn = ni()\ncs = input()\nr = cs.count("R")\nprint(cs[:r].count("R"))\n', 'ma = lambda :map(int,input().split())\nni = lambda:int(in... | ['Wrong Answer', 'Accepted'] | ['s439051970', 's285657803'] | [9720.0, 9668.0] | [34.0, 33.0] | [246, 246] |
p02597 | u406138190 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n=int(input())\nword=input()\nline=[]\nfor i in range(n):\n if(word[0]=='R'):\n line.append(1)\n else:\n line.append(0)\n word=word[1:]\nx=0\ny=n-1\nans=0\nwhile(1):\n while(1):\n print(22222222)\n if(line[x]==0):\n break\n if(x>=y):\n break\n ... | ['Wrong Answer', 'Accepted'] | ['s537049845', 's120031615'] | [10860.0, 10740.0] | [790.0, 655.0] | [556, 491] |
p02597 | u410558877 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['def func_rfindr(str, start):\n return str.rfind(\'R\', start)\n\ndef func_lfindw(str, start):\n return str.find(\'W\', start)\n\ndef func_replace(target, pos, str):\n ret = ""\n if pos != 0:\n ret = target[0:pos]\n ret = ret + str\n if len(target) - 1 != pos:\n ret = ret + target[pos +... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s188997120', 's375733305', 's457877417', 's805428159', 's958208416', 's435510103'] | [9348.0, 9264.0, 9416.0, 9444.0, 138536.0, 9452.0] | [30.0, 23.0, 27.0, 27.0, 959.0, 345.0] | [630, 616, 609, 623, 600, 617] |
p02597 | u410969902 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["import re\n\ndef checkFunction(c):\n print(c)\n c = re.sub('W+$','',c)\n if (not 'WR' in c):\n return 0\n if c.index('WR') + 2 != len(c):\n c2 = c.replace('WR', 'RR',1)[:-1]\n return checkFunction(c2) + 1\n return 1\n\n\nN = int(input())\nc= input()\n\nprint(checkFunction(c))", "de... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s212109967', 's619820277', 's924174723', 's786547268'] | [304024.0, 138480.0, 371428.0, 9360.0] | [2360.0, 652.0, 536.0, 96.0] | [296, 435, 450, 307] |
p02597 | u417365712 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nC = input()\nt = sum(c == 'R' for c in C)\nprint(sum(c == 'R' for c in C[:t]))", 'k = int(input())\nif k % 2 == 0 or k % 5 == 0:\n print(-1)\nelse:\n s = i = 0\n while True:\n i += 1\n s = (s*10 + 7) % k\n if s % k == 0:\n print(i)\n break', 'n = i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s204041303', 's612525919', 's423903420'] | [9484.0, 9172.0, 9268.0] | [53.0, 44.0, 28.0] | [93, 199, 63] |
p02597 | u423624748 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = input()\n\nw = [0]*(n+1)\nr = [0]*(n+1)\nfor i in range(0,n):\n w[i+1] = w[i]\n r[n-i-1] = r[n-i]\n if c[i]=='W':\n w[i+1] += 1\n if c[n-i-1]=='R':\n r[n-i-1] += 1\n\nprint([w[i]+r[i]-min(w[i],r[i]) for i in range(0,n+1)])", "n = int(input())\nc = input()\n\nw = [0]*(n+1)\nr = [0]*(n+1... | ['Wrong Answer', 'Accepted'] | ['s107993031', 's815014414'] | [29624.0, 26784.0] | [239.0, 217.0] | [241, 247] |
p02597 | u432295780 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\nk = list(input())\nws = 0\nrs = 0\nmoves = 0\nfor i in range(0, n-1):\n if k[i] == "W":\n ws += 1\n else :\n rs += 1\nif ws == 0 or rs == 0:\n print(0)\nif rs < ws:\n for i in range(0, rs-1):\n if k[i] == "W":\n moves += 1\nelse:\n for i in range(n-1, w... | ['Wrong Answer', 'Accepted'] | ['s931560511', 's953526491'] | [10736.0, 9184.0] | [70.0, 29.0] | [364, 72] |
p02597 | u452512115 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\n\nC = input()\n\nif N % 2 == 0:\n mid = N//2\nelse:\n mid = N//2+1\n\nWcount = C.count("W", 0, mid)\nif C[mid-1] == "W":\n Wcount -= 1\nprint(Wcount)', 'N = int(input())\n\nC = input()\n\nif N % 2 == 0:\n mid = N//2\nelse:\n mid = N//2+1\n\nRcount = C.count("R")\nrcount = C.count("R", 0, Rcount... | ['Wrong Answer', 'Accepted'] | ['s811420577', 's723762235'] | [9436.0, 9332.0] | [31.0, 31.0] | [158, 156] |
p02597 | u456342056 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = input()\n\nred = [i for i, x in enumerate(c) if x == 'R']\nwhite = [i for i, x in enumerate(c) if x == 'W']\n\nif len(white) == 0:\n print(0)\nelif len(red) == 0:\n print(len(white) - 1)\nelse:\n red.sort(reverse=True)\n count = 0\n while(1):\n if red[0] > white[0]:\n ... | ['Wrong Answer', 'Accepted'] | ['s323626295', 's128121801'] | [17344.0, 18108.0] | [2206.0, 98.0] | [444, 543] |
p02597 | u459391214 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\nhalf_N = int(N/2)\nwords = list(input())\nct_R = words.count('R')\nct_W = words.count('W')\n\nif ct_W == ct_R:\n jhw = words[0:half_N]\n\n print(jhw.count('W'))\n \nif ct_W <= ct_R:\n jhw = words[ct_R:-1]\n print(jhw.count('R'))\n \nif ct_W >= ct_R:\n jhw = words[0:ct_R]\n print(jh... | ['Wrong Answer', 'Accepted'] | ['s578292056', 's131425526'] | [11840.0, 11868.0] | [43.0, 42.0] | [315, 153] |
p02597 | u463068683 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\ns1 = input()\ns2 = s1[::-1]\ni1 = 0\ni2 = 0\nans = 0\nwhile i1 < n:\n if s1[i1]=='W':\n while i2 < n:\n if s2[i2]=='R':\n ans += 1\n i2 += 1\n break\n elif i1+i2 >= n-2:\n break\n else:\n i2 += 1\n i1 += 1\n if i1+i2 >= n-2:\n break\n \np... | ['Wrong Answer', 'Accepted'] | ['s600741092', 's900580239'] | [9368.0, 9396.0] | [73.0, 77.0] | [306, 301] |
p02597 | u471214054 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\nS = input()\n\nc = Counter(S)\nS_target = 'R' * c['R'] + 'W' * c['W']\n\nans = 0\nfor a, b in zip(S, S_target):\n if b == 'W':\n break\n if a != b:\n ans += 1\nprint(ans)\n", "from collections import Counter\n\nclass Levenshtein:\n\n def initArray(self,str1,str2):\n dis... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s143696740', 's693231580', 's339778670'] | [9472.0, 2562376.0, 9876.0] | [30.0, 2287.0, 66.0] | [197, 1092, 230] |
p02597 | u476674874 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | [" for c in C[r:]:\n _counter[c] = _counter.get(c, 0) + 1\n _r = _counter.get(R, 0)\n\n ans = _r\n print(ans)\nif __name__ == '__main__':\n main()\n", 'from queue import deque\ndef main():\n R, W = "R", "W"\n N = int(input())\n C = input()\n\n counter = dict()\n for c in C:\n ... | ['Runtime Error', 'Accepted'] | ['s404262434', 's317588926'] | [8916.0, 9872.0] | [26.0, 67.0] | [160, 383] |
p02597 | u477319617 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['ans = 0\nn = int(input())\nc = input()\nprint(c)\ncheck = c[0]\ncount = 0\nflag=0\nfor i in c:\n if(i=="R"):\n count+=1\nfor i,k in enumerate(c):\n print(check,k)\n if check=="W" and k=="R":\n ans+=1\n check = "W"\n if i<count:\n flag+=1\n else:\n check = k\... | ['Wrong Answer', 'Accepted'] | ['s004661120', 's180664994'] | [9352.0, 9388.0] | [165.0, 100.0] | [320, 322] |
p02597 | u478417863 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n=int(input())\ns=input().strip()\nR=s.count('R')\nt=0\nfor i in range(R):\n if s[i]=='W':\n t=t+1\nu=R-(n-R-t)\nf=max(t,u)\nif R==0 or R==n or t==R:\n f=0\nprint(f)\n ", "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN = in... | ['Wrong Answer', 'Accepted'] | ['s644604582', 's734826777'] | [9480.0, 9436.0] | [47.0, 66.0] | [172, 365] |
p02597 | u480264129 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n=int(input())\nc=input()\nr=c.count('R')\nw=c.count('W')\nrch=c[:r].count('W')\nwch=c[r:].count('R')\nprint(min(rch,wch))\nprint(r,w,rch,wch)", "n=int(input())\nc=input()\nr=c.count('R')\nw=c.count('W')\nrch=c[:r].count('W')\nwch=c[r:].count('R')\nprint(min(rch,wch))"] | ['Wrong Answer', 'Accepted'] | ['s849838261', 's312497215'] | [9460.0, 9456.0] | [29.0, 33.0] | [135, 116] |
p02597 | u482157295 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\nc = list(input())\n\n\n\nans1 = 0\nfor i in range(len(c)):\n if c[-(i+1)] == "R":\n break\nans1 = min(c[0:(n-i-1)].count("R"),c[0:(n-i-1)].count("W"))\nans2 = 0\nright = 0\nfor i in range(len(c)):\n if i >= (n-right-1):\n break\n if c[i] == "W":\n for j in range(right,l... | ['Wrong Answer', 'Accepted'] | ['s552649582', 's657833194'] | [12040.0, 10604.0] | [2205.0, 92.0] | [476, 318] |
p02597 | u486536494 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["import datetime\nimport string\nimport re\nimport math\n\nN=int(input())\ninput = input()\nstr = []\nfor i in range(N):\n str.append(input[i])\n\ncount = 0\nbegin = 0\nend = len(str) - 1\nwhile True:\n if begin < len(str):\n while str[begin] == 'W':\n begin += 1\n if begin == len(st... | ['Runtime Error', 'Accepted'] | ['s637971493', 's623883987'] | [11784.0, 11780.0] | [185.0, 216.0] | [980, 1167] |
p02597 | u486646943 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\nc = str(input())\n\na = 0\nb = 0\n\nfor i in range(N):\n if s[i] == 'R':\n a = a + 1\nans = max(a,b)\nfor i in range(N):\n if s[i] == 'R':\n a = a - 1\n else:\n b = b + 1\n now = max(a,b)\n ans = min(ans, now)\nprint(ans)\n", "N = int(input())\ns = str(input())\n\... | ['Runtime Error', 'Accepted'] | ['s626203381', 's829104497'] | [9484.0, 9480.0] | [21.0, 148.0] | [259, 259] |
p02597 | u498575211 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nS = input()\nr_c = 0\nch = 0\nfor i in S:\n if i == "R":\n r_c += 1\nfor i in range(r_c):\n if i == "W"\n ch += 1\nprint(ch)', 'N = int(input())\nS = input()\nr_c = 0\nch = 0\nfor i in S:\n if i == "R":\n r_c += 1\nfor i in range(r_c):\n if S[i] == "W":\n ch += 1\nprint(ch)'] | ['Runtime Error', 'Accepted'] | ['s128299552', 's740154110'] | [8884.0, 9456.0] | [18.0, 66.0] | [140, 144] |
p02597 | u501451051 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = list(input())\n\n\nrcnt = c.count('R')\nwcnt = c.count('W')\n\nans = 0\nif set(c) == {'R'} or set(c) == {'W'}:\n print(0)\nelse:\n cnt = 0\n for i in range(rcnt):\n if c[i] == 'R':\n cnt += 1\n \n print(cnt)\n", "n = int(input())\nc = list(input())\n\n\nrcnt = ... | ['Wrong Answer', 'Accepted'] | ['s260995057', 's509714364'] | [10752.0, 10572.0] | [62.0, 61.0] | [248, 255] |
p02597 | u514118270 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["'import zlib\nprint(eval(zlib.decompress(b\\\\'x\\xda\\xf3\\xd3I\\xb6\\xcd\\xcc+(-\\xd1\\xd0\\xd4\\x81\\xd2\\xd6\\x05E\\x99y%\\x1a\\xc9\\xd1V\\xc9z\\xc9\\xf9\\xa5@\\xa6z\\x90\\xbaf,\\x8c\\x1d\\xae\\xae\\xa9\\t\\x00\\xf0]\\x11O\\\\')))'", "N,c=input(),input()\nprint(c[:c.count('R')].count('W'))"] | ['Runtime Error', 'Accepted'] | ['s047884884', 's456747277'] | [8728.0, 9204.0] | [24.0, 28.0] | [197, 54] |
p02597 | u514334797 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nc = str(input())\n\nw = c.count("W")\nr = c.count("R")\n\nans = r\n\nif w == 0:\n print(0)\nelse:\n if c[0]=="R":\n for i in range(N):\n if c[i] == "W":\n ans -= i\n print(ans)\n break\n elif c[0]=="W":\n for k in range(N... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s111294771', 's152446219', 's939823956'] | [9488.0, 9492.0, 9360.0] | [32.0, 29.0, 44.0] | [424, 275, 146] |
p02597 | u521839937 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["balls = list(input())\n\nbackindex = len(balls) - 1\nfrontindex = 0\nactions = 0\n\nwhile frontindex < backindex:\n if balls[frontindex] == 'W':\n while backindex > frontindex:\n if balls[backindex] == 'R':\n balls[frontindex] = 'R'\n balls[backindex] = 'W'\n actions += 1\n break\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s143942240', 's462778920', 's049451908'] | [9056.0, 9124.0, 10576.0] | [30.0, 30.0, 84.0] | [359, 360, 371] |
p02597 | u523087093 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\nstones = input()\ncount_R = stones.count('R')\n\nif N == count_R:\n answer = 0\nelif N - count_R > count_R:\n answer = count_R\nelse:\n answer = count_R - 1\n\nprint(answer)\n\n", "N = int(input())\nstones = input()\n\ntotal_count_R = stones.count('R')\nleft_count_R = stones[:total_count_R]... | ['Wrong Answer', 'Accepted'] | ['s541402929', 's574043214'] | [9356.0, 9276.0] | [30.0, 31.0] | [191, 171] |
p02597 | u543016260 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N=int(input())\nC=input()\nC=[str(c) for c in C]\n\nfor i in range(N):\n if C[i]=="R":\n C=C[i:]\n break\n \nprint(min(C.count("R"),C.count("W")))', 'N=int(input())\nC=input()\nC=[str(c) for c in C]\n\nfor i in range(N):\n if C[i]=="R":\n C=C[i:]\n break\n\nfor i in range(1,N):\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s043885313', 's204551696', 's443235388', 's523951912', 's631164261', 's993166046', 's434518247'] | [12248.0, 12200.0, 12236.0, 12072.0, 12288.0, 9488.0, 9356.0] | [63.0, 72.0, 89.0, 73.0, 73.0, 2206.0, 122.0] | [157, 236, 231, 267, 233, 217, 182] |
p02597 | u556594202 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nrw = list(input())\n\nrw_after=sorted(rw)\nprint(rw_after)\n\ncount=0\nfor i in range(N):\n if rw[i] != rw_after[i]:\n count+=1\nprint(int(count/2))\n', 'N = int(input())\nrw = list(input())\n\nrw_after=sorted(rw)\n\ncount=0\nfor i in range(N):\n if rw[i] != rw_after[i]:\n count+... | ['Wrong Answer', 'Accepted'] | ['s840756658', 's365092390'] | [14392.0, 12660.0] | [86.0, 73.0] | [167, 151] |
p02597 | u557792847 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['Cc = copy.copy(Cn)\nif (Cn[0] == "R"):\n Rflg = True\nelse:\n Rflg = False\nans = 0\nK = N-1 \nallw = False\nfor i in range(N):\n if Rflg and Cc[i] == "R":\n continue\n else:\n Rflg = True\n if Cc[i] == "W":\n for j in range(K, i, -1):\n if Cc[j] == "R":\n# ... | ['Runtime Error', 'Accepted'] | ['s057938725', 's363065271'] | [9124.0, 29848.0] | [29.0, 200.0] | [624, 918] |
p02597 | u563711100 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\nm = input()\nrunlength = []\ncount = 1\nfor i in range(len(m)):\n if i == n-1:\n runlength.append([m[i],count])\n break\n if m[i] == m[i+1]:\n count += 1\n elif m[i] != m[i+1]:\n runlength.append([m[i],count])\n count = 1\n\n\ncount = 0\n\n\nfor i,j in ru... | ['Wrong Answer', 'Accepted'] | ['s110010041', 's784518332'] | [17748.0, 9348.0] | [120.0, 126.0] | [369, 370] |
p02597 | u566428756 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["from collections import deque\nN=int(input())\nC=list(input())\n\nqw=deque(list())\nqr=deque(list())\n\nans=0\nfor i in range(N//2):\n if C[i]=='W':\n qw.append(i)\n if C[-(i+1)]=='R':\n qr.append(-(i+1))\n if len(qw)>0 and len(qr)>0:\n ans+=1\n l=qw.popleft()\n r=qr.poplef... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s226447928', 's790472381', 's107943743'] | [14552.0, 10692.0, 20164.0] | [116.0, 98.0, 198.0] | [699, 213, 406] |
p02597 | u577868286 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\nc = input()\nc = [char for char in c]\n\ndef op1(l, id1, id2):\n temp = l[id1]\n l[id1] = l[id2]\n l[id2] = temp\n return l\n\nr_idx, w_idx = [], []\nfor j in range(n):\n if c[j] == "R":\n r_idx.append(j)\n elif c[j] == "W":\n w_idx.append(j)\n\nans = 0\nelse:\n fo... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s724745489', 's785116993', 's435875238'] | [8988.0, 20368.0, 10968.0] | [26.0, 81.0, 50.0] | [563, 529, 141] |
p02597 | u579508806 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["from collections import Counter\nimport sys\nn = int(input())\nc = input()\ns = Counter(c)\nif s['W'] == 0 or s['R'] == 0 or c.index('R') == 0 and c.index('W') == s['R']:\n print('0')\n sys.exit()\nr = s['R']\nlas_pos=0\ncount = 0\nfor i, v in enumerate(c):\n if v == 'R':\n if i - las_pos <= r:\n r = r - (... | ['Wrong Answer', 'Accepted'] | ['s502685485', 's956089926'] | [9708.0, 10996.0] | [74.0, 120.0] | [442, 441] |
p02597 | u585670729 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["X = input()\ncount_w, n, count = X.count('W'), len(X), 0\nfor i in range(n - 1, n -1 - count_w, -1):\n count += 1 if X[i] == 'R' else 0\n \nprint(count)", "n, X = int(input()), input()\ncount_w, count = X.count('W'), 0\nfor i in range(n - 1, n -1 - count_w, -1):\n count += 1 if X[i] == 'R' else 0\n \nprint(count)... | ['Wrong Answer', 'Accepted'] | ['s562313579', 's074239864'] | [8984.0, 9200.0] | [33.0, 56.0] | [149, 155] |
p02597 | u591287669 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\narr = list(input())\nprint(arr)\nhead = 0\ntail = n-1\ncount = 0\nwhile True:\n while arr[head]=='R' and head<tail:\n head+=1\n while arr[tail]=='W' and head<tail:\n tail-=1\n if arr[head]=='W' and arr[tail]=='R':\n count+=1\n head+=1\n tail-=1\n if head>=tail:... | ['Wrong Answer', 'Accepted'] | ['s103964809', 's290660698'] | [12560.0, 10792.0] | [80.0, 70.0] | [330, 319] |
p02597 | u592826944 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["# Coding is about expressing your feeling and there is always a better way to express your feeling _feelme\nimport sys,math,numpy as np\n#sys.stdin,sys.stdout=open('input.txt','r'),open('output.txt','w')\nfrom sys import stdin,stdout;mod=int(1e9 + 7);from statistics import mode\nfrom collections import *;from math im... | ['Wrong Answer', 'Accepted'] | ['s644270799', 's128301259'] | [27468.0, 27460.0] | [150.0, 161.0] | [2514, 2511] |
p02597 | u600673553 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["n = int(input())\nc = input()\nd = c.count('w')\ne = c[:d].count('w')\nprint(d-e)", 'n = int(input())\nc = input()\nd = c.count(w)\ne = c.count(w)[:d]\nprint(d-e)', "n = int(input())\nc = input()\nd = c.count('R')\ne = c[:d].count('R')\nprint(d-e)"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s355723332', 's586786983', 's397004820'] | [9396.0, 9460.0, 9420.0] | [32.0, 24.0, 28.0] | [77, 73, 77] |
p02597 | u602773379 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n=int(input())\nc=list(str(input()))\n\ncount=0\nflag=False\n\nfor i in range(n):\n\tif c[i]=="W":\n\t\tflag=True\n\telse:\n\t\tif flag==True:\n\t\t\tcount+=1\n\t\t\tflag=False\nprint(count)', 'n=int(input())\nc=str(input())\n\nR=c.count("R")\n\ncnt=0\nfor i in range(R):\n\tif c[i]=="R":\n\t\tcnt+=1\nprint(R-cnt)'] | ['Wrong Answer', 'Accepted'] | ['s088558355', 's149269973'] | [10724.0, 9404.0] | [56.0, 55.0] | [165, 108] |
p02597 | u616382321 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["N = int(input())\nc = input()\n\nc = [c[i] for i in range(N)]\n\ncR = c.count('R')\ncW = c.count('W')\n\nlistR = [i for i, x in enumerate(c) if x == 'R']\nlistW = [i for i, x in enumerate(c) if x == 'W']\n\nif all([i == 'R' for i in c[:cR]]):\n print(0)\n exit()\n\nif all([i == 'W' for i in c[:cW]]):\n print... | ['Wrong Answer', 'Accepted'] | ['s336857113', 's433151878'] | [21708.0, 11160.0] | [2206.0, 44.0] | [505, 231] |
p02597 | u619557935 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['N = int(input())\nc = list(input())\nans = 0\n#print(c)\nfor i in range(N):\n flag = 0\n if c[i] == "R":\n continue\n elif c[i] == "W":\n #print(c, ans, i, sep=" ",)\n for j in reversed(range(N)):\n if i == j:\n flag = 1\n break\n if c[... | ['Runtime Error', 'Accepted'] | ['s972596569', 's845947010'] | [141236.0, 12060.0] | [2509.0, 36.0] | [527, 135] |
p02597 | u626881915 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ['n = int(input())\ns = list(input())\nl = 0\nr = n-1\nc = 0\nwhile l < r:\n for i in range(l, r):\n if s[i] == "W":\n l = i\n break\n else:\n l = r\n for i in range(r, l, -1):\n if s[i] == "R":\n r = i\n break\n else:\n r = l\n if l < r:\n c += 1\nprint(c)\n \n ', 'n = i... | ['Time Limit Exceeded', 'Accepted'] | ['s417561853', 's055247388'] | [10816.0, 10812.0] | [2206.0, 115.0] | [287, 300] |
p02597 | u643679148 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["# -*- coding: utf-8 -*-\nn = int(input())\ncs = input()\nr_num = 0\nw_num = 0\n\nr_num = cs.count('R')\n\nif r_num == 0 or w_num == 0:\n print(0)\nelse:\n ans = []\n W = 0\n rl_num = 0\n for c in cs:\n if c == 'R':\n rl_num += 1\n elif c == 'W':\n W += 1 \n R... | ['Wrong Answer', 'Accepted'] | ['s293891622', 's153033507'] | [9260.0, 17392.0] | [31.0, 114.0] | [508, 408] |
p02597 | u648881683 | 2,000 | 1,048,576 | An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n... | ["import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_()... | ['Wrong Answer', 'Accepted'] | ['s853177776', 's482248160'] | [14472.0, 12880.0] | [52.0, 46.0] | [865, 753] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.