message
stringlengths
2
28.7k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
21
109k
cluster
float64
7
7
__index_level_0__
int64
42
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel...
instruction
0
17,215
7
34,430
Yes
output
1
17,215
7
34,431
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel...
instruction
0
17,216
7
34,432
Yes
output
1
17,216
7
34,433
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel...
instruction
0
17,217
7
34,434
No
output
1
17,217
7
34,435
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel...
instruction
0
17,218
7
34,436
No
output
1
17,218
7
34,437
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel...
instruction
0
17,219
7
34,438
No
output
1
17,219
7
34,439
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel...
instruction
0
17,220
7
34,440
No
output
1
17,220
7
34,441
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,282
7
34,564
Tags: implementation Correct Solution: ``` a = int(input()) b = input() def countGroups(x, y): count = 0 for i in range(0, x - 1): if y[i] == 'B' and y[i + 1] == 'W': count += 1 if y[x - 1] == 'B': count += 1 return count def blocks(x, y): count = 0 for i in range...
output
1
17,282
7
34,565
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,283
7
34,566
Tags: implementation Correct Solution: ``` nb = int(input()) ls = input() liste = [x for x in ls] liste2 = [] compteur =0 for loop in range(len(liste)): if liste[loop] =="B": compteur +=1 else: if compteur !=0: liste2.append(str(compteur)) compteur = 0 if compteur!=0: ...
output
1
17,283
7
34,567
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,284
7
34,568
Tags: implementation Correct Solution: ``` n = int(input()) s = list(input()) freq = [0]*len(s) j, flag, ans, pointer = 0, 0, 0, 0 for i in range(len(s)): if (s[i] == "B"): if (pointer == 0): ans += 1 freq[j] += 1 flag = 1 pointer = 1 else: ...
output
1
17,284
7
34,569
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,285
7
34,570
Tags: implementation Correct Solution: ``` n = int(input()) s = input() X = 0 new = True L = [] for each in s: if each == "W": new = True if X != 0: L.append(X) X = 0 else: if new: new = False X = 1 else: X += 1 if no...
output
1
17,285
7
34,571
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,286
7
34,572
Tags: implementation Correct Solution: ``` n = int(input()) s = input() x = s.split('W') f = [len(i) for i in x if len(i) != 0] print(len(f)) for i in f: print(i, end=' ') ```
output
1
17,286
7
34,573
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,287
7
34,574
Tags: implementation Correct Solution: ``` n = int(input()) crossword = list(input()) count = 0 res = [] for c in crossword: if c == 'B': count += 1 else: if count != 0: res.append(count) count = 0 if count != 0: res.append(count) print(len(res)) for x in res: pri...
output
1
17,287
7
34,575
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,288
7
34,576
Tags: implementation Correct Solution: ``` n = int(input()) s = input() + "W" c = 0 m = 0 a = [] for i in range(n+1): if s[i]=='B': m +=1 else: if m>0: c += 1 a.append(m) m = 0 print(c) if len(a) > 0: print(*a, sep = ' ') ```
output
1
17,288
7
34,577
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ— b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns...
instruction
0
17,289
7
34,578
Tags: implementation Correct Solution: ``` n = int(input()) vec = input() nv = 0 la = 0 res = "" espacio = "" for i in range(len(vec)): #print(vec[i]) if vec[i] == 'B': la += 1 else: if la > 0: nv += 1 res += espacio + str(la) la = 0 espacio =...
output
1
17,289
7
34,579
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,392
7
34,784
Tags: implementation Correct Solution: ``` n = int(input()) line = list(map(int, input().split())) ans = [1] prev = line[0] k = 1 for i in range(1, n): if line[i] == prev: ans[-1] += 1 else: k += 1 prev = line[i] ans.append(1) if [ans[0]] * k != ans: print('NO') else: pri...
output
1
17,392
7
34,785
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,393
7
34,786
Tags: implementation Correct Solution: ``` n = int(input()) x = list(map(int, input().split())) d = None s = 1 c = x[0] for i in range(1, n): if x[i] == c: s += 1 else: if d is None: d = s else: if (s != d): print("NO") break ...
output
1
17,393
7
34,787
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,394
7
34,788
Tags: implementation Correct Solution: ``` n=int(input()) a=list(map(int,input().split())) i=0 while a[i] == a[0]: i+=1 if i==n: break b=[] b.append([a[0] for i in range(0,i)]) b.append([(a[0] +1) % 2 for i in range(0,i)]) c=[] for i in range(n//i): c += b[i % 2] if c == a: print("YES") else: print("N...
output
1
17,394
7
34,789
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,395
7
34,790
Tags: implementation Correct Solution: ``` def f(): N = int(input()) if N == 1: print('YES') return strZebza = input().split(' ') if strZebza[-1] ==' ' or strZebza[-1] == '\n': del strZebza[-1] mass = [ int(el) for el in strZebza] if mass[0] == 1: startColour = 1 ...
output
1
17,395
7
34,791
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,396
7
34,792
Tags: implementation Correct Solution: ``` input() picture = input().split() cur_col = picture[0] cur_len = 0 last_len = -1 for i in picture: if i == cur_col: cur_len += 1 else: if last_len != -1 and cur_len != last_len: print("NO") exit(0) else: last_len = cur_len cur_len = 1 cur_col = i ...
output
1
17,396
7
34,793
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,397
7
34,794
Tags: implementation Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) v = list() last, cnt = a[0], 0 for i in range(n): if a[i] == last: cnt += 1 else: v.append(cnt) cnt = 1 last = a[i] v.append(cnt) f = True for e in v: if e != v[0]: f = False if (f): print('YES') else: print...
output
1
17,397
7
34,795
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,398
7
34,796
Tags: implementation Correct Solution: ``` from itertools import groupby n = int(input()) mas = ''.join([i for i in input().split()]) zebra = [] zebra = [len(list(j)) for i, j in groupby(mas)] a = [len(list(j)) for i, j in groupby(zebra)] if len(a)==1: print('YES') else: print('NO') ```
output
1
17,398
7
34,797
Provide tags and a correct Python 3 solution for this coding contest problem. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros ...
instruction
0
17,399
7
34,798
Tags: implementation Correct Solution: ``` n = int(input()) num = [] num = list(map(int, input().split())) firstZifr = 1 flag = 0 cnt = 0 nowCnt = 0 ans = 0 for i in range(n): if (i == 0): firstZifr = num[0] cnt = cnt + 1 elif (num[i] == firstZifr and flag == 0): cnt = cnt + 1 elif (num[i] != firstZifr and fla...
output
1
17,399
7
34,799
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,400
7
34,800
Yes
output
1
17,400
7
34,801
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,401
7
34,802
Yes
output
1
17,401
7
34,803
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,402
7
34,804
Yes
output
1
17,402
7
34,805
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,403
7
34,806
Yes
output
1
17,403
7
34,807
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,404
7
34,808
No
output
1
17,404
7
34,809
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,405
7
34,810
No
output
1
17,405
7
34,811
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,406
7
34,812
No
output
1
17,406
7
34,813
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we ca...
instruction
0
17,407
7
34,814
No
output
1
17,407
7
34,815
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,869
7
35,738
Tags: dp, greedy Correct Solution: ``` for i in range(int(input())): n=int(input()) a=list(map(int,input().split())) n=int(input()) b=list(map(int,input().split())) sum=0 ma1=0 for p in a: sum+=p ma1=max(ma1,sum) sum=0 ma2=0 for j in b: sum+=j ma2...
output
1
17,869
7
35,739
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,870
7
35,740
Tags: dp, greedy Correct Solution: ``` for j in range(int(input())): n=int(input()) a=[int(j) for j in input().split()] m=int(input()) b=[int(j) for j in input().split()] s=0 t=0 S=[] T=[] ...
output
1
17,870
7
35,741
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,871
7
35,742
Tags: dp, greedy Correct Solution: ``` import math import sys import bisect # https://pythonworld.ru/moduli/modul-bisect.html from heapq import heapify, heappop, heappush from itertools import * # https://pythonworld.ru/moduli/modul-itertools.html from collections import deque, OrderedDict from pprint import pprint s...
output
1
17,871
7
35,743
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,872
7
35,744
Tags: dp, greedy Correct Solution: ``` for _ in range(int(input())): n = int(input()) A = list(map(int, input().split())) m = int(input()) B = list(map(int, input().split())) pref_A = [0] pref_B = [0] for i in A: pref_A.append(pref_A[-1]+i) for i in B: pref_B.append(pref_B[-1]+i) print(max(pref_B) +...
output
1
17,872
7
35,745
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,873
7
35,746
Tags: dp, greedy Correct Solution: ``` for _ in range(int(input())): n = int(input()) a = [int(x) for x in input().split()] m = int(input()) b = [int(x) for x in input().split()] dp = [[-10**9 for j in range(m + 1)] for i in range(n + 1)] dp[0][0] = 0 ans = 0 for i in range(n + 1): for j in range(m + 1): i...
output
1
17,873
7
35,747
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,874
7
35,748
Tags: dp, greedy Correct Solution: ``` import collections import math from heapq import * for t in range(1,int(input())+1): n=int(input()) r=list(map(int,input().split())) m=int(input()) b=list(map(int,input().split())) out=0 val=v1=v2=0 for i in r: val+=i v1=max(v1,val) ...
output
1
17,874
7
35,749
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,875
7
35,750
Tags: dp, greedy Correct Solution: ``` for _ in range(int(input())): n = int(input()) a = [int(x) for x in input().split()] m = int(input()) b = [int(x) for x in input().split()] def mpref(arr): cur = 0 res = 0 for x in arr: cur += x res = max(res, cu...
output
1
17,875
7
35,751
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue. After painting the elements, he has...
instruction
0
17,876
7
35,752
Tags: dp, greedy Correct Solution: ``` from itertools import accumulate s = lambda x: max(0, max(accumulate(x))) for _ in range(int(input())): n = int(input()) r = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split())) print(s(r)+s(b)) ```
output
1
17,876
7
35,753
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,877
7
35,754
Yes
output
1
17,877
7
35,755
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,878
7
35,756
Yes
output
1
17,878
7
35,757
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,879
7
35,758
Yes
output
1
17,879
7
35,759
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,880
7
35,760
Yes
output
1
17,880
7
35,761
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,881
7
35,762
No
output
1
17,881
7
35,763
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,882
7
35,764
No
output
1
17,882
7
35,765
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,883
7
35,766
No
output
1
17,883
7
35,767
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were pai...
instruction
0
17,884
7
35,768
No
output
1
17,884
7
35,769
Provide tags and a correct Python 3 solution for this coding contest problem. Iahub is training for the IOI. What is a better way to train than playing a Zuma-like game? There are n balls put in a row. Each ball is colored in one of k colors. Initially the row doesn't contain three or more contiguous balls with the ...
instruction
0
18,058
7
36,116
Tags: brute force, two pointers Correct Solution: ``` n, k, x = map(int, input().split()) bolas = list(map(int, input().split())) resp = 0 for c in range(n): s = bolas.copy() s.insert(c, x) while len(s) > 2: l = len(s) for i in range(2, len(s)): if s[i-2] == s[i-1] == s[i]: p = i + 1 while p < len(s):...
output
1
18,058
7
36,117
Provide tags and a correct Python 3 solution for this coding contest problem. Iahub is training for the IOI. What is a better way to train than playing a Zuma-like game? There are n balls put in a row. Each ball is colored in one of k colors. Initially the row doesn't contain three or more contiguous balls with the ...
instruction
0
18,059
7
36,118
Tags: brute force, two pointers Correct Solution: ``` def solve(a): for i in range(len(a)-1): j = i + 1 while j < len(a) and a[j] == a[i]: j += 1 num = j - i if num >= 3: return num + solve(a[:i] + a[j:]) return 0 n, k, x = [int(x) for x in input().split(...
output
1
18,059
7
36,119
Provide tags and a correct Python 3 solution for this coding contest problem. Iahub is training for the IOI. What is a better way to train than playing a Zuma-like game? There are n balls put in a row. Each ball is colored in one of k colors. Initially the row doesn't contain three or more contiguous balls with the ...
instruction
0
18,060
7
36,120
Tags: brute force, two pointers Correct Solution: ``` R = lambda: list(map(int, input().split())) def dfs(a): cnt = 0 n = len(a) a.append(10000000) for i in range(1, n): if a[i] != a[i - 1]: cnt = 0 else: cnt += 1 if cnt >= 2: j = i ...
output
1
18,060
7
36,121
Provide tags and a correct Python 3 solution for this coding contest problem. Iahub is training for the IOI. What is a better way to train than playing a Zuma-like game? There are n balls put in a row. Each ball is colored in one of k colors. Initially the row doesn't contain three or more contiguous balls with the ...
instruction
0
18,061
7
36,122
Tags: brute force, two pointers Correct Solution: ``` import sys from math import * def minp(): return sys.stdin.readline().strip() def mint(): return int(minp()) def mints(): return map(int, minp().split()) z,n,c = None, None, None def DOIT(l, r): #if z[l][r]: # return z[l][r] if l > 0 and r < n: ll = l-1...
output
1
18,061
7
36,123