Submission #1050215

#TimeUsernameProblemLanguageResultExecution timeMemory
1050215vjudge1Dango Maker (JOI18_dango_maker)Cpython 3
0 / 100
9 ms3164 KiB
n,m=map(int,input().split()) mas=[] for i in range(n): mas.append(list(input())) dic={} for i in range(n): for j in range(m): s1='' s2='' for k in range(3): ik=i+k jk=j+k if ik<n: s1+=mas[ik][j] if jk<m: s2+=mas[i][jk] flag1,flag2=0,0 if s1 in dic: for k in range(len(dic[s1][1])): if dic[s1][1][k]==[i,j]: flag1=1 break if s2 in dic: for k in range(len(dic[s2][1])): if dic[s2][1][k]==[i,j]: flag2=1 break if len(s1)==3 and len(s2)==3 and not flag1 and not flag2: if s1 in dic: dic[s1][1].append([i,j]) dic[s1][1].append([i+1,j]) dic[s1][1].append([i+2,j]) dic[s1][0]+=1 else: dic[s1]=[1,[[i,j],[i+1,j],[i+2,j]]] elif len(s2)==3 and not flag2: if s2 in dic: dic[s2][1].append([i,j]) dic[s2][1].append([i,j+1]) dic[s2][1].append([i,j+2]) dic[s2][0]+=1 else: dic[s2]=[1,[[i,j],[i,j+1],[i,j+2]]] elif len(s1)==3 and not flag1: if s1 in dic: dic[s1][1].append([i,j]) dic[s1][1].append([i+1,j]) dic[s1][1].append([i+2,j]) dic[s1][0]+=1 else: dic[s1]=[1,[[i+1,j],[i,j],[i+2,j]]] mx=0 for i in dic: if mx < dic[i][0]: mx=dic[i][0] print(mx)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...