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. There is a grid with H rows and W columns, where each square is painted black or white. You are given H strings S_1, S_2, ..., S_H, each of length W. If the square at the i-th row from the top ...
instruction
0
38,406
7
76,812
No
output
1
38,406
7
76,813
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a grid with H rows and W columns, where each square is painted black or white. You are given H strings S_1, S_2, ..., S_H, each of length W. If the square at the i-th row from the top ...
instruction
0
38,407
7
76,814
No
output
1
38,407
7
76,815
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,413
7
76,826
"Correct Solution: ``` N,K=map(int,input().split()) x=[0 for i in range(N)] y=[0 for i in range(N)] for i in range(N): a,b,c=map(str,input().split()) a=int(a) b=int(b) if c=="W": b+=K x[i]=a%(2*K) y[i]=b%(2*K) board=[[0 for i in range(2*K+1)] for i in range(2*K+1)] for i in range(N): ...
output
1
38,413
7
76,827
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,414
7
76,828
"Correct Solution: ``` def main(): n, k = map(int, input().split()) C = [[0]*(2*k) for _ in range(2*k)] for i in range(n): x, y, c = map(str, input().split()) x, y = int(x), int(y) if c == 'W': y += k C[y%(2*k)][x%(2*k)] += 1 #print(C) s = [[0]*(2*k+1)...
output
1
38,414
7
76,829
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,415
7
76,830
"Correct Solution: ``` def main(): """ Range: (x,y) X: x-K+1 〜 x+K-1 Y: y-K+1 〜 y+K-1 rangeをすべて試す: 無理 1つの希望を満たすように範囲指定: 模様は確定する (0,0)-(K,K) * 2(W or B) K^2 * N -> 10^3^2 * 10^5 他の希望は満たされるか判定 """ N, K = map(int, ...
output
1
38,415
7
76,831
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,416
7
76,832
"Correct Solution: ``` # -*- coding: utf-8 -*- """ 参考:https://pitsbuffersolution.com/compro/atcoder/arc089d.php    http://tutuz.hateblo.jp/entry/2018/06/20/212752    https://paiza.hatenablog.com/entry/2014/05/28/%E3%82%82%E3%81%97%E5%A5%B3%E5%AD%90%E5%A4%A7%E7%94%9F%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9E%E3%81%A...
output
1
38,416
7
76,833
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,417
7
76,834
"Correct Solution: ``` n,k = map(int, input().split()) g = [[0]*(k+1) for _ in range(k+1)] ans,b = 0,0 for _ in range(n): x,y,c = input().split() x,y = int(x), int(y) d = x//k + y//k x %= k; y %= k if (c == 'W') ^ (d%2): g[x+1][y+1] += 1 else: g[x+1][y+1] -= 1 b += 1 for i in range(k): for j i...
output
1
38,417
7
76,835
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,418
7
76,836
"Correct Solution: ``` def cumsum(T, K): R = [[0] * K for _ in range(K)] for i in range(K): t = 0 for j in range(K): t += T[i][j] R[i][j] = t for i in range(K): t = 0 for j in range(K): t += R[j][i] R[j][i] = t return R def...
output
1
38,418
7
76,837
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,419
7
76,838
"Correct Solution: ``` n, k = map(int, input().split()) v = [] for i in range(n): abc = [x for x in input().split()] a = int(abc[0]) b = int(abc[1]) c = abc[2] if c == 'W': b += k v.append((a % (2*k), b % (2*k))) s = [[0 for _ in range(3*k+1)] for _ in range(3*k+1)] s2 = [[0 for _ in ra...
output
1
38,419
7
76,839
Provide a correct Python 3 solution for this coding contest problem. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K squ...
instruction
0
38,420
7
76,840
"Correct Solution: ``` #da[i][j]:(0,0)~(i,j)の長方形の和 def da_generate(h,w,a): da = [[0]*w for j in range(h)] da[0][0] = a[0][0] for i in range(1,w): da[0][i] = da[0][i-1]+a[0][i] for i in range(1,h): cnt_w = 0 for j in range(w): cnt_w += a[i][j] da[i][j] = da...
output
1
38,420
7
76,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,421
7
76,842
Yes
output
1
38,421
7
76,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,422
7
76,844
Yes
output
1
38,422
7
76,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,423
7
76,846
Yes
output
1
38,423
7
76,847
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,424
7
76,848
Yes
output
1
38,424
7
76,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,425
7
76,850
No
output
1
38,425
7
76,851
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,426
7
76,852
No
output
1
38,426
7
76,853
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,427
7
76,854
No
output
1
38,427
7
76,855
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so th...
instruction
0
38,428
7
76,856
No
output
1
38,428
7
76,857
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,618
7
77,236
Tags: implementation, math Correct Solution: ``` w,h,k=map(int,input().split()) i=0 ans=0 while i<k: length=w-(i*2)*2 width=h-(i*2)*2 total=(length+width)*2-4 ans+=total i+=1 print(ans) ```
output
1
38,618
7
77,237
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,619
7
77,238
Tags: implementation, math Correct Solution: ``` w,h,k = map(int,input().split()) s = 0 for i in range(k): s += ((w+h)*2)-4 w-=4 h-=4 print(s) ```
output
1
38,619
7
77,239
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,620
7
77,240
Tags: implementation, math Correct Solution: ``` def peri(w, h): return 2*(w + h - 2) def main(): str = list(map(int, input().split())) w = str[0] h = str[1] amount = str[2] sum = 0 for i in range(amount): sum += peri(w - 4*(i), h - 4*(i)) print(sum) main() ```
output
1
38,620
7
77,241
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,621
7
77,242
Tags: implementation, math Correct Solution: ``` w,h,k=map(int,input().split()) print(2*(w+h)*k-8*k*k+4*k) ```
output
1
38,621
7
77,243
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,622
7
77,244
Tags: implementation, math Correct Solution: ``` a = [int(i) for i in input().split()] e = 0 for i in range(a[2]): e += (a[0] + a[1]) * 2 - 4 a[0] -= 4 a[1] -= 4 print(e) ```
output
1
38,622
7
77,245
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,623
7
77,246
Tags: implementation, math Correct Solution: ``` w,h,k=map(int,input().split()) s=0 while k>0: s=s+2*(w+h-2) w-=4 h-=4 k-=1 print(s) ```
output
1
38,623
7
77,247
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,624
7
77,248
Tags: implementation, math Correct Solution: ``` w,h,n=map(int,input().split()) sum=0 for i in range(n): sum+=2*(w)+2*(h-2) h-=4 w-=4 print (sum) ```
output
1
38,624
7
77,249
Provide tags and a correct Python 3 solution for this coding contest problem. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one — 2 cells away from the edge...
instruction
0
38,625
7
77,250
Tags: implementation, math Correct Solution: ``` w, h, k = [int(i) for i in input().split()] sum = 0 for i in range(k): sum += 2 * (w + h - 8 * i) - 4 print(sum) ```
output
1
38,625
7
77,251
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,626
7
77,252
Yes
output
1
38,626
7
77,253
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,627
7
77,254
Yes
output
1
38,627
7
77,255
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,628
7
77,256
Yes
output
1
38,628
7
77,257
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,629
7
77,258
Yes
output
1
38,629
7
77,259
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,630
7
77,260
No
output
1
38,630
7
77,261
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,631
7
77,262
No
output
1
38,631
7
77,263
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,632
7
77,264
No
output
1
38,632
7
77,265
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w× h cells. There should be k gilded rings, the first one should go along the edge of the pla...
instruction
0
38,633
7
77,266
No
output
1
38,633
7
77,267
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,753
7
77,506
Tags: constructive algorithms, implementation Correct Solution: ``` n, m = [int(x) for x in input().split()] s = input() def lefti(i): return (n+i-1)%n def left(i): return s[lefti(i)] def righti(i): return (i+1)%n def right(i): return s[righti(i)] def inverse(c): return 'B' if c == 'W' else 'W' re...
output
1
38,753
7
77,507
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,754
7
77,508
Tags: constructive algorithms, implementation Correct Solution: ``` """ def get(ch): if(ch=='W'): return 'B' return 'W' n,k=map(int,input().split()) s=input() pos=[0]*(n) for i in range(0,len(s)): if(s[i]==s[(i+1)%n]): if(s[i]=='W'): pos[i]=1 pos[(i+1)%n]=1 ...
output
1
38,754
7
77,509
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,755
7
77,510
Tags: constructive algorithms, implementation Correct Solution: ``` n, k = map(int, input().split()) a = list(input()) * 2 iter1 = [0] * (2 * n) iter2 = [0] * (2 * n) changes = 0 for i in range(1, 2 * n): if a[i] != a[i - 1]: changes += 1 else: changes = 0 iter1[i] = changes changes = 0 for...
output
1
38,755
7
77,511
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,756
7
77,512
Tags: constructive algorithms, implementation Correct Solution: ``` # from __future__ import print_function # from __future__ import division # input = raw_input import math ## Make simpler structure: class Same: def __init__(self,col, size, fro, to): self.size = size self.col = col self...
output
1
38,756
7
77,513
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,757
7
77,514
Tags: constructive algorithms, implementation Correct Solution: ``` rev = {'B': 'W', 'W': 'B'} n, k = map(int, input().split()) a = list(input()) if all(map(lambda x: a[0] == x, a)): print(''.join(a)) exit() f = [i for i in range(n)] c = [1 for i in range(n)] def getF(u): if f[u] == u: return u if f[f[u]] == ...
output
1
38,757
7
77,515
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,758
7
77,516
Tags: constructive algorithms, implementation Correct Solution: ``` def get(ch): if(ch=='W'): return 'B' return 'W' n,k=map(int,input().split()) s=input() pos=[0]*(n) for i in range(0,len(s)): if(s[i]==s[(i+1)%n]): if(s[i]=='W'): pos[i]=1 pos[(i+1)%n]=1 el...
output
1
38,758
7
77,517
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,759
7
77,518
Tags: constructive algorithms, implementation Correct Solution: ``` n, k = [int(i) for i in input().split()] col = [0 if d == "W" else 1 for d in input()] offs = 0 if col[0] != col[-1]: offs = -1 for i in range(n-1): if col[i] == col[i+1]: offs = i+1 break if offs == -1: ...
output
1
38,759
7
77,519
Provide tags and a correct Python 3 solution for this coding contest problem. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules. For each chip i, thr...
instruction
0
38,760
7
77,520
Tags: constructive algorithms, implementation Correct Solution: ``` import sys input = sys.stdin.readline n,k=map(int,input().split()) S=input().strip() ANS=["?"]*n for i in range(n-1): if S[i]=="B": if S[i-1]=="B" or S[i+1]=="B": ANS[i]="B" else: if S[i-1]=="W" or S[i+1]=="W": ...
output
1
38,760
7
77,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors accordi...
instruction
0
38,761
7
77,522
No
output
1
38,761
7
77,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors accordi...
instruction
0
38,762
7
77,524
No
output
1
38,762
7
77,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors accordi...
instruction
0
38,763
7
77,526
No
output
1
38,763
7
77,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n chips arranged in a circle, numbered from 1 to n. Initially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors accordi...
instruction
0
38,764
7
77,528
No
output
1
38,764
7
77,529
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
38,789
7
77,578
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` import sys def MI(): return map(int, sys.stdin.readline().split()) def SI(): return sys.stdin.readline()[:-1] def main(): inf=10**18+5 h,w,t=MI() aa=[[int(c) for c in SI()] for _ in range(h)] bb=[[0]*w for _ in range(...
output
1
38,789
7
77,579
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
38,790
7
77,580
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` from bisect import * from collections import * from math import gcd,ceil,sqrt,floor,inf from heapq import * from itertools import * #from operator import add,mul,sub,xor,truediv,floordiv from functools import * #----------------------...
output
1
38,790
7
77,581
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
38,791
7
77,582
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` def main(): import sys import collections input=lambda: sys.stdin.readline().rstrip() n,m,t=map(int,input().split()) T=[input() for _ in range(n)] C=[0]*(n*m) d=((1,0),(0,1),(-1,0),(0,-1)) Q=collections.d...
output
1
38,791
7
77,583
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
38,792
7
77,584
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` def main(): import sys from array import array from collections import deque input = sys.stdin.readline H, W, Q = map(int, input().split()) grid = array('b', [0] * (H*W)) #flg_0 = 0 #flg_1 = 0 for h ...
output
1
38,792
7
77,585