submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s333327068
p00026
Accepted
sheet = [[0 for _ in range(10)] for _ in range(10)] #小、中、大のインクの範囲 small_range = ((0, 0), (1, 0), (0, 1), (-1, 0), (0, -1)) middle_range = ((0, 0), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)) large_range = ((0, 0), (1, 0), (2, 0), (1, 1), (0, 1), (0, 2), (-1, 1), (-1, 0), (-2, 0), (-1, -1), (0, -1), (0, -2), (1, -1)) #範囲内か判定してインクを足す def drop(x, y, drop_range): for dx, dy in drop_range: newx, newy = x + dx, y + dy if 0 <= newx <= 9 and 0 <= newy <= 9: sheet[newx][newy] += 1 while True: try: x, y, s = map(int, input().split(",")) if s == 1: drop(x, y, small_range) elif s == 2: drop(x, y, middle_range) else: drop(x, y, large_range) except EOFError: break #0の個数 zero_cnt = 0 #インクの最大値 max_ink = 0 for x in range(10): for y in range(10): ink = sheet[x][y] if ink == 0: zero_cnt += 1 if max_ink < ink: max_ink = ink print(zero_cnt) print(max_ink)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s062554847
p00026
Accepted
def paint(masu,data): masu[data[1]][data[0]]+=1 #インクを垂らした場所 #print(masu) if data[2]==1: #インク小の時 if data[0]!=0: masu[data[1]][data[0]-1]+=1 if data[0]!=9: masu[data[1]][data[0]+1]+=1 if data[1]!=0: masu[data[1]-1][data[0]]+=1 if data[1]!=9: masu[data[1]+1][data[0]]+=1 #print("小の時",masu) elif data[2]==2: #インク中の時 if data[0]!=0: masu[data[1]][data[0]-1]+=1 if data[0]!=9: masu[data[1]][data[0]+1]+=1 if data[1]!=0: masu[data[1]-1][data[0]]+=1 if data[1]!=9: masu[data[1]+1][data[0]]+=1 if data[1]!=9 and data[0]!=9: masu[data[1]+1][data[0]+1]+=1 if data[1]!=9 and data[0]!=0: masu[data[1]+1][data[0]-1]+=1 if data[1]!=0 and data[0]!=9: masu[data[1]-1][data[0]+1]+=1 if data[1]!=0 and data[0]!=0: masu[data[1]-1][data[0]-1]+=1 #print("中の時",masu) elif data[2]==3: #インク大の時 if data[0]!=0: masu[data[1]][data[0]-1]+=1 if data[0]!=9: masu[data[1]][data[0]+1]+=1 if data[1]!=0: masu[data[1]-1][data[0]]+=1 if data[1]!=9: masu[data[1]+1][data[0]]+=1 if data[1]!=9 and data[0]!=9: masu[data[1]+1][data[0]+1]+=1 if data[1]!=9 and data[0]!=0: masu[data[1]+1][data[0]-1]+=1 if data[1]!=0 and data[0]!=9: masu[data[1]-1][data[0]+1]+=1 if data[1]!=0 and data[0]!=0: masu[data[1]-1][data[0]-1]+=1 if data[1]>=2: masu[data[1]-2][data[0]]+=1 if data[1]<=7: masu[data[1]+2][data[0]]+=1 if data[0]>=2: masu[data[1]][data[0]-2]+=1 if data[0]<=7: masu[data[1]][data[0]+2]+=1 #print("大の時",masu) return masu masu=[ [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0] ] def keisan(masu): max=0 num1=0 for na in range(10): for ma in range(10): if masu[na][ma]==0: num1+=1 if masu[na][ma]>max: max=masu[na][ma] print(num1) print(max) while True: try: x,y,s=list(map(int, input().split(','))) data=[x,y,s] masu2=paint(masu,data) except: break #print("masu",masu2) #print("masu2",masu2) keisan(masu2)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s561918845
p00026
Accepted
def small(x, y, a): a[x][y] += 1 a[x + 1][y] += 1 a[x - 1][y] += 1 a[x][y + 1] += 1 a[x][y - 1] += 1 def medium(x, y, a): small(x, y, a) a[x + 1][y + 1] += 1 a[x - 1][y + 1] += 1 a[x - 1][y - 1] += 1 a[x + 1][y - 1] += 1 def large(x, y, a): medium(x, y, a) a[x + 2][y] += 1 a[x - 2][y] += 1 a[x][y + 2] += 1 a[x][y - 2] += 1 p = [[0] * 13 for i in range(13)] while 1: try: x, y, s = map(int, input().split(',')) if s == 1: small(x, y, p) elif s == 2: medium(x, y, p) elif s == 3: large(x, y, p) except: break w, dens = 0, 0 for i in range(10): for j in range(10): if p[i][j] == 0: w += 1 if p[i][j] >= dens: dens = p[i][j] print(w) print(dens)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s739281434
p00026
Accepted
p = [[0 for j in range(10)] for i in range(10)] s1i = [-1, 0, 0, 1] s1j = [0, -1, 1, 0] s2i = [-1, -1, -1, 0, 0, 1, 1, 1] s2j = [-1, 0, 1, -1, 1, -1, 0, 1] s3i = [-2, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 2] s3j = [0, -1, 0, 1, -2, -1, 1, 2, -1, 0, 1, 0] while True: try: x, y, s = map(int, input().split(",")) except: break p[y][x] += 1 if s == 1: for k in range(len(s1i)): xx = x + s1j[k] yy = y + s1i[k] if 0 <= xx and xx < 10 and 0 <= yy and yy < 10: p[yy][xx] += 1 elif s == 2: for k in range(len(s2i)): xx = x + s2j[k] yy = y + s2i[k] if 0 <= xx and xx < 10 and 0 <= yy and yy < 10: p[yy][xx] += 1 else: for k in range(len(s3i)): xx = x + s3j[k] yy = y + s3i[k] if 0 <= xx and xx < 10 and 0 <= yy and yy < 10: p[yy][xx] += 1 cnt = 0 m = 0 for i in range(10): #print(p[i]) for j in range(10): if p[i][j] == 0: cnt += 1 else: pass m = max(p[i][j], m) #print() print(cnt) print(m)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s363613860
p00026
Accepted
if __name__ == '__main__': DI = [[0 for _ in range(10)] for _ in range(10)] while True: try: x,y,s = map(int,input().split(",")) if s == 0: break if s == 1: #自身 DI[x][y] += 1 #up if y >= 1 : DI[x][y-1] += 1 #down if y <= 8: DI[x][y+1] += 1 #left if x >= 1: DI[x-1][y] += 1 #right if x <= 8: DI[x+1][y] += 1 elif s == 2: #自身 DI[x][y] += 1 #up if y >= 1 : DI[x][y-1] += 1 #up left if x >= 1 and y >= 1: DI[x-1][y-1] += 1 #up right if x <= 8 and y >= 1 : DI[x+1][y-1] += 1 #down if y <= 8: DI[x][y+1] += 1 #down left if x >= 1 and y <= 8: DI[x-1][y+1] += 1 #down right if x <= 8 and y <= 8 : DI[x+1][y+1] += 1 #left if x >= 1: DI[x-1][y] += 1 #right if x <= 8: DI[x+1][y] += 1 else: #自身 DI[x][y] += 1 #up if y >= 1 : DI[x][y-1] += 1 #up left if x >= 1 and y >= 1: DI[x-1][y-1] += 1 #up right if x <= 8 and y >= 1 : DI[x+1][y-1] += 1 #up +1 if y >= 2 : DI[x][y-2] += 1 #down if y <= 8: DI[x][y+1] += 1 #down left if x >= 1 and y <= 8: DI[x-1][y+1] += 1 #down right if x <= 8 and y <= 8 : DI[x+1][y+1] += 1 #down + 1 if y <= 7: DI[x][y+2] += 1 #left if x >= 1: DI[x-1][y] += 1 #left + 1 if x >= 2: DI[x-2][y] += 1 #right if x <= 8: DI[x+1][y] += 1 #right + 1 if x <= 7: DI[x+2][y] += 1 except EOFError: break # for j in DI: # print(j) cnt = 0 maxcnt = 0 for k in DI: cnt += k.count(0) if maxcnt < max(k): maxcnt = max(k) print(cnt) print(maxcnt)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s495168926
p00026
Accepted
def small_ink(paper,x,y): paper[x][y] += 1 if 0 <= x-1 and x-1 < 10: paper[x-1][y] += 1 if 0 <= y-1 and y-1 < 10: paper[x][y-1] += 1 if 0 <= x+1 and x+1 < 10: paper[x+1][y] += 1 if 0 <= y+1 and y+1 < 10: paper[x][y+1] += 1 return paper def middle_ink(paper,x,y): paper = small_ink(paper,x,y) if (0 <= x-1 and x-1 < 10) and (0 <= y-1 and y-1 < 10): paper[x-1][y-1] += 1 if (0 <= x-1 and x-1 < 10) and (0 <= y+1 and y+1 < 10): paper[x-1][y+1] += 1 if (0 <= x+1 and x+1 < 10) and (0 <= y-1 and y-1 < 10): paper[x+1][y-1] += 1 if (0 <= x+1 and x+1 < 10) and (0 <= y+1 and y+1 < 10): paper[x+1][y+1] += 1 return paper def large_ink(paper,x,y): paper = middle_ink(paper,x,y) if (0 <= x-2 and x-2 < 10): paper[x-2][y] += 1 if (0 <= y-2 and y-2 < 10): paper[x][y-2] += 1 if (0 <= y+2 and y+2 < 10): paper[x][y+2] += 1 if (0 <= x+2 and x+2 < 10): paper[x+2][y] += 1 return paper paper = [([0 for _ in range(10)]) for _ in range(10)] while True: try: x,y,s = map(int, input().split(',')) except EOFError: break if s == 1: paper = small_ink(paper,x,y) elif s == 2: paper = middle_ink(paper,x,y) elif s == 3: paper = large_ink(paper,x,y) sum0 = 0 max_ink = 0 for i in range(10): for j in range(10): if paper[i][j] == 0: sum0 += 1 if paper[i][j] > max_ink: max_ink = paper[i][j] print(sum0) print(max_ink)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s108901814
p00026
Accepted
import sys field = [] for i in range(0, 10): lst = [] for j in range(0, 10): lst.append(0) field.append(lst) for line in sys.stdin: x, y, s = map(int, line.split(',')) field[x][y] += 1 for i in range(0, 2): nextx = x-1+2*i nexty = y-1+2*i if 0 <= nextx and nextx < 10: field[nextx][y] += 1 if 0 <= nexty and nexty < 10: field[x][nexty] += 1 if s >= 2: for i in range(0, 2): nextx = x-1+2*i if 0 <= nextx and nextx < 10: for j in range(0, 2): nexty = y-1+2*j if 0 <= nexty and nexty < 10: field[nextx][nexty] += 1 if s == 3: for i in range(0, 2): nextx = x-2+4*i nexty = y-2+4*i if 0 <= nextx and nextx < 10: field[nextx][y] += 1 if 0 <= nexty and nexty < 10: field[x][nexty] += 1 cnt = 0 max = 0 for i in range(0, 10): for j in range(0, 10): if field[i][j] == 0: cnt += 1 else: if max < field[i][j]: max = field[i][j] print cnt print max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s844137084
p00026
Accepted
paper=[[0 for i in range(10)] for j in range(10)] while 1: try: x,y,s=map(int,input().split(",")) if s==1: r=[[-1,0],[1,0],[0,0],[0,-1],[0,1]] elif s==2: r=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,0],[0,1],[1,-1],[1,0],[1,1]] elif s==3: r=[[-2,0],[-1,-1],[-1,0],[-1,1],[0,-2],[0,-1],[0,0],[0,1],[0,2],[1,-1],[1,0],[1,1],[2,0]] for i in r: if y+i[0]<0 or y+i[0]>9 or x+i[1]<0 or x+i[1]>9:pass else: paper[y+i[0]][x+i[1]]+=1 except:break ans=0 dark=0 for i in paper: for j in i: if j==0:ans+=1 else:dark=max(dark,j) print(ans) print(dark)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s792210993
p00026
Accepted
a = [[0 for i in range(14)] for j in range(14)] drop = [0 for i in range(3)] drop[0] = [ [0,0,0,0,0], [0,0,1,0,0], [0,1,1,1,0], [0,0,1,0,0], [0,0,0,0,0] ] drop[1] = [ [0,0,0,0,0], [0,1,1,1,0], [0,1,1,1,0], [0,1,1,1,0], [0,0,0,0,0] ] drop[2] = [ [0,0,1,0,0], [0,1,1,1,0], [1,1,1,1,1], [0,1,1,1,0], [0,0,1,0,0] ] while(1): try: x,y,n = [int(i) for i in input().split(",")] for i in range(5): for j in range(5): a[x+i][y+j] = a[x+i][y+j] + drop[n-1][i][j] except EOFError: b = [[0 for i in range(10)] for j in range(10)] for i in range(10): for j in range(10): b[i][j] = a[i+2][j+2] zero = [sum([1 if b[i][j] == 0 else 0 for j in range(10)]) for i in range(10)] print(sum(zero)) print(int(max([max(i) for i in b]))) break
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s009063265
p00026
Accepted
paper = [[0]*10 for l in range(10)] while True: try: x,y,s = map(int, input().split(",")) # s size paper[x][y] += 1 if y - 1 >= 0: paper[x][y - 1] += 1 if x - 1 >= 0: paper[x - 1][y] += 1 if x + 1 < 10: paper[x + 1][y] += 1 if y + 1 < 10: paper[x][y + 1] += 1 # m size if s >= 2: if x - 1 >= 0 and y - 1 >= 0: paper[x - 1][y - 1] += 1 if x + 1 < 10 and y - 1 >= 0: paper[x + 1][y - 1] += 1 if x - 1 >= 0 and y + 1 < 10: paper[x - 1][y + 1] += 1 if x + 1 < 10 and y + 1 < 10: paper[x + 1][y + 1] += 1 # l size if s >= 3: if x - 2 >= 0: paper[x - 2][y] += 1 if x + 2 < 10: paper[x + 2][y] += 1 if y - 2 >= 0: paper[x][y - 2] += 1 if y + 2 < 10: paper[x][y + 2] += 1 except EOFError: break flat_paper = sum(paper, []) print(flat_paper.count(0)) print(max(flat_paper))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s112023176
p00026
Accepted
paper = [[0 for i in range(15)] for j in range(15)] base = 2 while True: try: x, y, s = list(map(int, input().split(','))) except EOFError: break x += 2 y += 2 if s == 3: paper[x-2][y] += 1 paper[x+2][y] += 1 paper[x][y-2] += 1 paper[x][y+2] += 1 if s >= 2: paper[x-1][y-1] += 1 paper[x-1][y+1] += 1 paper[x+1][y-1] += 1 paper[x+1][y+1] += 1 paper[x][y] += 1 paper[x-1][y] += 1 paper[x+1][y] += 1 paper[x][y-1] += 1 paper[x][y+1] += 1 cnt = max = 0; for x in range(2, 12): for y in range(2, 12): if paper[x][y] == 0: cnt += 1 if paper[x][y] > max: max = paper[x][y] print(cnt, max, sep='\n')
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s217584068
p00026
Accepted
ar = [[0]*14 for _ in range(14)] while(True): try: x,y,s = map(int,input().split(",")) if s == 3: for x1,y1 in [[-2,0],[0,2],[2,0],[0,-2],[-1,-1],[0,-1],[1,-1],[-1,0],[0,0],[1,0],[-1,1],[0,1],[1,1]]: ar[y1+y+2][x1+x+2] += 1 elif s == 2: for x1,y1 in [[-1,-1],[0,-1],[1,-1],[-1,0],[0,0],[1,0],[-1,1],[0,1],[1,1]]: ar[y1+y+2][x1+x+2] += 1 elif s == 1: for x1,y1 in [[0,-1],[-1,0],[0,0],[1,0],[0,1]]: ar[y1+y+2][x1+x+2] += 1 except: break br = [ a[2:12] for a in ar[2:12] ] print(sum([b.count(0) for b in br])) print(max([max(b) for b in br]))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s273706653
p00026
Accepted
import sys class Board(): def __init__(self): self.B = [0 for _ in range(12 * 12)] for i in range(0, 12): self.B[i] = -1 for i in range(12, 12 * 12, 12): self.B[i] = -1 for i in range(11, 11 * 12, 12): self.B[i] = -1 for i in range(12 * 11, 12 * 12): self.B[i] = -1 def print(self): cnt = 0 for b in self.B: if b == 0: cnt += 1 print(cnt) print(max(self.B)) def inc_if_non_wall(self, x, y): idx = (y + 1) * 12 + (x + 1) if self.B[idx] != -1: self.B[idx] += 1 def drop_s(self, x, y): self.inc_if_non_wall(x, y) self.inc_if_non_wall(x, y - 1) self.inc_if_non_wall(x - 1, y) self.inc_if_non_wall(x + 1, y) self.inc_if_non_wall(x, y + 1) def drop_m(self, x, y): self.drop_s(x, y) self.inc_if_non_wall(x - 1, y - 1) self.inc_if_non_wall(x + 1, y - 1) self.inc_if_non_wall(x - 1, y + 1) self.inc_if_non_wall(x + 1, y + 1) def drop_l(self, x, y): self.drop_m(x, y) idx = (y + 1) * 12 + (x + 1) if 12 * 3 < idx: self.inc_if_non_wall(x, y - 2) if idx < 12 * 9: self.inc_if_non_wall(x, y + 2) self.inc_if_non_wall(x - 2, y) self.inc_if_non_wall(x + 2, y) if __name__ == "__main__": B = Board() for l in sys.stdin: x, y, s = map(int, l.split(',')) if s == 1: B.drop_s(x, y) elif s == 2: B.drop_m(x, y) elif s == 3: B.drop_l(x, y) B.print()
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s649991511
p00026
Runtime Error
paper = {} counter = 0 for i in range(10): for j in range(10): paper.update({(i,j):0}) while True: try: x, y, s = list(map(int,input().split(","))) except: break if s == 3: paper[(x+2,y)] += 1 paper[(x-2,y)] += 1 paper[(x,y+2)] += 1 paper[(x,y-2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x+1,y-1)] += 1 paper[(x-1,y+1)] += 1 paper[(x-1,y-1)] += 1 paper[(x,y)] += 1 paper[(x,y-1)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 paper[(x-1,y)] += 1 #print(paper.values()) for i in range(10): for j in range(10): if paper[(i,j)] == 0: counter += 1 print(counter) print(max(paper.values()))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s998668301
p00026
Runtime Error
paper = {} counter = 0 i = 0 for i in range(10): for j in range(10): paper.update({(i,j):0}) while i < 50: try: x, y, s = list(map(int,input().split(","))) except: break if s == 3: paper[(x+2,y)] += 1 paper[(x-2,y)] += 1 paper[(x,y+2)] += 1 paper[(x,y-2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x+1,y-1)] += 1 paper[(x-1,y+1)] += 1 paper[(x-1,y-1)] += 1 paper[(x,y)] += 1 paper[(x,y-1)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 paper[(x-1,y)] += 1 i += 1 for i in range(10): for j in range(10): if paper[(i,j)] == 0: counter += 1 print(counter) print(max(paper.values()))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s467616624
p00026
Runtime Error
paper = {} counter = 0 i = 0 for i in range(10): for j in range(10): paper.update({(i,j):0}) while i < 50: try: x, y, s = list(map(int,input().split(","))) except: break if x - 1 < 0 and x - 2 < 0 and x - 3 < 0 and y - 1 < 0 and y - 2 < 0 and y - 3 < 0: if s == 3: paper[(x+2,y)] += 1 paper[(x,y+2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x,y)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 else: if s == 3: paper[(x+2,y)] += 1 paper[(x-2,y)] += 1 paper[(x,y+2)] += 1 paper[(x,y-2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x+1,y-1)] += 1 paper[(x-1,y+1)] += 1 paper[(x-1,y-1)] += 1 paper[(x,y)] += 1 paper[(x,y-1)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 paper[(x-1,y)] += 1 i += 1 for i in range(10): for j in range(10): if paper[(i,j)] == 0: counter += 1 print(counter) print(max(paper.values()))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s436020900
p00026
Runtime Error
paper = {} counter = 0 i = 0 for i in range(10): for j in range(10): paper.update({(i,j):0}) while i < 50: try: x, y, s = list(map(int,input().split(","))) except: break if x - 1 < 0 and x - 2 < 0 and x - 3 < 0 and y - 1 < 0 and y - 2 < 0 and y - 3 < 0: if s == 3: paper[(x+2,y)] += 1 paper[(x,y+2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x,y)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 elif x - 1 < 0 and x - 2 < 0 and x - 3 < 0: if s == 3: paper[(x+2,y)] += 1 paper[(x,y+2)] += 1 paper[(x,y-2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x+1,y-1)] += 1 paper[(x,y)] += 1 paper[(x,y-1)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 elif y - 1 < 0 and y - 2 < 0 and y - 3 < 0: if s == 3: paper[(x+2,y)] += 1 paper[(x-2,y)] += 1 paper[(x,y+2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x-1,y+1)] += 1 paper[(x,y)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 paper[(x-1,y)] += 1 else: if s == 3: paper[(x+2,y)] += 1 paper[(x-2,y)] += 1 paper[(x,y+2)] += 1 paper[(x,y-2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x+1,y-1)] += 1 paper[(x-1,y+1)] += 1 paper[(x-1,y-1)] += 1 paper[(x,y)] += 1 paper[(x,y-1)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 paper[(x-1,y)] += 1 i += 1 for i in range(10): for j in range(10): if paper[(i,j)] == 0: counter += 1 print(counter) print(max(paper.values()))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s199498812
p00026
Runtime Error
paper = {} counter = 0 i = 0 for i in range(10): for j in range(10): paper.update({(i,j):0}) while i < 50: try: x, y, s = list(map(int,input().split(","))) except: break if x - 1 < 0 or x - 2 < 0 or x - 3 < 0 or y - 1 < 0 or y - 2 < 0 or y - 3 < 0: if s == 3: paper[(x+2,y)] += 1 paper[(x,y+2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x,y)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 elif x - 1 < 0 or x - 2 < 0 or x - 3 < 0: if s == 3: paper[(x+2,y)] += 1 paper[(x,y+2)] += 1 paper[(x,y-2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x+1,y-1)] += 1 paper[(x,y)] += 1 paper[(x,y-1)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 elif y - 1 < 0 or y - 2 < 0 or y - 3 < 0: if s == 3: paper[(x+2,y)] += 1 paper[(x-2,y)] += 1 paper[(x,y+2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x-1,y+1)] += 1 paper[(x,y)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 paper[(x-1,y)] += 1 else: if s == 3: paper[(x+2,y)] += 1 paper[(x-2,y)] += 1 paper[(x,y+2)] += 1 paper[(x,y-2)] += 1 if s >= 2: paper[(x+1,y+1)] += 1 paper[(x+1,y-1)] += 1 paper[(x-1,y+1)] += 1 paper[(x-1,y-1)] += 1 paper[(x,y)] += 1 paper[(x,y-1)] += 1 paper[(x,y+1)] += 1 paper[(x+1,y)] += 1 paper[(x-1,y)] += 1 i += 1 for i in range(10): for j in range(10): if paper[(i,j)] == 0: counter += 1 print(counter) print(max(paper.values()))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s572376633
p00026
Runtime Error
paper = [0 for i in range(100)] white_points = None deep_points = None def small(x, y): p = [[x, y]] for i, j in zip([-1, 0, 1, 0], [0, -1, 0, 1]): p.append([x + i, y + j]) return p def middle(x, y): p = small(x, y) for i, j in zip([1, -1] * 2, [1, 1, -1, -1]): p.append([x + i, y + j]) return p def big(x, y): p = middle(x, y) for i, j in zip([-2, 0, 2, 0], [0, -2, 0, 2]): p.append([x + i, y + j]) return p while True: try: x, y, size = map(int, input().split(',')) except: print(paper.count(0)) print(max(paper)) break if size == 1: bp = small(x, y) elif size == 2: bp = middle(x, y) elif size == 3: bp = big(x, y) for p in bp: paper[p[0] * 10 + p[1]] += 1
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s196758270
p00026
Runtime Error
paper = [0 for i in range(100)] white_points = None deep_points = None def small(x, y): p = [[x, y]] for i, j in zip([-1, 0, 1, 0], [0, -1, 0, 1]): p.append([x + i, y + j]) return p def middle(x, y): p = small(x, y) for i, j in zip([1, -1, 1, -1], [1, 1, -1, -1]): p.append([x + i, y + j]) return p def big(x, y): p = middle(x, y) for i, j in zip([-2, 0, 2, 0], [0, -2, 0, 2]): p.append([x + i, y + j]) return p while True: try: x, y, size = map(int, input().split(',')) except: print(paper.count(0)) print(max(paper)) break if size == 1: bp = small(x, y) elif size == 2: bp = middle(x, y) elif size == 3: bp = big(x, y) for p in bp: if not 0 <= p[0] * 10 + p[1] <= 99: continue paper[p[1] * 10 + p[0]] += 1
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s219967375
p00026
Runtime Error
# -*- coding: utf-8 -*- def density_adder(array,x,y,delta_list): for dx,dy in zip(delta_list): cell_num = 10*(x-dx) + (y-dy) if 0 <= cell_num <=100: array[10*x + y][2] += 1 while True: array = [[i,j,0] for i in range(10) for j in range(10)] try: x,y,size = map(int,raw_input().split()) except EOFError: break small_delta_ls = [(0,0),(-1,0),(1,0),(0,-1),(0,1)] medium_delta_ls = small_delta_ls + [(1,1),(1,-1),(-1,1),(-1,-1)] large_delta_ls = medium_delta_ls + [(-2,0),(2,0),(0,2),(0,-2)] if size == 1: # Small density_adder(array,x,y,small_delta_ls) elif size == 2: # Medium density_adder(array,x,y,medium_delta_ls) elif size ==3 : # Large density_adder(array,x,y,large_delta_ls) ink_zero = 0 densest = 0 for k in xrange(100): if array[k][2]==0: ink_zero +=1 if array[k][2] > densest: densest = array[k][2] print ink_zero print densest
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s246071937
p00026
Runtime Error
# -*- coding: utf-8 -*- def density_adder(array,x,y,delta_list): for k in delta_list: dx,dy = k cell_num = 10*(x-dx) + (y-dy) if 0 <= cell_num <100: array[10*x + y][2] += 1 array = [[i,j,0] for i in range(10) for j in range(10)] input_list = [] while True: x,y,size = map(int,raw_input().split(",")) input_list.append((x,y,size)) else: small_delta_ls = [(0,0),(-1,0),(1,0),(0,-1),(0,1)] medium_delta_ls = small_delta_ls + [(1,1),(1,-1),(-1,1),(-1,-1)] large_delta_ls = medium_delta_ls + [(-2,0),(2,0),(0,2),(0,-2)] for j in input_list: x,y,size = j if size == 1: # Small density_adder(array,x,y,small_delta_ls) elif size == 2: # Medium density_adder(array,x,y,medium_delta_ls) elif size ==3 : # Large density_adder(array,x,y,large_delta_ls) ink_zero = 0 densest = 0 for k in xrange(100): if array[k][2]==0: ink_zero +=1 if array[k][2] > densest: densest = array[k][2] print ink_zero print densest
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s212474255
p00026
Runtime Error
import sys p = [[0 for a in range(10)] for b in range(10)] def smallink(x,y): return [(x+i,y+j) for i in range(-1,2,1) for j in range(-1,2,1)\ if abs(i)+abs(j)<=1 and x+i>=0 and y+j>=0] def ink(x,y): return [(x+i,y+j) for i in range(-1,2,1) for j in range(-1,2,1)\ if x+i>=0 and y+j>=0] def bigink(x,y): return [(x+i,y+j) for i in range(-2,3,1) for j in range(-2,3,1)\ if abs(i)+abs(j)<=2 and x+i>=0 and y+j>=0] for dataset in sys.stdin: x,y,size=map(int,dataset.split(",")) if size==1: L=smallink(x,y) elif size==2: L=ink(x,y) else: L=bigink(x,y) while len(L)!=0: point=L.pop(0) p[point[0]][point[1]]+=1 count=0 max=0 for i in range(10): for j in range(10): if(p[i][j]>max): max=p[i][j] if(p[i][j]==0): count+=1 print count print max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s721564764
p00026
Runtime Error
import sys p = [[0 for a in range(10)] for b in range(10)] def smallink(x,y): return [(x+i,y+j) for i in range(-1,2,1) for j in range(-1,2,1)\ if abs(i)+abs(j)<=1 and x+i>=0 and y+j>=0] def ink(x,y): return [(x+i,y+j) for i in range(-1,2,1) for j in range(-1,2,1)\ if x+i>=0 and y+j>=0] def bigink(x,y): return [(x+i,y+j) for i in range(-2,3,1) for j in range(-2,3,1)\ if abs(i)+abs(j)<=2 and x+i>=0 and y+j>=0] for dataset in sys.stdin: x,y,size=map(int,dataset.split(",")) if size==1: L=smallink(x,y) elif size==2: L=ink(x,y) else: L=bigink(x,y) while len(L)!=0: point=L.pop(0) p[point[0]][point[1]]+=1 count=0 max=0 for i in range(10): for j in range(10): if(p[i][j]>max): max=p[i][j] if(p[i][j]==0): count+=1 print count print max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s295912156
p00026
Runtime Error
import sys mat=[[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]] for line in sys.stdin.readlines(): y, x, s=map(int,line.split(',')) c=0 max=0 if(s==1): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 elif(s==2): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 mat[x-1][y+1]=mat[x-1][y+1]+1 mat[x-1][y-1]=mat[x-1][y-1]+1 mat[x+1][y+1]=mat[x+1][y+1]+1 mat[x+1][y-1]=mat[x+1][y-1]+1 elif(s==3): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 mat[x-1][y+1]=mat[x-1][y+1]+1 mat[x-1][y-1]=mat[x-1][y-1]+1 mat[x+1][y+1]=mat[x+1][y+1]+1 mat[x+1][y-1]=mat[x+1][y-1]+1 mat[x-2][y]=mat[x-2][y]+1 mat[x+2][y]=mat[x+2][y]+1 mat[x][y+2]=mat[x][y+2]+1 mat[x][y-2]=mat[x][y-2]+1 print (mat) for i in range(10): for j in range(10): if(mat[i][j]==0): c=c+1 if(mat[i][j]>max): max=mat[i][j] print(c) print(max)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s612295985
p00026
Runtime Error
import sys mat=[[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]] for line in sys.stdin.readlines(): y, x, s=map(int,line.split(',')) c=0 max=0 if(s==1): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 elif(s==2): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 mat[x-1][y+1]=mat[x-1][y+1]+1 mat[x-1][y-1]=mat[x-1][y-1]+1 mat[x+1][y+1]=mat[x+1][y+1]+1 mat[x+1][y-1]=mat[x+1][y-1]+1 elif(s==3): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 mat[x-1][y+1]=mat[x-1][y+1]+1 mat[x-1][y-1]=mat[x-1][y-1]+1 mat[x+1][y+1]=mat[x+1][y+1]+1 mat[x+1][y-1]=mat[x+1][y-1]+1 mat[x-2][y]=mat[x-2][y]+1 mat[x+2][y]=mat[x+2][y]+1 mat[x][y+2]=mat[x][y+2]+1 mat[x][y-2]=mat[x][y-2]+1 for i in range(10): for j in range(10): if(mat[i][j]==0): c=c+1 if(mat[i][j]>max): max=mat[i][j] print(c) print(max)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s739331313
p00026
Runtime Error
import sys mat=[[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]] c=0 max=0 for line in sys.stdin.readlines(): y, x, s=map(int,line.split(',')) if(s==1): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 elif(s==2): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 mat[x-1][y+1]=mat[x-1][y+1]+1 mat[x-1][y-1]=mat[x-1][y-1]+1 mat[x+1][y+1]=mat[x+1][y+1]+1 mat[x+1][y-1]=mat[x+1][y-1]+1 elif(s==3): mat[x][y]=mat[x][y]+1 mat[x][y+1]=mat[x][y+1]+1 mat[x-1][y]=mat[x-1][y]+1 mat[x][y-1]=mat[x][y-1]+1 mat[x+1][y]=mat[x+1][y]+1 mat[x-1][y+1]=mat[x-1][y+1]+1 mat[x-1][y-1]=mat[x-1][y-1]+1 mat[x+1][y+1]=mat[x+1][y+1]+1 mat[x+1][y-1]=mat[x+1][y-1]+1 mat[x-2][y]=mat[x-2][y]+1 mat[x+2][y]=mat[x+2][y]+1 mat[x][y+2]=mat[x][y+2]+1 mat[x][y-2]=mat[x][y-2]+1 for i in range(10): for j in range(10): if(mat[i][j]==0): c=c+1 if(mat[i][j]>max): max=mat[i][j] print(c) print(max)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s503786162
p00026
Runtime Error
import sys drops = [None, [(-1,0),(1,0),(0,-1),(0,1)], [(-1,0),(1,0),(0,-1),(0,1),(-1,1),(-1,-1),(1,-1),(1,1)], [(-1,0),(1,0),(0,-1),(0,1),(-1,1),(-1,-1),(1,-1),(1,1),(-2,0),(2,0),(0,-2),(0,2)]] B = [[0 for j in xrange(10)] for i in xrange(10)] for line in sys.stdin: x, y, s = map(int, line.rstrip().split(',')) for dx, dy in drops[s]: nx, ny = x+dx, y+dy if (0 <= nx <= 9 or 0 <= ny <= 9): B[ny][nx] += 1 emp, m = 0, 0 for i in xrange(10): for j in xrange(10): if B[i][j] == 0: emp += 1 m = max(m, B[i][j]) print emp print m
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s183716528
p00026
Runtime Error
import sys drops = [None, [(-1,0),(1,0),(0,-1),(0,1)], [(-1,0),(1,0),(0,-1),(0,1),(-1,1),(-1,-1),(1,-1),(1,1)], [(-1,0),(1,0),(0,-1),(0,1),(-1,1),(-1,-1),(1,-1),(1,1),(-2,0),(2,0),(0,-2),(0,2)]] B = [[0 for j in xrange(10)] for i in xrange(10)] for line in sys.stdin: x, y, s = map(int, line.rstrip().split(',')) B[x][y] += 1 for dx, dy in drops[s]: nx, ny = x+dx, y+dy if (0 <= nx <= 9 or 0 <= ny <= 9): B[ny][nx] += 1 emp, m = 0, 0 for i in xrange(10): for j in xrange(10): if B[i][j] == 0: emp += 1 m = max(m, B[i][j]) print emp print m
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s371196664
p00026
Runtime Error
import sys drops = [None, [(0,0),(-1,0),(1,0),(0,-1),(0,1)], [(0,0),(-1,0),(1,0),(0,-1),(0,1),(-1,1),(-1,-1),(1,-1),(1,1)], [(0,0),(-1,0),(1,0),(0,-1),(0,1),(-1,1),(-1,-1),(1,-1),(1,1),(-2,0),(2,0),(0,-2),(0,2)]] B = [[0 for j in xrange(10)] for i in xrange(10)] for line in sys.stdin: x, y, s = map(int, line.rstrip().split(',')) for dx, dy in drops[s]: nx, ny = x+dx, y+dy if (0 <= nx <= 9 or 0 <= ny <= 9): B[ny][nx] += 1 emp, m = 0, 0 for i in xrange(10): for j in xrange(10): if B[i][j] == 0: emp += 1 m = max(m, B[i][j]) print emp print m
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s738121916
p00026
Runtime Error
Masu = [] def access(x,y): if x < 0 or y < 0: return Masu[y][x] += 1 for i in range(10): Masu.append([0,0,0,0,0,0,0,0,0,0]) kosu = 0 komax = 0 while True: try: x,y,s = map(int,input().split(",")) if s == 1: for j in range(3): access(y +1 - j,x) access(y,x - 1) access(y,x + 1) elif s == 2: for k in range(3): for l in range(3): access(y + 1 - k,x + 1 -l) elif s == 3: for k in range(3): for l in range(3): access(y + 1 - k,x + 1 -l) access(y - 2,x) access(y + 2,x) access(y,x + 2) access(y,x - 2) except (EOFError,ValueError): for i in range(10): kosu += Masu[i].count(0) for j in range(10): if komax < max(Masu[j]): komax = max(Masu[j]) print(kosu) print(komax) break
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s941155550
p00026
Runtime Error
Masu = [] def access(x,y): if x < 0 or y < 0: return Masu[y][x] += 1 for i in range(10): Masu.append([0,0,0,0,0,0,0,0,0,0]) kosu = 0 komax = 0 while True: try: x,y,s = map(int,input().split(",")) if s == 1: for j in range(3): access(y +1 - j,x) access(y,x - 1) access(y,x + 1) elif s == 2: for k in range(3): for l in range(3): access(y + 1 - k,x + 1 -l) elif s == 3: for k in range(3): for l in range(3): access(y + 1 - k,x + 1 -l) access(y - 2,x) access(y + 2,x) access(y,x + 2) access(y,x - 2) except EOFError: for i in range(10): kosu += Masu[i].count(0) for j in range(10): if komax < max(Masu[j]): komax = max(Masu[j]) print(kosu) print(komax) break
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s756138018
p00026
Runtime Error
t = [[0 for i in range(10)] for j in range(10)] case1 = [(0, 0), (0, -1), (1, 0), (0, 1), (-1, 0)] case2 = [(1, -1), (1, 1), (-1, 1), (-1, -1)] case3 = [(0, -2), (2, 0), (0, 2), (-2, 0)] while True: try: x, y, s = map(int, input().split(',')) except: break for c in [case1, case2, case3][:s]: for _x, _y in c: if y+_y < 0 or x+_x < 0: continue t[y+_y][x+_x] += 1 print(sum(1 for l in t for v in l if not v)) print(max(v for l in t for v in l))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s819945459
p00026
Runtime Error
paper = [[0 for _ in range(14)] for _ in range(14)] dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] while True: try: x, y, s = map(int, input().split()) except EOFError: break x += 2 y += 2 paper[x][y] += 1 for i in range(4): paper[x + dx[i]][y + dy[i]] += 1 if s >= 2: for i in range(4): paper[x + dx[i] + dx[(i + 1) % 4]][y + dy[i] + dy[(i + 1) % 4]] += 1 if s >= 3: for i in range(4): paper[x + 2 * dx[i]][y + 2 * dy[i]] += 1 paper = paper[2:12] for i in range(10): paper[i] = paper[i][2:12] print(sum(paper[i].count(0) for i in range(10))) print(max(paper[i][j] for i in range(10) for j in range(10)))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s572277787
p00026
Runtime Error
import sys paper = [[0 for i in range(10)] for j in range(10)] for line in sys.stdin: if line == "\n": break x, y, size = map(int, line.split(",")) if size == 1: paper[y][x] += 1 paper[y-1][x] += 1 paper[y+1][x] += 1 paper[y][x-1] += 1 paper[y][x+1] += 1 elif size == 2: for i in range(y-1, y+2): for j in range(x-1, x+2): paper[i][j] += 1 else: for i in range(y-1, y+2): for j in range(x-1, x+2): paper[i][j] += 1 paper[y-2][x] += 1 paper[y+2][x] += 1 paper[y][x-2] += 1 paper[y][x+2] += 1 #for i in range(10): #for j in range(10): #if j == 10 - 1: #print(paper[i][j]) #else: #print(paper[i][j], end=" ") cnt = 0 max_n = 0 for i in range(10): for j in range(10): if paper[i][j] == 0: cnt += 1 if max_n < paper[i][j]: max_n = paper[i][j] print(cnt) print(max_n)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s308233445
p00026
Runtime Error
import numpy as np area = [[0 for i in range(10)] for j in range(10)] area = np.array(area) while True: try: x, y, s = map(int, input().split(',')) except: break if s == 3: if (0 <= x+2 <= 9) and (0 <= y <= 9): area[x+2][y] += 1 if (0 <= x <= 9) and (0 <= y+2 <= 9): area[x][y+2] += 1 if (0 <= x-2 <= 9) and (0 <= y <= 9): area[x-2][y] += 1 if (0 <= x <= 9) and (0 <= y-2 <= 9): area[x][y-2] += 1 if s >= 2: if (0 <= x+1 <= 9) and (0 <= y+1 <= 9): area[x+1][y+1] += 1 if (0 <= x+1 <= 9) and (0 <= y-1 <= 9): area[x+1][y-1] += 1 if (0 <= x-1 <= 9) and (0 <= y+1 <= 9): area[x-1][y+1] += 1 if (0 <= x-1 <= 9) and (0 <= y-1 <= 9): area[x-1][y-1] += 1 if s >= 1: if (0 <= x+1 <= 9) and (0 <= y <= 9): area[x+1][y] += 1 if (0 <= x <= 9) and (0 <= y+1 <= 9): area[x][y+1] += 1 if (0 <= x-1 <= 9) and (0 <= y <= 9): area[x-1][y] += 1 if (0 <= x <= 9) and (0 <= y-1 <= 9): area[x][y-1] += 1 area[x][y] += 1 print(len(np.where(area == 0)[0])) print(area.max())
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s750349725
p00026
Runtime Error
import numpy as np area = [[0 for i in range(10)] for j in range(10)] area = np.array(area) while True: try: y, x, s = map(int, input().split(',')) except: break if s == 3: if (0 <= x+2 <= 9) and (0 <= y <= 9): area[x+2][y] += 1 if (0 <= x <= 9) and (0 <= y+2 <= 9): area[x][y+2] += 1 if (0 <= x-2 <= 9) and (0 <= y <= 9): area[x-2][y] += 1 if (0 <= x <= 9) and (0 <= y-2 <= 9): area[x][y-2] += 1 if s >= 2: if (0 <= x+1 <= 9) and (0 <= y+1 <= 9): area[x+1][y+1] += 1 if (0 <= x+1 <= 9) and (0 <= y-1 <= 9): area[x+1][y-1] += 1 if (0 <= x-1 <= 9) and (0 <= y+1 <= 9): area[x-1][y+1] += 1 if (0 <= x-1 <= 9) and (0 <= y-1 <= 9): area[x-1][y-1] += 1 if s >= 1: if (0 <= x+1 <= 9) and (0 <= y <= 9): area[x+1][y] += 1 if (0 <= x <= 9) and (0 <= y+1 <= 9): area[x][y+1] += 1 if (0 <= x-1 <= 9) and (0 <= y <= 9): area[x-1][y] += 1 if (0 <= x <= 9) and (0 <= y-1 <= 9): area[x][y-1] += 1 area[x][y] += 1 print(area) print(len(np.where(area == 0)[0])) print(area.max())
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s336003007
p00026
Runtime Error
import numpy as np p = np.zeros((14,14), dtype=int) while True: try: x_inp, y_inp, s = map(int, input().split(",")) x = x_inp + 2 y = y_inp + 2 if s == 1: p[y-1][x] += 1 p[y][x-1:x+2] += 1 p[y+1][x] += 1 elif s == 2: p[y-1][x-1:x+2] += 1 p[y][x-1:x+2] += 1 p[y+1][x-1:x+2] += 1 else: p[y-2][x] += 1 p[y-1][x-1:x+2] += 1 p[y][x-2:x+3] += 1 p[y+1][x-1:x+2] += 1 p[y+2][x] += 1 except: break p_trim = p[2:12,2:12] print(len(np.where(p_trim==0)[0])) print(np.max(p_trim))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s205340921
p00026
Runtime Error
import numpy as np p = np.zeros((14,14), dtype=int) while True: try: x_inp, y_inp, s = map(int, input().split(",")) x = x_inp + 2 y = y_inp + 2 if s == 1: p[y-1][x] += 1 p[y][x-1:x+2] += 1 p[y+1][x] += 1 elif s == 2: p[y-1][x-1:x+2] += 1 p[y][x-1:x+2] += 1 p[y+1][x-1:x+2] += 1 else: p[y-2][x] += 1 p[y-1][x-1:x+2] += 1 p[y][x-2:x+3] += 1 p[y+1][x-1:x+2] += 1 p[y+2][x] += 1 except: break p_trim = p[2:12,2:12] print(len(np.where(p_trim==0)[0])) print(np.max(p_trim))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s971486144
p00026
Runtime Error
p = np.zeros((14,14), dtype=int) while True: try: x_inp, y_inp, s = map(int, input().split(",")) x = x_inp + 2 y = y_inp + 2 if s == 1: p[y-1][x] += 1 p[y][x-1:x+2] += 1 p[y+1][x] += 1 elif s == 2: p[y-1][x-1:x+2] += 1 p[y][x-1:x+2] += 1 p[y+1][x-1:x+2] += 1 else: p[y-2][x] += 1 p[y-1][x-1:x+2] += 1 p[y][x-2:x+3] += 1 p[y+1][x-1:x+2] += 1 p[y+2][x] += 1 except: break p_trim = p[2:12,2:12] print(len(np.where(p_trim==0)[0])) print(np.max(p_trim))
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s610592989
p00026
Runtime Error
import numpy as np
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s974221916
p00026
Runtime Error
import sys lines = [] for line in sys.stdin: lines.append(line.strip().split(',')) field = [[0 for i in range(10)] for j in range(10)] def drop(x, y, z): if z==1: for i in range(-1,2): for j in range(-1,2): if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 elif z==2: for i in range(-1,2): for j in range(-1,2): if 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 else: for i in range(-2,3): for j in range(-2,3): if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 for line in lines: x,y,z = map(int, line) print(x,y,z) drop(x,y,z) n = 0 m = 0 for f in field: for e in f: if e > m: m = e if e==0: n+=1 print(n) print(m)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s231490331
p00026
Runtime Error
import sys lines = [] for line in sys.stdin: lines.append(line.strip().split(',')) field = [[0 for i in range(10)] for j in range(10)] def drop(x, y, z): if z==1: for i in range(-1,2): for j in range(-1,2): if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 elif z==2: for i in range(-1,2): for j in range(-1,2): if 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 else: for i in range(-2,3): for j in range(-2,3): if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 for line in lines: x,y,z = map(int, line) print(x,y,z) drop(x,y,z) n = 0 m = 0 for f in field: for e in f: if e > m: m = e if e==0: n+=1
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s532106152
p00026
Runtime Error
import sys lines = [] for line in sys.stdin: lines.append(line.strip().split(',')) field = [[0 for i in range(10)] for j in range(10)] def drop(x, y, z): if z==1: for i in range(-1,2): for j in range(-1,2): if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 elif z==2: for i in range(-1,2): for j in range(-1,2): if 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 else: for i in range(-2,3): for j in range(-2,3): if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 for line in lines: x,y,z = map(int, line) drop(x,y,z) n = 0 m = 0 for f in field: for e in f: if e > m: m = e if e==0: n+=1 print(n) print(m)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s497775157
p00026
Runtime Error
import sys lines = [] for line in sys.stdin: lines.append(line.strip().split(',')) field = [[0 for i in range(10)] for j in range(10)] def drop(x, y, z): if z==1: for i in range(-1,2): for j in range(-1,2): if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 elif z==2: for i in range(-1,2): for j in range(-1,2): if 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 else: for i in range(-2,3): for j in range(-2,3): if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 for line in lines: x,y,z = map(int, line) drop(x,y,z)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s685354574
p00026
Runtime Error
import sys lines = [] for line in sys.stdin: lines.append(line.strip().split(',')) field = [[0 for i in range(10)] for j in range(10)] def drop(x, y, z): if z==1: for i in range(-1,2): for j in range(-1,2): if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 elif z==2: for i in range(-1,2): for j in range(-1,2): if 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 elif z==3: for i in range(-2,3): for j in range(-2,3): if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10: field[y+j][x+i] += 1 for line in lines: x,y,z = map(int, line) drop(x,y,z) n = 0 m = 0 for f in field: for e in f: if e > m: m = e if e==0: n+=1 print(n) print(m)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s505337805
p00026
Runtime Error
mass = [[0 for p in xrange(14)] for q in xrange(14)] while True: try: x,y,size = map(int,raw_input().split(',')) if size = 1: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=0,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=0,mass[x][y-1]+=1,mass[x+1][y-1]+=0,mass[x+2][y-1]+=0 mass[x-2][y] +=0,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=0 mass[x-2][y+1]+=0,mass[x-1][y+1]+=0,mass[x][y+1]+=1,mass[x+1][y+1]+=0,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=0,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 elif size = 2: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=0,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=1,mass[x][y-1]+=1,mass[x+1][y-1]+=1,mass[x+2][y-1]+=0 mass[x-2][y] +=0,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=0 mass[x-2][y+1]+=0,mass[x-1][y+1]+=1,mass[x][y+1]+=1,mass[x+1][y+1]+=1,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=0,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 elif size = 3: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=1,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=1,mass[x][y-1]+=1,mass[x+1][y-1]+=1,mass[x+2][y-1]+=0 mass[x-2][y] +=1,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=1 mass[x-2][y+1]+=0,mass[x-1][y+1]+=1,mass[x][y+1]+=1,mass[x+1][y+1]+=1,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=1,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 except: break white = 0 max = 0 for p in xrange(2,12): for val in xrange(2,12): if mass[p][q] == 0: white += 1 if mass[p][q] > figure: max = mass[p][q] print white prit max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s035271935
p00026
Runtime Error
mass = [[0 for p in xrange(14)] for q in xrange(14)] while True: try: x,y,size = map(int,raw_input().split(',')) if size = 1: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=0,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=0,mass[x][y-1]+=1,mass[x+1][y-1]+=0,mass[x+2][y-1]+=0 mass[x-2][y] +=0,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=0 mass[x-2][y+1]+=0,mass[x-1][y+1]+=0,mass[x][y+1]+=1,mass[x+1][y+1]+=0,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=0,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 elif size = 2: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=0,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=1,mass[x][y-1]+=1,mass[x+1][y-1]+=1,mass[x+2][y-1]+=0 mass[x-2][y] +=0,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=0 mass[x-2][y+1]+=0,mass[x-1][y+1]+=1,mass[x][y+1]+=1,mass[x+1][y+1]+=1,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=0,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 elif size = 3: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=1,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=1,mass[x][y-1]+=1,mass[x+1][y-1]+=1,mass[x+2][y-1]+=0 mass[x-2][y] +=1,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=1 mass[x-2][y+1]+=0,mass[x-1][y+1]+=1,mass[x][y+1]+=1,mass[x+1][y+1]+=1,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=1,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 except: break white = 0 max = 0 for p in xrange(2,12): for val in xrange(2,12): if mass[p][q] == 0: white += 1 if mass[p][q] > figure: max = mass[p][q] print white prit max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s870350838
p00026
Runtime Error
mass = [[0 for p in xrange(14)] for q in xrange(14)] while True: try: x,y,size = map(int,raw_input().split(',')) if size == 1: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=0,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=0,mass[x][y-1]+=1,mass[x+1][y-1]+=0,mass[x+2][y-1]+=0 mass[x-2][y] +=0,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=0 mass[x-2][y+1]+=0,mass[x-1][y+1]+=0,mass[x][y+1]+=1,mass[x+1][y+1]+=0,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=0,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 elif size == 2: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=0,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=1,mass[x][y-1]+=1,mass[x+1][y-1]+=1,mass[x+2][y-1]+=0 mass[x-2][y] +=0,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=0 mass[x-2][y+1]+=0,mass[x-1][y+1]+=1,mass[x][y+1]+=1,mass[x+1][y+1]+=1,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=0,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 elif size == 3: mass[x-2][y-2]+=0,mass[x-1][y-2]+=0,mass[x][y-2]+=1,mass[x+1][y-2]+=0,mass[x+2][y-2]+=0 mass[x-2][y-1]+=0,mass[x-1][y-1]+=1,mass[x][y-1]+=1,mass[x+1][y-1]+=1,mass[x+2][y-1]+=0 mass[x-2][y] +=1,mass[x-1][y] +=1,mass[x][y] +=1,mass[x+1][y] +=1,mass[x+2][y] +=1 mass[x-2][y+1]+=0,mass[x-1][y+1]+=1,mass[x][y+1]+=1,mass[x+1][y+1]+=1,mass[x+2][y+1]+=0 mass[x-2][y+2]+=0,mass[x-1][y+2]+=0,mass[x][y+2]+=1,mass[x+1][y+2]+=0,mass[x+2][y+2]+=0 except: break white = 0 max = 0 for p in xrange(2,12): for val in xrange(2,12): if mass[p][q] == 0: white += 1 if mass[p][q] > figure: max = mass[p][q] print white prit max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s648265232
p00026
Runtime Error
mass = [[0 for p in xrange(14)] for q in xrange(14)] while True: try: x,y,size = map(int,raw_input().split(',')) if size == 1: mass[x-2][y-2]+=0;mass[x-1][y-2]+=0;mass[x][y-2]+=0;mass[x+1][y-2]+=0;mass[x+2][y-2]+=0 mass[x-2][y-1]+=0;mass[x-1][y-1]+=0;mass[x][y-1]+=1;mass[x+1][y-1]+=0;mass[x+2][y-1]+=0 mass[x-2][y] +=0;mass[x-1][y] +=1;mass[x][y] +=1;mass[x+1][y] +=1;mass[x+2][y] +=0 mass[x-2][y+1]+=0;mass[x-1][y+1]+=0;mass[x][y+1]+=1;mass[x+1][y+1]+=0;mass[x+2][y+1]+=0 mass[x-2][y+2]+=0;mass[x-1][y+2]+=0;mass[x][y+2]+=0;mass[x+1][y+2]+=0;mass[x+2][y+2]+=0 elif size == 2: mass[x-2][y-2]+=0;mass[x-1][y-2]+=0;mass[x][y-2]+=0;mass[x+1][y-2]+=0;mass[x+2][y-2]+=0 mass[x-2][y-1]+=0;mass[x-1][y-1]+=1;mass[x][y-1]+=1;mass[x+1][y-1]+=1;mass[x+2][y-1]+=0 mass[x-2][y] +=0;mass[x-1][y] +=1;mass[x][y] +=1;mass[x+1][y] +=1;mass[x+2][y] +=0 mass[x-2][y+1]+=0;mass[x-1][y+1]+=1;mass[x][y+1]+=1;mass[x+1][y+1]+=1;mass[x+2][y+1]+=0 mass[x-2][y+2]+=0;mass[x-1][y+2]+=0;mass[x][y+2]+=0;mass[x+1][y+2]+=0;mass[x+2][y+2]+=0 elif size == 3: mass[x-2][y-2]+=0;mass[x-1][y-2]+=0;mass[x][y-2]+=1;mass[x+1][y-2]+=0;mass[x+2][y-2]+=0 mass[x-2][y-1]+=0;mass[x-1][y-1]+=1;mass[x][y-1]+=1;mass[x+1][y-1]+=1;mass[x+2][y-1]+=0 mass[x-2][y] +=1;mass[x-1][y] +=1;mass[x][y] +=1;mass[x+1][y] +=1;mass[x+2][y] +=1 mass[x-2][y+1]+=0;mass[x-1][y+1]+=1;mass[x][y+1]+=1;mass[x+1][y+1]+=1;mass[x+2][y+1]+=0 mass[x-2][y+2]+=0;mass[x-1][y+2]+=0;mass[x][y+2]+=1;mass[x+1][y+2]+=0;mass[x+2][y+2]+=0 except: break white = 0 max = 0 for p in xrange(2,12): for val in xrange(2,12): if mass[p][q] == 0: white += 1 if mass[p][q] > figure: max = mass[p][q] print white prit max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s863559118
p00026
Runtime Error
mass = [[0 for p in xrange(14)] for q in xrange(14)] while True: try: x,y,size = map(int,raw_input().split(',')) if size == 1: mass[x-2][y-2]+=0;mass[x-1][y-2]+=0;mass[x][y-2]+=0;mass[x+1][y-2]+=0;mass[x+2][y-2]+=0 mass[x-2][y-1]+=0;mass[x-1][y-1]+=0;mass[x][y-1]+=1;mass[x+1][y-1]+=0;mass[x+2][y-1]+=0 mass[x-2][y] +=0;mass[x-1][y] +=1;mass[x][y] +=1;mass[x+1][y] +=1;mass[x+2][y] +=0 mass[x-2][y+1]+=0;mass[x-1][y+1]+=0;mass[x][y+1]+=1;mass[x+1][y+1]+=0;mass[x+2][y+1]+=0 mass[x-2][y+2]+=0;mass[x-1][y+2]+=0;mass[x][y+2]+=0;mass[x+1][y+2]+=0;mass[x+2][y+2]+=0 elif size == 2: mass[x-2][y-2]+=0;mass[x-1][y-2]+=0;mass[x][y-2]+=0;mass[x+1][y-2]+=0;mass[x+2][y-2]+=0 mass[x-2][y-1]+=0;mass[x-1][y-1]+=1;mass[x][y-1]+=1;mass[x+1][y-1]+=1;mass[x+2][y-1]+=0 mass[x-2][y] +=0;mass[x-1][y] +=1;mass[x][y] +=1;mass[x+1][y] +=1;mass[x+2][y] +=0 mass[x-2][y+1]+=0;mass[x-1][y+1]+=1;mass[x][y+1]+=1;mass[x+1][y+1]+=1;mass[x+2][y+1]+=0 mass[x-2][y+2]+=0;mass[x-1][y+2]+=0;mass[x][y+2]+=0;mass[x+1][y+2]+=0;mass[x+2][y+2]+=0 elif size == 3: mass[x-2][y-2]+=0;mass[x-1][y-2]+=0;mass[x][y-2]+=1;mass[x+1][y-2]+=0;mass[x+2][y-2]+=0 mass[x-2][y-1]+=0;mass[x-1][y-1]+=1;mass[x][y-1]+=1;mass[x+1][y-1]+=1;mass[x+2][y-1]+=0 mass[x-2][y] +=1;mass[x-1][y] +=1;mass[x][y] +=1;mass[x+1][y] +=1;mass[x+2][y] +=1 mass[x-2][y+1]+=0;mass[x-1][y+1]+=1;mass[x][y+1]+=1;mass[x+1][y+1]+=1;mass[x+2][y+1]+=0 mass[x-2][y+2]+=0;mass[x-1][y+2]+=0;mass[x][y+2]+=1;mass[x+1][y+2]+=0;mass[x+2][y+2]+=0 except: break white = 0 max = 0 for p in xrange(2,12): for val in xrange(2,12): if mass[p][q] == 0: white += 1 if mass[p][q] > figure: max = mass[p][q] print white print max
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s410173806
p00026
Runtime Error
import sys class Paper: def __init__(self): self.paper = [[0 for x in range(10)] for y in range(10)] def white_space(self): s = 0 for x in range(10): for y in range(10): if self.paper[x][y] == 0: s += 1 return s def most_dark(self): s = 0 for x in range(10): for y in range(10): if self.paper[x][y] > s: s = self.paper[x][y] return s def drop(self, x, y, size): r = [] if size == 1: r.append((x,y)) r.append((x-1,y)) r.append((x+1,y)) r.append((x,y-1)) r.append((x,y+1)) elif size == 2: r = [(i,j) for i in range(x-1, x+2) for j in range(y-1, y+2)] elif size == 3: r = [(i,j) for i in range(x-1, x+2) for j in range(y-1, y+2)] r.append((x-2, y)) r.append((x+2, y)) r.append((x, y-2)) r.append((x, y+2)) else: pass for p in r: self.paper[p[0]][p[1]] += 1 return self #input_file = open(sys.argv[1], 'r') paper = Paper() for line in sys.stdin: (x, y, size) = tuple(map(int, line.split(','))) paper.drop(x, y, size) print paper.white_space() print paper.most_dark()
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s305503481
p00026
Runtime Error
import sys class Paper: def __init__(self): self.paper = [[0 for x in range(10)] for y in range(10)] def white_space(self): s = 0 for x in range(10): for y in range(10): if self.paper[x][y] == 0: s += 1 return s def most_dark(self): s = 0 for x in range(10): for y in range(10): if self.paper[x][y] > s: s = self.paper[x][y] return s def drop(self, x, y, size): r = [] if size == 1: r.append((x,y)) r.append((x-1,y)) r.append((x+1,y)) r.append((x,y-1)) r.append((x,y+1)) elif size == 2: r = [(i,j) for i in range(x-1, x+2) for j in range(y-1, y+2)] elif size == 3: r = [(i,j) for i in range(x-1, x+2) for j in range(y-1, y+2)] r.append((x-2, y)) r.append((x+2, y)) r.append((x, y-2)) r.append((x, y+2)) else: pass r = filter(self.out_of_paper, r) try: for p in r: self.paper[p[0]][p[1]] += 1 except: pass return self def out_of_paper(p): if p[0] >= 0 and p[1] >= 0: True else: False #input_file = open(sys.argv[1], 'r') paper = Paper() for line in sys.stdin: (x, y, size) = tuple(map(int, line.split(','))) paper.drop(x, y, size) print paper.white_space() print paper.most_dark()
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s083395476
p00026
Runtime Error
#use 14x14 paper paper = [[0 for i in range(14)] for i in range(14)] while True: try: x, y, s = map(int, raw_input().split(",")) x += 2; y += 2 if s == 1: paper[x][y] += 1 for i in range(-1,2,2): paper[x+i][y] += 1 paper[x][y+1] += 1 elif s == 2: for i in range(-1,2): for j in range(-1,2): paper[x+i][y+j] += 1 else: paper[x+2][y] += 1; paper[x-2][y] += 1 paper[x][y+2] += 1; paper[x][y-2] += 1 for i in range(-1,2): for j in range(-1,2): paper[x+i][y+j] += 1 except: break #count white and check max element in paper white = 0 max = 0 for i in range(2,12): for j in range(2,12): if paper[i][j] == 0: white += 1 elif paper[i][j] > max: max = paper[i][j] print "%d" % (white) print "%max" % (max)
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s905521283
p00026
Runtime Error
import sys def ink(x,y,size): global P P[y][x]+=1 for d in [-1,1]: P[y+d][x]+=1 P[y][x+d]+=1 if size==1: return for d in [-1,1]: P[y+d][x+d]+=1 P[y+d][x-d]+=1 if size==2: return for d in [-2,2]: P[y+d][x]+=1 P[y][x+d]+=1 return R=range(14) A=[-1:1] P=[[0 for i in R] for j in R] for s in sys.stdin: x,y,size = map(int, s.split(",")) ink(x+2,y+2,size) c=0 m=0 for e in P[2:-2]: x=e[2:-2] c+=x.count(0) m=max(max(x),m) print c print m
2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1
77 5
<H1>Dropping Ink</H1> <p> As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (<var>x</var>, <var>y</var>) coordinate system. </p> <p> We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as shown in the figure depending on its size. In the figure, a star denotes the point of fall and a circle denotes the surrounding cells. </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink1"></center> <br/> <p> Originally, the paper is white that means for each cell the value of density is 0. The value of density is increased by 1 when the ink sinks into the corresponding cells. For example, if we put a drop of Small ink at (1, 2) and a drop of Medium ink at (3, 2), the ink will sink as shown in the following figure (left side): </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ink2"></center> <br/> <p> In the figure, density values of empty cells are 0. The ink sinking into out of the paper should be ignored as shown in the figure (top side). We can put several drops of ink at the same point. </p> <p> Your task is to write a program which reads a sequence of points of fall (<var>x</var>, <var>y</var>) with its size (Small = 1, Medium = 2, Large = 3), and prints the number of cells whose density value is 0. The program must also print the maximum value of density. </p> <p> You may assume that the paper always consists of 10 &times; 10, and 0 &le; <var>x</var> &lt; 10, 0 &le; <var>y</var> &lt; 10. </p> <H2>Input</H2> <pre> <var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>s<sub>1</sub></var> <var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>s<sub>2</sub></var> : : </pre> <p> (<var>x<sub>i</sub></var>, <var>y<sub>i</sub></var>) represents the position of the <var>i</var>-th drop and <var>s<sub>i</sub></var> denotes its size. The number of drops is less than or equal to 50. </p> <H2>Output</H2> <p> Print the number of cells whose density value is 0 in first line.<br> Print the maximum value of density in the second line. </p> <H2>Sample Input</H2> <pre> 2,5,3 3,6,1 3,4,2 4,5,2 3,6,3 2,4,1 </pre> <H2>Output for the Sample Input</H2> <pre> 77 5 </pre>
s093365546
p00027
Wrong Answer
import datetime print datetime.datetime.now()
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s849401669
p00027
Wrong Answer
days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] dom=[31,29,31,30,31,60,31,31,30,31,30,31] while True: try: (m,d)=map(int,raw_input().split()) if m==0 and d==0: break day=4-1 for i in xrange(m-1): day+=dom[i] day+=d print days[day%7] except EOFError: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s755891822
p00027
Wrong Answer
days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] dom=[31,29,31,30,31,60,31,31,30,31,30,31] while True: try: try: (m,d)=map(int,raw_input().split()) except: break if m==0 and d==0: break day=4-1 for i in xrange(m-1): day+=dom[i] day+=d print days[day%7] except EOFError: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s909622481
p00027
Wrong Answer
import sys import math dayy = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def days(a, day): if a == 0: return day else: return days(a-1, day + dayy[a]) while 1: inp = raw_input().split() ii = int(inp[0]) jj = int(inp[1]) if ii == 0 and jj== 0: break ans = days(ii-1, 0) + jj print ans ans = ans % 7 if ans == 1: print "Thursday" continue if ans == 2: print "Friday" continue if ans == 3: print "Saturday" continue if ans == 4: print "Sunday" continue if ans == 5: print "Monday" continue if ans == 6: print "Tuesday" continue if ans == 0: print "Wedneday" continue
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s192502481
p00027
Wrong Answer
from datetime import date import sys for line in sys.stdin.readlines(): m , d = map(int,line.split()) if m != 0 and d != 0 : val = date(2004,m,d) day = val.isoweekday() if day == 0: print("Sunday") elif day == 1: print("Monday") elif day == 2: print("Tuesday") elif day == 3: print("Wednesday") elif day == 4: print("Thursday") elif day == 5: print("Friday") else: print("Saturday") else: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s951924821
p00027
Wrong Answer
def day(x,y): start=0 if (x==1 or x==10): start=3 elif (x==2 or x==3 or x==11): start=6 elif (x==4 or x==7): start=2 elif x==5: start=4 elif x==6: start=0 elif x==8: start=5 else: start=1 day=(start+y)%7 if day==1: return "Sunday" elif day==2: return "Monday" elif day==3: return "Tuesday" elif day==4: return "Wednesday" elif day==5: return "Thursday" elif day==6: return "Friday" else:#0 return "Saturday" while True: x,y=map(int,input().split()) if x==y==0: break print(day(x,y))
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s458352094
p00027
Wrong Answer
def day(x,y): start=0 if x==2 or x==8 : start=0 elif x==3 or x==11: start=1 elif x==6: start=2 elif x==9 or x==12: start=3 elif x==1 or x==4: start=4 else: start=6 day=(start+y)%7 if day==1: return "Sunday" elif day==2: return "Monday" elif day==3: return "Tuesday" elif day==4: return "Wednesday" elif day==5: return "Thursday" elif day==6: return "Friday" else:#0 return "Saturday" while True: x,y=map(int,input().split()) if x==y==0: break print(day(x,y))
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s268549946
p00027
Wrong Answer
month = [31, 30, 29, 30, 31, 30, 31, 31, 30, 31, 30, 31] day = ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday'] while True: m, d = map(int, input().split()) if m == 0: break print(day[(sum(month[:m - 1]) + d) % 7])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s794582986
p00027
Wrong Answer
# -*- coding: utf-8 -*- import sys days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Satday"] while True: ans = 3 m, d = map(int, raw_input().split()) if m == 0 or d == 0: break for i in range(1, m): if i == 2: ans = (ans+1)%7 elif i == 4 or i == 6 or i == 9 or i == 11: ans = (ans+2)%7 else: ans = (ans+3)%7 ans = (ans+d)%7 print days[ans]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s845541382
p00027
Wrong Answer
# -*- coding: utf-8 -*- import sys days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Satday"] while True: ans = 3 m, d = map(int, raw_input().split()) if m == 0: break for i in range(1, m): if i == 2: ans = (ans+1)%7 elif i == 4 or i == 6 or i == 9 or i == 11: ans = (ans+2)%7 else: ans = (ans+3)%7 ans = (ans+d)%7 print days[ans]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s073936413
p00027
Wrong Answer
day = ( 'Thursday', 'Friday', 'Saturday', # 2 'Sunday', 'Monday', # 4 'Tuesday', 'Wednesday', ) mm = {1:0, 2:3, 3:4, 4:5, 5:3, 6:5, 7:0, 8:3, 9:6, 10:1, 11:4, 12:6, } while 1: m, d = list(map(int, input().split())) if m == 0: break print(day[(mm[m] + d - 1)%7])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s309987204
p00027
Wrong Answer
c = [] m = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] w = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] s = 3 for d in m: c.append([(s + i) % 7 for i in xrange(d)]) s = (s + 1) % 7 while 1: mon, day = map(int, raw_input().split()) if mon == 0: break print w[c[mon - 1][day - 1]]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s169150135
p00027
Wrong Answer
import math def Wit(y,m,d): if m == 1 or m == 2: y -= 1 m += 12 e = math.floor((26 * (m + 1)) / 10) Y = y % 100 C = math.floor(y / 100) f = math.floor(C / 4) g = math.floor(Y / 4) h = d + e + Y + f + g - 2 * C h = int(h % 7) return h while True: y = 2004 m,d = map(int,input().split()) if m == 0 and d == 0: break You = Wit(y,m,d) if You == 1: print("Sunday") elif You == 2: print("Tuesday") elif You == 3: print("Monday") elif You == 4: print("Wednesday") elif You == 5: print("Thursday") elif You == 6: print("Friday") elif You == 0: print("Saturday")
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s845858864
p00027
Wrong Answer
from datetime import date week=["Monday","Trueday","Wednesday","Thursday","Friday","Saturday","Sunday"] while True: a,b=map(int,input().split()) if a==0: break print(week[date(2004,a,b).weekday()])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s898920676
p00027
Wrong Answer
# -*- coding: utf-8 -*- import sys import os import datetime DAY_OF_WEEK = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] for s in sys.stdin: month, day = map(int, s.split()) if month == day == 0: break if month == 2 and day == 29: yday = datetime.date(2014, month, day - 1).timetuple().tm_yday + 1 elif month == 3: yday = datetime.date(2014, month, day).timetuple().tm_yday + 1 else: yday = datetime.date(2014, month, day).timetuple().tm_yday a = DAY_OF_WEEK[(3 + yday) % 7] print(a)
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s008893034
p00027
Wrong Answer
month, day = map(int, raw_input().split()) days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] youbi = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] while month != 0: Days = 0 for i in range(month - 1): Days += days[i] Days += day print youbi[Days % 7] month, day = map(int, raw_input().split())
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s628966601
p00027
Wrong Answer
month, day = map(int, raw_input().split()) days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] youbi = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] while month != 0: Days = 0 for i in range(month - 1): Days += days[i] Days += day print youbi[(Days+4) % 7] month, day = map(int, raw_input().split())
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s084284891
p00027
Wrong Answer
lis=[0 for i in range(7)] lis[0]="Wednesday" lis[1]="Thursday" lis[2]="Friday" lis[3]="Saturday" lis[4]="Sunday" lis[5]="Monday" lis[6]="Tuesday" while 1: date=0 x,y=map(int,input().split()) if x!=0 and y!=0: for i in range(1,x): if x==1 or 3 or 5 or 7 or 8 or 10 or 12 : date += 31 elif x==2: date +=29 else: date+=30 k=(date+y)%7 print(lis[k]) else: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s139866165
p00027
Wrong Answer
lis=[0 for i in range(7)] lis[0]="Wednesday" lis[1]="Thursday" lis[2]="Friday" lis[3]="Saturday" lis[4]="Sunday" lis[5]="Monday" lis[6]="Tuesday" while 1: date=0 x,y=map(int,input().split()) if x!=0 and y!=0: for i in range(1,x): if i==(4 or 6 or 9 or 11): date=date+30 elif i==2: date =date+29 else: date=date+31 k=(date+y)%7 print(lis[k]) else: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s213076471
p00027
Wrong Answer
lis=[0 for i in range(7)] lis[0]="Wednesday" lis[1]="Thursday" lis[2]="Friday" lis[3]="Saturday" lis[4]="Sunday" lis[5]="Monday" lis[6]="Tuesday" while 1: date=0 x,y=map(int,input().split()) if x!=0 and y!=0: for i in range(1,x): if i==4 or i==6 or i==9 or i==11: date=date+30 elif i==2: date =date+29 else: date=date+31 print(date) k=(date+y)%7 print(date+y) print(lis[k]) else: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s690502542
p00027
Wrong Answer
import sys DoD = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"] def getPNoD(n): if n == 1: return 0 elif n == 3: return 29 elif (n % 2 == 0 and n < 8) or (n % 2 == 0 and n >= 8): return 31 + getPNoD(n-1) else: return 30 + getPNoD(n-1) for line in sys.stdin: m, d = [int(i) for i in line.split()] if m == 0: break n = getPNoD(m) + d - 1 print(DoD[n % 7])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s549513551
p00027
Wrong Answer
import sys DoD = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"] def getPNoD(n): if n == 1: return 0 elif n == 3: return 29 elif (n % 2 == 0 and n < 8) or (n % 2 != 0 and n >= 8): return 31 + getPNoD(n-1) else: return 30 + getPNoD(n-1) for line in sys.stdin: m, d = [int(i) for i in line.split()] if m == 0: break n = getPNoD(m) + d - 1 print(DoD[n % 7])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s463013338
p00027
Wrong Answer
import sys DoD = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"] def getPNoD(n): if n == 1: return 0 elif n == 3: return 29 elif (n % 2 == 0 and n <= 8) or (n % 2 != 0 and n > 8): return 31 + getPNoD(n-1) else: return 30 + getPNoD(n-1) for line in sys.stdin: m, d = [int(i) for i in line.split()] if m == 0: break n = getPNoD(m) + d - 1 print(DoD[n % 7])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s431655322
p00027
Wrong Answer
import datetime date_list = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] while True: m, d = map(int, input().split()) if m == d == 0: break print(date_list[datetime.date(2014, m, d).weekday()])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s464959601
p00027
Wrong Answer
import datetime date_list = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] while True: m, d = map(int, input().split()) if m == 0 and d == 0: break print(date_list[datetime.date(204, m, d).weekday()])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s637113541
p00027
Wrong Answer
day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues'] month = [0,31,60,91,121,152,182,213,244,274,305,335] m,d=map(int,input().split()) print(day[(month[m-1]+d)%7]+'day')
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s736567633
p00027
Wrong Answer
while 1: day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues'] month = [0,31,60,91,121,152,182,213,244,274,305,335] try: m,d=map(int,input().split()) except: break print(day[(month[m-1]+d)%7]+'day')
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s400883704
p00027
Wrong Answer
def day(Y, m, d, Gregorian=True): from math import floor # ツェラーの公式 if m <= 2: Y -= 1 m += 12 y = Y%100 c = Y//100 g = 5*c+floor(c/4) if Gregorian else 5-c return (d + floor(26*(m+1)/10) + y + floor(y/4) + g) %7 # 0->土曜, 6->金曜 day_en = ["Saturday", "Sunday", "Minday", "Tuesday", "Wednesday", "Thursday", "Friday"] while True: m, d = map(int, input().split()) if m == 0: break print(day_en[day(2004, m, d)])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s361304270
p00027
Wrong Answer
day = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"] month = [31, 29, 30, 31, 30, 31, 31, 30, 31, 30, 31] while True: m, d = map(int, raw_input().split()) if m == d == 0: break print day[(sum(month[0:m-1]) + d - 1) % 7]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s079507440
p00027
Wrong Answer
day = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"] month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 31, 31] while True: m, d = map(int, raw_input().split()) if m == d == 0: break print day[(sum(month[0:m-1]) + d - 1) % 7]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s533802191
p00027
Wrong Answer
while True: a,b=map(int,raw_input().split()) if a+b==0: break kari,day=a,0 if a>2: day+=31+29+b kari-=2 tt = range(1,kari+1) for i in tt: if kari == 1: break if i %2 != 0: day+=31 elif i%2 == 0: day+=30 kari -=1 else: if a == 1: day = b elif a == 2: day = 31+b print ['Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednewday'][(day%7)-1]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s873285218
p00027
Wrong Answer
while True: a,b=map(int,raw_input().split()) if a+b==0: break kari,day=a,0 if a>2: day+=31+29+b kari-=2 tt = range(1,kari+1) for i in tt: if kari == 1: break if i %2 != 0: day+=31 elif i%2 == 0: day+=30 kari -=1 else: if a == 1: day = b elif a == 2: day = 31+b print ['Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednesday'][(day%7)-1]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s953452816
p00027
Wrong Answer
nm = [0,31,29,31,30,31,30,31,31,30,31,30] while True: m,d = map(int,raw_input().split(" ")) if m == 0: break nd = 0 for i in range(m): nd += nm[i] nd += d n = nd%7 if n == 1: print "Thursday" elif n == 2: print "Tryday" elif n == 3: print "Saturday" elif n == 4: print "Sunday" elif n == 5: print "Monday" elif n == 6: print "Tuesday" else: print "Wednesday"
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s619117919
p00027
Wrong Answer
y = [31,29,31,30,31,30,31,31,30,31,30,31] dow = {0:"Monday", 1:"Thuesday", 2:"Wednesday", 3:"Thursday", 4:"Friday", 5:"Saturday", 6:"Sunday"} while True: m, d = map(int, raw_input().split()) if m == 0 and d == 0: break n = 0 for i in range(m): n += y[i] n -= (y[m-1]-d+1) print dow[(n+3)%7]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s132080370
p00027
Accepted
M=[ 31, 29, 31, 30, 31,30,31,31,30,31,30,31] DAY=["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"] m=2 d=29 while True: m,d=map( int , raw_input().split() ) if m==d==0: quit() else: x=0 for i in range(m-1): x+=M[i] x+=d print DAY[x%7]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s474160057
p00027
Accepted
from datetime import date dic={3:"Thursday",4:"Friday",5:"Saturday",6:"Sunday",0:"Monday",1:"Tuesday",2:"Wednesday"} while True: m,d=map(int,input().split()) if m==0 and d==0: break print(dic[date(2004,m,d).weekday()])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s940496432
p00027
Accepted
import sys from datetime import * for line in sys.stdin: a, b = map(int,line.split()) try: print(date(2004, a, b).strftime("%A")) except ValueError: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s322962509
p00027
Accepted
#!/usr/bin/python import datetime days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] while True: m, d = map(int, input().split(' ')) if m == 0: break print(days[datetime.date(2004, m, d).weekday()])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s894041735
p00027
Accepted
import datetime weekdays = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", ] while True: m, d = map(int, raw_input().strip().split(" ")) if m == 0: break print weekdays[datetime.date(2004, m, d).weekday()]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s504638665
p00027
Accepted
from datetime import date week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] while True: line = map(int, raw_input().split()) if line[0] == 0: break print week[date(2004,line[0],line[1]).weekday()]
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s154929983
p00027
Accepted
days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] dom=[31,29,31,30,31,30,31,31,30,31,30,31] while True: try: try: (m,d)=map(int,raw_input().split()) except: break if m==0 and d==0: break day=4-1 for i in xrange(m-1): day+=dom[i] day+=d print days[day%7] except EOFError: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s610929615
p00027
Accepted
days=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'] import calendar while True: try: try: (m,d)=map(int,raw_input().split()) except: break if m==0 and d==0: break print days[calendar.weekday(2004,m,d)] except EOFError: break
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s536235713
p00027
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from datetime import date def print_week(n): n_to_week = {0:"Monday",1:"Tuesday",2:"Wednesday",3:"Thursday",4:"Friday",5:"Saturday",6:"Sunday"} print n_to_week[n] for s in sys.stdin: d = map(int,s.split()) if d == [0,0]: exit() print_week(date(2004,d[0],d[1]).weekday())
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s862177378
p00027
Accepted
import datetime import sys week = {0:'Monday', 1:'Tuesday', 2:'Wednesday', 3:'Thursday', 4:'Friday', 5:'Saturday', 6:'Sunday'} f = sys.stdin while True: month, date = map(int, f.readline().split()) if month == 0: break day = datetime.date(2004, month, date) print(week[day.weekday()])
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>
s441004085
p00027
Accepted
from datetime import date while True: m,d = map(int,raw_input().split(" ")) if m ==0: break w = date(2004,m,d).isoweekday() if w==1: print 'Monday' elif w==2: print 'Tuesday' elif w==3: print 'Wednesday' elif w==4: print 'Thursday' elif w==5: print 'Friday' elif w==6: print 'Saturday' elif w==7: print 'Sunday'
1 1 2 29 0 0
Thursday Sunday
<H1>What day is today?</H1> <p> Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. </p> <H2>Input</H2> <p> The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers <var>m</var> and <var>d</var> separated by a single space in a line. These integers respectively represent the month and the day. </p> <p> The number of datasets is less than or equal to 50. </p> <H2>Output</H2> <p> For each dataset, print the day (please see the following words) in a line. </p> <pre> Monday Tuesday Wednesday Thursday Friday Saturday Sunday </pre> <H2>Sample Input</H2> <pre> 1 1 2 29 0 0 </pre> <H2>Output for the Sample Input</H2> <pre> Thursday Sunday </pre>