# 0001, 2022-03-31 08:05:40, -P (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for k in d: x = {} if len(d[k]) != 1: x[k] = d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: x,y = e.split(":") if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0002, 2022-03-31 08:06:42, -P (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for k in d: x = {} if len(d[k]) > 1: x[k] = d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: x,y = e.split(":") if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0003, 2022-03-31 08:06:51, -P (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for k in d: x = {} if len(d[k]) != 1: x[k] = d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: x,y = e.split(":") if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0004, 2022-03-31 08:07:09, xP (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for k in d: x = {} if len(d[k]) != 1: x[k] = d[k] #return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: x,y = e.split(":") if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0005, 2022-03-31 08:09:12, -P (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for k in d: x = {} if len(d[k]) != 1: x[k] = d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: x,y = e.split(":") if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0006, 2022-03-31 08:11:33, -P (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for k in d: x = {} if len(d[k]) != 1: x[k] = d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: x,y = e.split(":") if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0007, 2022-03-31 08:11:44, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for k in d: if len(d[k]) != 1: x[k] = d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: x,y = e.split(":") if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line |
# 0008, 2022-03-31 08:14:28, -- (0%) def remove_len1(d): output = {} for i in d: if len(d[i]) > 1: output = [d,d[i]] return output[0] | # 0009, 2022-03-31 08:14:38, compilation error (0%) def remove_len1(d): output = {} for i in d: if len(d[i]) > 1: output = [d,d[i]] return output[0] def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0010, 2022-03-31 08:15:15, compilation error (0%) def remove_len1(d): output = {} for i in d: if len(d[i]) > 1: output = [d,d[i]] return output[0] def to_type2(type1): exec(input().strip()) | # 0011, 2022-03-31 08:15:22, compilation error (0%) def remove_len1(d): output = {} for i in d: if len(d[i]) > 1: output = [d,d[i]] return output[0] def to_type2(type1): | # 0012, 2022-03-31 08:15:32, -x (0%) def remove_len1(d): output = {} for i in d: if len(d[i]) > 1: output = [d,d[i]] return output[0] def to_type2(type1): return "" exec(input().strip()) | # 0013, 2022-03-31 08:16:30, -P (50%) def remove_len1(d): output = {} for i in d: if len(d[i]) > 1: output = [d,d[i]] return output[0] def to_type2(type1): a = {} for i in type1: i = i.split(':') if i[0] in a : a[i[0]] += [i[1]] else: a[i[0]] = [i[1]] if i[1] in a: a[i[1]] += [i[0]] else: a[i[1]] = [i[0]] return(a) exec(input().strip()) # DON'T remove this line | # 0014, 2022-03-31 08:16:43, PP (100%) def remove_len1(d): output = {} for i in d: if len(d[i]) > 1: output[i] = d[i] return output def to_type2(type1): a = {} for i in type1: i = i.split(':') if i[0] in a : a[i[0]] += [i[1]] else: a[i[0]] = [i[1]] if i[1] in a: a[i[1]] += [i[0]] else: a[i[1]] = [i[0]] return(a) exec(input().strip()) # DON'T remove this line |
# 0015, 2022-03-31 08:03:46, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for R in d: if len(d[R])!=1: ans[R]=d[R] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0016, 2022-03-31 08:08:40, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for R in d: if len(d[R])!=1: ans[R]=d[R] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for d in type1: x=d.split(":") ans[x[0]]=x[1:] return ans exec(input().strip()) # DON'T remove this line | # 0017, 2022-03-31 08:12:17, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for R in d: if len(d[R])!=1: ans[R]=d[R] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for d in type1: x=d.split(":") if x[0] not in ans: ans[x[0]]=[x[1]] else: ans[x[0]].append(x[1]) return ans exec(input().strip()) # DON'T remove this line print(to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])) | # 0018, 2022-03-31 08:12:29, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for R in d: if len(d[R])!=1: ans[R]=d[R] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for d in type1: x=d.split(":") if x[0] not in ans: ans[x[0]]=[x[1]] else: ans[x[0]].append(x[1]) return ans exec(input().strip()) # DON'T remove this line | # 0019, 2022-03-31 08:13:59, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for R in d: if len(d[R])!=1: ans[R]=d[R] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for d in type1: x=d.split(":") if x[0] not in ans: ans[x[0]]=[x[1]] else: if x[1] not in ans[x[0]]: ans[x[0]].append(x[1]) return ans exec(input().strip()) # DON'T remove this line | # 0020, 2022-03-31 08:15:12, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for R in d: if len(d[R])!=1: ans[R]=d[R] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for d in type1: x=d.split(":") if x[0] not in ans: ans[x[0]]=[x[1]] else: if x[1] not in ans[x[0]]: ans[x[0]].append(x[1]) if x[1] not in ans: ans[x[1]]=[x[0]] else: if x[0] not in ans[x[1]]: ans[x[1]].append(x[0]) return ans exec(input().strip()) # DON'T remove this line |
# 0021, 2022-03-31 08:08:13, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) # คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) > 1 : dd[key] = key return dd exec(input().strip()) # DON'T remove this line | # 0022, 2022-03-31 08:10:31, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) # คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) > 1 : dd[key] = d[key] return dd exec(input().strip()) # DON'T remove this line | # 0023, 2022-03-31 08:15:33, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) # คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) > 1 : dd[key] = d[key] return dd def to_type2(type1): dd = {} j = [] for e in type1: j.append(e.split(':')) for e in j: if e[0] not in dd: dd[e[0]] = [e[1]] elif e[0] in d: dd[e[0]].append(e[1]) if e[1] not in d: dd[e[1]] = [e[0]] elif e[1] in d: dd[e[1]].append(e[0]) return dd exec(input().strip()) # DON'T remove this line | # 0024, 2022-03-31 08:15:52, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) # คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) > 1 : dd[key] = d[key] return dd def to_type2(type1): dd = {} j = [] for e in type1: j.append(e.split(':')) for e in j: if e[0] not in d: d[e[0]] = [e[1]] elif e[0] in d: d[e[0]].append(e[1]) if e[1] not in d: d[e[1]] = [e[0]] elif e[1] in d: d[e[1]].append(e[0]) return dd exec(input().strip()) # DON'T remove this line | # 0025, 2022-03-31 08:16:24, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) # คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) > 1 : dd[key] = d[key] return dd def to_type2(type1): d = {} j = [] for e in type1: j.append(e.split(':')) for e in j: if e[0] not in d: d[e[0]] = [e[1]] elif e[0] in d: d[e[0]].append(e[1]) if e[1] not in d: d[e[1]] = [e[0]] elif e[1] in d: d[e[1]].append(e[0]) return dd exec(input().strip()) # DON'T remove this line | # 0026, 2022-03-31 08:16:45, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) # คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) > 1 : dd[key] = d[key] return dd def to_type2(type1): d = {} j = [] for e in type1: j.append(e.split(':')) for e in j: if e[0] not in d: d[e[0]] = [e[1]] elif e[0] in d: d[e[0]].append(e[1]) if e[1] not in d: d[e[1]] = [e[0]] elif e[1] in d: d[e[1]].append(e[0]) return d exec(input().strip()) # DON'T remove this line |
# 0027, 2022-03-31 08:13:32, P- (50%) def remove_len1(d): ans = {} for c in d : if len(d[c]) > 1 : ans[c] = d[c] return ans def to_type2(type1): s = {} for x in type1 : y,z = x.split(':') s[y] = z ss = {} for e in s : ss[s[e]]= e for ch in s : if ch in ss : s[ch] = [s[ch],ss[ch]] for ch2 in ss : if ch2 not in ss : s[ch2] = [ss[ch2]] return s exec(input().strip()) # DON'T remove this line | # 0028, 2022-03-31 08:15:30, P- (50%) def remove_len1(d): ans = {} for c in d : if len(d[c]) > 1 : ans[c] = d[c] return ans def to_type2(type1): s = {} for x in type1 : y,z = x.split(':') s[y] = z ss = {} for e in s : ss[s[e]]= e for ch in s : if ch in ss : s[ch] = [s[ch],ss[ch]] else : s[ch] = [s[ch]] for ch2 in ss : if ch2 not in ss : s[ch2] = [ss[ch2]] return s exec(input().strip()) # DON'T remove this line | # 0029, 2022-03-31 08:15:53, compilation error (0%) def remove_len1(d): ans = {} for c in d : if len(d[c]) > 1 : ans[c] = d[c] return ans for i in range(len(type1)): x = type1[i].split(':') if x[0] not in new_d: new_d[x[0]] = [x[1]] else: new_d[x[0]].append(x[1]) if x[1] not in new_d: new_d[x[1]] = [x[0]] else: new_d[x[1]].append(x[0]) return new_d exec(input().strip()) # DON'T remove this line | # 0030, 2022-03-31 08:16:18, PP (100%) def remove_len1(d): ans = {} for c in d : if len(d[c]) > 1 : ans[c] = d[c] return ans def to_type2(type1): new_d = {} for i in range(len(type1)): x = type1[i].split(':') if x[0] not in new_d: new_d[x[0]] = [x[1]] else: new_d[x[0]].append(x[1]) if x[1] not in new_d: new_d[x[1]] = [x[0]] else: new_d[x[1]].append(x[0]) return new_d exec(input().strip()) # DON'T remove this line | # 0031, 2022-03-31 08:16:49, Px (50%) def remove_len1(d): ans = {} for c in d : if len(d[c]) > 1 : ans[c] = d[c] return ans def to_type2(type1): ans = {} for i in range(len(type1)): x = type1[i].split(':') if x[0] not in new_d: ans[x[0]] = [x[1]] else: ans[x[0]].append(x[1]) if x[1] not in new_d: ans[x[1]] = [x[0]] else: ans[x[1]].append(x[0]) return ans exec(input().strip()) # DON'T remove this line |
# 0032, 2022-03-31 08:11:53, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} l = {} for key in d: if len(key[i]) != 1: l[i] = key[i] return l | # 0033, 2022-03-31 08:12:09, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} l = {} for key in d: if len(key[i]) != 1: l[i] = key[i] return l exec(input().strip()) # DON'T remove this line | # 0034, 2022-03-31 08:13:11, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} l = {} for key in d: if len(d[key]) != 1: l[key] = d[key] return l exec(input().strip()) # DON'T remove this line | # 0035, 2022-03-31 08:16:52, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} l = {} for key in d: if len(d[key]) != 1: l[key] = d[key] return l def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 l = {} for e in type1: key,value = e.split(":") if key not in l: l[key] = [] if value not in l: l[value] = [] for e in type1: key,value = e.split(":") z = l[key] z.append(value) l[key] = z k = l[value] k.append(key) l[value] = k return l exec(input().strip()) # DON'T remove this line |
# 0036, 2022-03-31 08:08:18, P- (50%) def remove_len1(d): d2 = {} for e in d: if len(d[e])>1:d2[e]=d[e] return d2 def to_type2(type1): d = {} for e in type1: if e[0] not in d: d[e[0]]=[e[2]] d[e[2]]=[e[0]] else:d[e[0]].append(e[2]) return d exec(input().strip()) | # 0037, 2022-03-31 08:10:34, P- (50%) def remove_len1(d): d2 = {} for e in d: if len(d[e])>1:d2[e]=d[e] return d2 def to_type2(type1): d = {} for e in type1: c = e.split(':') if c[0] not in d: d[c[0]]=[c[1]] d[c[1]]=[c[0]] else:d[c[0]].append(c[1]) return d exec(input().strip()) | # 0038, 2022-03-31 08:16:30, P- (50%) def remove_len1(d): d2 = {} for e in d: if len(d[e])>1:d2[e]=d[e] return d2 def to_type2(type1): d = {} for e in type1: c = e.split(':') if c[0] not in d: d[c[0]]=[c[1]] if c[1] not in d: print(c) d[c[1]] = [c[0]] else:d[c[1]].append(c[0]) else: d[c[0]].append(c[1]) if c[1] not in d: print(c) d[c[1]] = [c[0]] else:d[c[1]].append(c[0]) return d exec(input().strip()) | # 0039, 2022-03-31 08:16:52, PP (100%) def remove_len1(d): d2 = {} for e in d: if len(d[e])>1:d2[e]=d[e] return d2 def to_type2(type1): d = {} for e in type1: c = e.split(':') if c[0] not in d: d[c[0]]=[c[1]] if c[1] not in d: d[c[1]] = [c[0]] else:d[c[1]].append(c[0]) else: d[c[0]].append(c[1]) if c[1] not in d: d[c[1]] = [c[0]] else:d[c[1]].append(c[0]) return d exec(input().strip()) |
# 0040, 2022-03-31 08:08:26, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for i in type1: if i not in a: a[i] = [type1[i]] if type1[i] not in a: a[type1[i]] = [i] if i in a: a[i] += [type1[i]] if type1[i] in a: a[type1[i]] += [i] return a exec(input().strip()) | # 0041, 2022-03-31 08:10:59, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for i in type1: b = i.split(':') if b[0] not in a: a[b[0]] = [b[1]] if b[1] not in a: a[b[1]] = [b[0]] if b[0] in a: a[b[0]] += [b[1]] if b[1] in a: a[b[1]] += [b[0]] return a exec(input().strip()) | # 0042, 2022-03-31 08:15:37, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for i in type1: b = i.split(':') if b[0] not in a: if b[1] not in a[b[0]]: a[b[0]] = [b[1]] if b[1] not in a: if b[0] not in a[b[1]]: a[b[1]] = [b[0]] if b[0] in a: if b[1] not in a[b[0]]: a[b[0]] += [b[1]] if b[1] in a: if b[0] not in a[b[1]]: a[b[1]] += [b[0]] return a exec(input().strip()) | # 0043, 2022-03-31 08:16:23, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for i in type1: b = i.split(':') if b[0] not in a: a[b[0]] = [b[1]] if b[1] not in a: a[b[1]] = [b[0]] if b[0] in a: if b[1] not in a[b[0]]: a[b[0]] += [b[1]] if b[1] in a: if b[0] not in a[b[1]]: a[b[1]] += [b[0]] return a exec(input().strip()) |
# 0044, 2022-03-31 08:08:39, compilation error (0%) def remove_len1(d): max = 0 dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0045, 2022-03-31 08:09:00, compilation error (0%) def remove_len1(d): dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0046, 2022-03-31 08:09:29, Px (50%) def remove_len1(d): dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): pass # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0047, 2022-03-31 08:14:26, PP (100%) def remove_len1(d): dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): d = {} for edge in type1: u, v = edge.split(':') if u not in d: d[u] = [] if v not in d: d[v] = [] d[u].append(v) d[v].append(u) return d # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0048, 2022-03-31 08:08:22, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = {} for y in d: x = len(d[y]) if x != 1: new[y] = d[y] return new | # 0049, 2022-03-31 08:14:58, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = {} for y in d: x = len(d[y]) if x != 1: new[y] = d[y] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 new_dic = {} for i in range(len(type1)): for ch in type1: key, value = ch.split(":") if key not in new_dic: new_dic[key] = [value] if value not in new_dic: new_dic[value] = [key] if key in new_dic: new_dic[key].append(value) if key in new_dic: new_dic[value].append(key) return new_dic exec(input().strip()) # DON'T remove this line | # 0050, 2022-03-31 08:16:11, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = {} for y in d: x = len(d[y]) if x != 1: new[y] = d[y] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 new_dic = {} for i in range(len(type1)): for ch in type1: key, value = ch.split(":") if key not in new_dic: new_dic[key] = [value] if value not in new_dic: new_dic[value] = [key] if key in new_dic and value not in new_dic[key]: new_dic[key].append(value) if key in new_dic and key not in new_dic[value]: new_dic[value].append(key) return new_dic exec(input().strip()) # DON'T remove this line | # 0051, 2022-03-31 08:16:45, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = {} for y in d: x = len(d[y]) if x != 1: new[y] = d[y] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 new_dic = {} for i in range(len(type1)): for ch in type1: key, value = ch.split(":") if key not in new_dic: new_dic[key] = [value] if value not in new_dic: new_dic[value] = [key] if key in new_dic and value not in new_dic[key]: new_dic[key].append(value) if key in new_dic and key not in new_dic[value]: new_dic[value].append(key) return new_dic exec(input().strip()) # DON'T remove this line |
# 0052, 2022-03-31 08:14:58, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = dict() for i in d.keys(): if len(d[i]) == 1: continue elif len(d[i]) > 1 : new[i] = d[i] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: x,y = i.strip().split(':') if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0053, 2022-03-31 08:15:20, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = dict() for i in d.keys(): if len(d[i]) == 1: continue elif len(d[i]) > 1 : new[i] = d[i] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: x,y = i.strip().split(':') if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0054, 2022-03-31 08:15:40, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = dict() for i in d.keys(): if len(d[i]) == 1: continue elif len(d[i]) > 1 : new[i] = d[i] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: x,y = i.strip().split(':') if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line | # 0055, 2022-03-31 08:15:51, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = dict() for i in d.keys(): if len(d[i]) == 1: continue elif len(d[i]) > 1 : new[i] = d[i] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: x,y = i.strip().split(':') if x in d: d[x].append(y) else: d[x] = [y] if y in d: d[y].append(x) else: d[y] = [x] return d exec(input().strip()) # DON'T remove this line |
# 0056, 2022-03-31 08:14:12, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) != 1 : dd[key] = d[key] return dd def to_type2(type1): data={} for e in type1: x,y=e.split(":") if x in data: data[x]=data[x]+[y] elif x not in data: data[x]=[y] if y in data: data[y]=data[y]+[x] elif y not in data: data[y]=[x] return data exec(input().strip()) # DON'T remove this line | # 0057, 2022-03-31 08:15:21, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) != 1 : dd[key] = d[key] return dd def to_type2(type1): dd={} for e in type1: a,b=e.split(":") if a in data: data[a]=data[a]+[b] elif a not in data: data[a]=[b] if b in data: data[b]=data[b]+[a] elif b not in data: data[b]=[a] return data exec(input().strip()) # DON'T remove this line | # 0058, 2022-03-31 08:15:39, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) != 1 : dd[key] = d[key] return dd def to_type2(type1): dd={} for e in type1: a,b=e.split(":") if a in data: dd[a]=data[a]+[b] elif a not in data: data[a]=[b] if b in data: dd[b]=data[b]+[a] elif b not in data: dd[b]=[a] return dd exec(input().strip()) # DON'T remove this line | # 0059, 2022-03-31 08:16:02, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for key in d : if len(d[key]) != 1 : dd[key] = d[key] return dd def to_type2(type1): dd={} for e in type1: a,b=e.split(":") if a in dd: dd[a]=dd[a]+[b] elif a not in dd: dd[a]=[b] if b in dd: dd[b]=dd[b]+[a] elif b not in dd: dd[b]=[a] return dd exec(input().strip()) # DON'T remove this line |
# 0060, 2022-03-31 08:06:46, Px (50%) def remove_len1(d): r = {} for u in d: if len(d[u]) == 1: pass else: r[u] = d[u] return r # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): ''' ''' # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) | # 0061, 2022-03-31 08:15:42, compilation error (0%) ddef remove_len1(d): r = {} for u in d: if len(d[u]) == 1: pass else: r[u] = d[u] return r # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): d = [] y = {} for i in type1: r,e = i.split() if r in y: y[r] += [e] else: y[r] = [e] if e in y: y[e] += [r] else: y[e] = [r] return y # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0062, 2022-03-31 08:16:06, Px (50%) def remove_len1(d): r = {} for u in d: if len(d[u]) == 1: pass else: r[u] = d[u] return r exec(input().strip()) | # 0063, 2022-03-31 08:17:01, PP (100%) def remove_len1(d): r = {} for u in d: if len(d[u]) == 1: pass else: r[u] = d[u] return r # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): d = [] y = {} for i in type1: r,e = i.split(":") if r in y: y[r] += [e] else: y[r] = [e] if e in y: y[e] += [r] else: y[e] = [r] return y # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0064, 2022-03-31 08:12:05, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new_d = {} for key in d: if len(d[key]) > 1: new_d[key] = d[key] return new_d def to_type2(type1): new_d = {} for i in range(len(type1)): x = type1[i].split(':') if x[0] not in new_d: new_d[x[0]] = [x[1]] else: new_d[x[0]].append(x[1]) if x[1] not in new_d: new_d[x[1]] = [x[0]] else: new_d[x[1]].append(x[0]) return new_d | # 0065, 2022-03-31 08:13:46, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new_d = {} for key in d: if len(d[key]) != 1: new_d[key] = d[key] return new_d def to_type2(type1): new_d = {} for i in range(len(type1)): x = type1[i].split(':') if x[0] not in new_d: new_d[x[0]] = [x[1]] else: new_d[x[0]].append(x[1]) if x[1] not in new_d: new_d[x[1]] = [x[0]] else: new_d[x[1]].append(x[0]) return new_d | # 0066, 2022-03-31 08:14:32, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new_d = {} for key in d: if len(d[key]) != 1: new_d[key] = d[key] return new_d def to_type2(type1): new_d = {} for i in range(len(type1)): x = type1[i].split(':') if x[0] not in new_d: new_d[x[0]] = [x[1]] else: new_d[x[0]].append(x[1]) if x[1] not in new_d: new_d[x[1]] = [x[0]] else: new_d[x[1]].append(x[0]) return new_d exec(input().strip()) # DON'T remove this line |
# 0067, 2022-03-31 08:04:01, -- (0%) def remove_len1(d): a = {} for i in d : if len(d[i]) > 1 : a[i] = d[i] return a | # 0068, 2022-03-31 08:04:41, Px (50%) def remove_len1(d): a = {} for i in d : if len(d[i]) > 1 : a[i] = d[i] return a exec(input().strip()) | # 0069, 2022-03-31 08:14:45, PP (100%) def remove_len1(d): a = {} for i in d : if len(d[i]) > 1 : a[i] = d[i] return a def to_type2(type1): a = {} for i in type1 : v,k = i.split(":") a[v] = [] a[k] = [] for i in a : for u in type1 : p,c = u.split(":") if i == p : a[i].append(c) elif i == c : a[i].append(p) return a exec(input().strip()) |
# 0070, 2022-03-31 08:07:50, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t={} for n in d: if len(d[n])!=1: t[n]=d[n] return t def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for e in type1: k,v=e.split() if k not in d: d[k]=[v] else: d[k]+=[v] if v not in d: d[v]=[k] else: d[v]+=[k] return d exec(input().strip()) # DON'T remove this line | # 0071, 2022-03-31 08:08:53, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t={} for n in d: if len(d[n])!=1: t[n]=d[n] return t def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for e in type1: k,v=e.split() if k not in d: d[k]=[v] else: d[k]+=[v] if v not in d: d[v]=[k] else: d[v]+=[k] return d exec(input().strip()) # DON'T remove this line | # 0072, 2022-03-31 08:13:14, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t={} for n in d: if len(d[n])!=1: t[n]=d[n] return t def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for e in type1: k,v=e.split(":") if k not in d: d[k]=[v] else: d[k]+=[v] if v not in d: d[v]=[k] else: d[v]+=[k] return d exec(input().strip()) # DON'T remove this line |
# 0073, 2022-03-31 08:04:07, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) > 1: a[e] = d[e] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for e in type1: e = e.split(':') if e[0] not in a: a[e[0]] = [] a[e[0]].append(a[1]) return a exec(input().strip()) # DON'T remove this line | # 0074, 2022-03-31 08:05:09, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) > 1: a[e] = d[e] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for e in type1: e = e.split(':') if e[0] not in a: a[e[0]] = [] a[e[0]].append(e[1]) return a exec(input().strip()) # DON'T remove this line | # 0075, 2022-03-31 08:06:11, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) > 1: a[e] = d[e] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for e in type1: e = e.split(':') if e[0] not in a: a[e[0]] = [] if e[1] not in a: a[e[1]] = [] a[e[1]].append(e[0]) a[e[0]].append(e[1]) return a exec(input().strip()) # DON'T remove this line |
# 0076, 2022-03-31 08:15:04, -- (0%) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 res = {} for v in type1: key, v = v.split(':') if key not in res: res[key] = [] if v not in res: res[v] = [] res[key].append(v) res[v].append(key) return res def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 res = {} for v in type1: key, v = v.split(':') if key not in res: res[key] = [v] else: res[key].append(v) if v not in res: res[v] = [key] else: res[v].append(key) return res | # 0077, 2022-03-31 08:15:33, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out={} for key in d: if len(d[key]) != 1: out[key]=d[key] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 res = {} for v in type1: key, v = v.split(':') if key not in res: res[key] = [v] else: res[key].append(v) if v not in res: res[v] = [key] else: res[v].append(key) return res | # 0078, 2022-03-31 08:16:05, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out={} for key in d: if len(d[key]) != 1: out[key]=d[key] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 res = {} for v in type1: key, v = v.split(':') if key not in res: res[key] = [v] else: res[key].append(v) if v not in res: res[v] = [key] else: res[v].append(key) return res exec(input().strip()) # DON'T remove this line |
# 0079, 2022-03-31 08:06:19, Px (50%) def reverse(d): a = {} for i in d: a[d[i]] = i return a def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} b ={} for i in d: if len(d[i])>1: b[i] = d[i] return b def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for i in type1: g = i.strip(':') if g[0] not in type2: type2[g[0]] = [g[1]] elif g[0] in type2: type2[g[0]].append(g[1]) type1 = reverse(type1) for i in type1: g = i.strip(':') if g[0] not in type2: type2[g[0]] = [g[1]] elif g[0] in type2: type2[g[0]].append(g[1]) return type2 exec(input().strip()) # DON'T remove this line | # 0080, 2022-03-31 08:11:29, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} b ={} for i in d: if len(d[i])>1: b[i] = d[i] return b def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for i in type1: g = i.split(':') if g[0] not in type2: type2[g[0]] = [g[1]] elif g[0] in type2: type2[g[0]].append(g[1]) for i in type1: g = i.split(':') if g[1] not in type2: type2[g[1]] = [g[0]] elif g[1] in type2: type2[g[1]].append(g[0]) return type2 exec(input().strip()) # DON'T remove this line | # 0081, 2022-03-31 08:11:36, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} b ={} for i in d: if len(d[i])>1: b[i] = d[i] return b def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for i in type1: g = i.split(':') if g[0] not in type2: type2[g[0]] = [g[1]] elif g[0] in type2: type2[g[0]].append(g[1]) for i in type1: g = i.split(':') if g[1] not in type2: type2[g[1]] = [g[0]] elif g[1] in type2: type2[g[1]].append(g[0]) return type2 exec(input().strip()) # DON'T remove this line |
# 0082, 2022-03-31 08:10:42, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) != 1: a[e] = d[e] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0083, 2022-03-31 08:10:54, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) != 1: a[e] = d[e] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0084, 2022-03-31 08:15:21, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) != 1: a[e] = d[e] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for i in type1: x,y=i.split(":") if x in d: d[x]=d[x]+[y] if x not in d: d[x]=[y] if y in d: d[y]=d[y]+[x] if y not in d: d[y]=[x] return d exec(input().strip()) # DON'T remove this line |
# 0085, 2022-03-31 08:08:36, P- (50%) def remove_len1(d): return dict([i for i in list(d.items()) if len(i[1]) != 1]) def to_type2(type1): type2 = {} for i in type1: a = i.split(":") if a[0] not in type2: type2[a[0]] = [a[1]] else: type2[a[0]].append(a[1]) return type2 exec(input().strip()) | # 0086, 2022-03-31 08:10:52, P- (50%) def remove_len1(d): return dict([i for i in list(d.items()) if len(i[1]) != 1]) def to_type2(type1): type2 = {} for i in type1: a = i.split(":") if a[0] not in type2: type2[a[0]] = [a[1]] elif a[1] not in type2: type2[a[1]] = [a[0]] else: type2[a[0]].append(a[1]) return type2 exec(input().strip()) | # 0087, 2022-03-31 08:13:16, PP (100%) def remove_len1(d): return dict([i for i in list(d.items()) if len(i[1]) != 1]) def to_type2(type1): type2 = {} for i in type1: a = i.split(":") if a[0] not in type2: type2[a[0]] = [a[1]] else: type2[a[0]].append(a[1]) if a[1] not in type2: type2[a[1]] = [a[0]] else: type2[a[1]].append(a[0]) return type2 exec(input().strip()) |
# 0088, 2022-03-31 08:04:15, xx (0%) def remove_len1(d): pass def to_type2(type1): type2 = dict() for e in type1 : a,b = e.split(':') if a not in type2.keys() : type2[a] = [b] else : type2[a].append(b) exec(input().strip()) | # 0089, 2022-03-31 08:05:46, xP (50%) def remove_len1(d): pass def to_type2(type1): type2 = dict() for e in type1 : a,b = e.split(':') if a not in type2.keys() : type2[a] = [b] else : type2[a].append(b) if b not in type2.keys() : type2[b] = [a] else : type2[b].append(a) return type2 exec(input().strip()) | # 0090, 2022-03-31 08:11:11, PP (100%) def remove_len1(d): d2 = dict() for e in d.keys() : v = False if len(d[e]) == 1 : for j in d.values() : if d[e][0] in j : v = True break if not v : d2[e] = d[e] return d2 def to_type2(type1): type2 = dict() for e in type1 : a,b = e.split(':') if a not in type2.keys() : type2[a] = [b] else : type2[a].append(b) if b not in type2.keys() : type2[b] = [a] else : type2[b].append(a) return type2 exec(input().strip()) |
# 0091, 2022-03-31 08:09:16, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for e in d: if len(d[e])!=1: s[e]=d[e] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 s = {} for e in type1: x,y = e.split(':') if x not in s: s[x] = [y] else: s[x].append(y) if y not in s: s[y] = [x] else: s[y].append(x) return s exec(input().strip()) # DON'T remove this line | # 0092, 2022-03-31 08:09:24, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for e in d: if len(d[e])!=1: s[e]=d[e] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 s = {} for e in type1: x,y = e.split(':') if x not in s: s[x] = [y] else: s[x].append(y) if y not in s: s[y] = [x] else: s[y].append(x) return s exec(input().strip()) # DON'T remove this line | # 0093, 2022-03-31 08:11:13, PP (100%) def remove_len1(d): s = {} for e in d: if len(d[e])!=1: s[e]=d[e] return s def to_type2(type1): s = {} for e in type1: x,y = e.split(':') if x not in s: s[x] = [y] else: s[x].append(y) if y not in s: s[y] = [x] else: s[y].append(x) return s exec(input().strip()) |
# 0094, 2022-03-31 08:13:25, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d2={} for a,b in d.items(): if len(b)>1: d2[a]=b return d2 print(remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']})) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for i in type1: i=i.split(':') if i[0] not in d: d[i[0]]=[i[1]] else: d[i[0]].append(i[1]) if i[1] not in d: d[i[1]]=[i[0]] else: d[i[1]].append(i[0]) return d exec(input().strip()) # DON'T remove this line | # 0095, 2022-03-31 08:15:46, -- (0%) def remove_len1(d): d2={} for a,b in d.items(): if len(b)>1: d2[a]=b return d2 print(remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']})) def to_type2(type1): d={} for i in type1: i=i.split(':') if i[0] not in d: d[i[0]]=[i[1]] else: d[i[0]].append(i[1]) if i[1] not in d: d[i[1]]=[i[0]] else: d[i[1]].append(i[0]) return d exec(input().strip()) # DON'T remove this line | # 0096, 2022-03-31 08:16:13, PP (100%) def remove_len1(d): d2={} for a,b in d.items(): if len(b)>1: d2[a]=b return d2 def to_type2(type1): d={} for i in type1: i=i.split(':') if i[0] not in d: d[i[0]]=[i[1]] else: d[i[0]].append(i[1]) if i[1] not in d: d[i[1]]=[i[0]] else: d[i[1]].append(i[0]) return d exec(input().strip()) # DON'T remove this line |
# 0097, 2022-03-31 08:03:54, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for e in d: if d[e] >= 2: dd += e return dd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 None exec(input().strip()) # DON'T remove this line | # 0098, 2022-03-31 08:05:26, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for e in d: if len(d[e]) >= 2: dd[e] = d[e] return dd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 None exec(input().strip()) # DON'T remove this line | # 0099, 2022-03-31 08:10:01, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for e in d: if len(d[e]) >= 2: dd[e] = d[e] return dd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dd = {} for e in type1: a,b = e.split(':') dd[a]=[] dd[b]=[] for e in type1: a,b = e.split(':') dd[a].append(b) dd[b].append(a) return dd exec(input().strip()) # DON'T remove this line |
# 0100, 2022-03-31 08:04:19, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0101, 2022-03-31 08:09:11, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for i in d: if len(d[i])!=1: r[i]=d[i] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} for n in type1: n=n.split(":") if n[0] not in x: x[n[0]]=[] x[n[0]].append(x[1]) return x exec(input().strip()) # DON'T remove this line | # 0102, 2022-03-31 08:14:07, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for i in d: if len(d[i])!=1: r[i]=d[i] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} for n in type1: a,b=n.split(":") if a in x: x[a].append(b) else: x[a]=[b] if b in x: x[b].append(a) else: x[b]=[a] return x exec(input().strip()) # DON'T remove this line |
# 0103, 2022-03-31 08:14:01, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out={} for i in d: if len(d[i])>1: out[i]=d[i] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 t2={} for i in type1: x,y = i.split(':') if x in t2: t2[x]=t2[x].append(y) else : t2[x]=[y] for i in type1: x,y = i[::-1].split(':') if x in t2: t2[x]=t2[x]+[y] else : t2[x]=[y] return t2 exec(input().strip()) # DON'T remove this line | # 0104, 2022-03-31 08:15:01, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out={} for i in d: if len(d[i])>1: out[i]=d[i] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 t2={} for i in type1: x,y = i.split(':') if x in t2: t2[x]=t2[x].append(y) else : t2[x]=[y] for i in type1: y,x = i.split(':') if x in t2: t2[x]=t2[x]+[y] else : t2[x]=[y] return t2 exec(input().strip()) # DON'T remove this line | # 0105, 2022-03-31 08:16:00, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out={} for i in d: if len(d[i])>1: out[i]=d[i] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 t2={} for i in type1: x,y = i.split(':') if x in t2: t2[x]=t2[x]+[y] else : t2[x]=[y] for i in type1: y,x = i.split(':') if x in t2: t2[x]=t2[x]+[y] else : t2[x]=[y] return t2 exec(input().strip()) # DON'T remove this line |
# 0106, 2022-03-31 08:15:52, PP (100%) def remove_len1(d): out={} for e in d: if len(d[e])!=1: out[e]=d[e] return out def to_type2(type1): out={} for e in type1: e = e.split(":") if e[1] in out: out[e[1]].append(e[0]) else: out[e[1]]=[e[0]] if e[0] in out: out[e[0]].append(e[1]) else: out[e[0]]=[e[1]] return out exec(input().strip()) | # 0107, 2022-03-31 08:16:28, Px (50%) def remove_len1(d): out={} for e in d: if len(d[e])!=1: out[e]=d[e] return out def to_type2(type1): out={} for e in type1: e = e.split(":") if e[1] in out: out[e[1]].append(e[0]) else: out[e[1]]=[e[0]] if e[0] in out: out[e[0]].append(e[1]) else: out[e[0]]=[e[1]] out.sort return out exec(input().strip()) | # 0108, 2022-03-31 08:16:44, Px (50%) def remove_len1(d): out={} for e in d: if len(d[e])!=1: out[e]=d[e] return out def to_type2(type1): out={} for e in type1: e = e.split(":") if e[1] in out: out[e[1]].append(e[0]) else: out[e[1]]=[e[0]] if e[0] in out: out[e[0]].append(e[1]) else: out[e[0]]=[e[1]] out.sorted return out exec(input().strip()) |
# 0109, 2022-03-31 08:07:43, Px (50%) def remove_len1(d): cop=d.copy() # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in cop: if len(cop[i])==1: del d[i] else: pass return d def to_type2(type1): out=dict() # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for key,value in type1.items(): if key not in out: out[key]=[value] else: out[key].append(value) if value not in out: out[value]=[key] else: out[key].append(key) return out exec(input().strip()) | # 0110, 2022-03-31 08:10:09, P- (50%) def remove_len1(d): cop=d.copy() # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in cop: if len(cop[i])==1: del d[i] else: pass return d def to_type2(type1): out=dict() # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for x in type1: key,value=x.split(':') if key not in out: out[key]=[value] else: out[key].append(value) if value not in out: out[value]=[key] else: out[key].append(key) return out exec(input().strip()) | # 0111, 2022-03-31 08:10:55, PP (100%) def remove_len1(d): cop=d.copy() # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in cop: if len(cop[i])==1: del d[i] else: pass return d def to_type2(type1): out=dict() # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for x in type1: key,value=x.split(':') if key not in out: out[key]=[value] else: out[key].append(value) if value not in out: out[value]=[key] else: out[value].append(key) return out exec(input().strip()) |
# 0112, 2022-03-31 08:07:47, compilation error (0%) def remove_len1(d): c={} for i in d: if len(d[i]) != 1 : c[i]=d[i] return c # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']}} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0113, 2022-03-31 08:08:03, Px (50%) def remove_len1(d): c={} for i in d: if len(d[i]) != 1 : c[i]=d[i] return c # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']}} exec(input().strip()) # DON'T remove this line | # 0114, 2022-03-31 08:15:06, PP (100%) def remove_len1(d): c={} for i in d: if len(d[i]) != 1 : c[i]=d[i] return c # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']}} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 re = dict() for i in type1: x,y = i.split(':') if x in re: re[x].append(y) else: re[x] = [y] if y in re: re[y].append(x) else: re[y] = [x] return re exec(input().strip()) # DON'T remove this line |
# 0115, 2022-03-31 08:11:15, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new_d = {} for key in d : if len(d[key]) > 1 : new_d[key] = d[key] return new_d def to_type2(type1): type2 = {} for keyval in type1 : key,val = keyval.split(":") if key in type2 : type2[key] += [val] else : type2[key] = [val] if val not in type2 : type2[val] = [key] elif val in type2 : type2[val] += [key] return type2 | # 0116, 2022-03-31 08:11:37, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new_d = {} for key in d : if len(d[key]) > 1 : new_d[key] = d[key] return new_d def to_type2(type1): type2 = {} for keyval in type1 : key,val = keyval.split(":") if key in type2 : type2[key] += [val] else : type2[key] = [val] if val not in type2 : type2[val] = [key] elif val in type2 : type2[val] += [key] return type2 exec(input().strip()) # DON'T remove this line | # 0117, 2022-03-31 08:13:33, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new_d = {} for key in d : if len(d[key]) > 1 : new_d[key] = d[key] return new_d def to_type2(type1): type2 = {} for key_val in type1 : key,val = key_val.split(":") if key in type2 : type2[key] += [val] elif key not in type2 : type2[key] = [val] if val in type2 : type2[val] += [key] elif val not in type2 : type2[val] = [key] return type2 exec(input().strip()) # DON'T remove this line |
# 0118, 2022-03-31 08:09:39, Px (50%) def remove_len1(d): D = {} for k in d : if len(d[k]) != 1 : D[k] = d[k] return D def to_type2(type1): type2 = {} for k in type1 : x = type1[k] if k in type2 : type2[k].append(x) elif x in type2 : type2[x].append(k) else : type2[k] = list(x) return type2 exec(input().strip()) | # 0119, 2022-03-31 08:12:38, PP (100%) def remove_len1(d): D = {} for k in d : if len(d[k]) != 1 : D[k] = d[k] return D def to_type2(type1): type2 = {} for y in type1 : k,x = y.split(':') if k in type2 : type2[k].append(x) else : type2[k] = list(x) if x in type2 : type2[x].append(k) else : type2[x] = list(k) return type2 exec(input().strip()) |
# 0120, 2022-03-31 08:14:59, Px (50%) def remove_len1(d): c = {} for i in d: if len(d[i]) != 1: c[i] = d[i] return c def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} a = [] for i in type1: s = i.split(':') d[s[0]] = [] d[s[1]] = [] for j in type1: f = j.split(":") d[f[0]].append(f[1]) d[f[1]].append(f[0]) exec(input().strip()) # DON'T remove this line | # 0121, 2022-03-31 08:15:38, PP (100%) def remove_len1(d): c = {} for i in d: if len(d[i]) != 1: c[i] = d[i] return c def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} a = [] for i in type1: s = i.split(':') d[s[0]] = [] d[s[1]] = [] for j in type1: f = j.split(":") d[f[0]].append(f[1]) d[f[1]].append(f[0]) return d exec(input().strip()) # DON'T remove this line |
# 0122, 2022-03-31 08:14:04, Px (50%) def remove_len1(d): o = {} for i in d: if len(d[i]) != 1: o[i] = d[i] return o # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): x = {} for i in type1: a1 = i.split(':')[0] a2 = i.split(':')[1] if a1 not in x: x[a1] = [a2] elif a1 in x: x[a1] = x[a1].append(a2) if a2 not in x: x[a2] = [a1] elif a1 in x: x[a2] = x[a2].append(a1) return x exec(input().strip()) | # 0123, 2022-03-31 08:16:20, PP (100%) def remove_len1(d): o = {} for i in d: if len(d[i]) != 1: o[i] = d[i] return o # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): x = {} for i in type1: a1 = i.split(':')[0] a2 = i.split(':')[1] if a1 not in x: x[a1] = [a2] elif a1 in x: x[a1].append(a2) if a2 not in x: x[a2] = [a1] elif a1 in x: x[a2].append(a1) return x exec(input().strip()) |
# 0124, 2022-03-31 08:06:20, Px (50%) def remove_len1(d): a = {} for key in d: if len(d[key]) != 1: a[key] = d[key] return a def to_type2(type1): a = {} for key in type1: if key not in a: a[key] = [type1[key]] else: a[key].append(type1[key]) if type1[key] not in a: a[type1[key]] = [key] else: a[type1[key]].append(key) exec(input().strip()) | # 0125, 2022-03-31 08:09:12, PP (100%) def remove_len1(d): a = {} for key in d: if len(d[key]) != 1: a[key] = d[key] return a def to_type2(type1): a = {} for e in type1: e = e.split(':') if e[0] not in a: a[e[0]] = [e[1]] else: a[e[0]].append(e[1]) if e[1] not in a: a[e[1]] = [e[0]] else: a[e[1]].append(e[0]) return a exec(input().strip()) |
# 0126, 2022-03-31 08:08:40, P- (50%) def remove_len1(d): keep = {} for e in d : if len(d[e]) > 1 : keep[e] = d[e] return keep # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): keep = {} for e in type1 : first , second = e.split(":") if first not in keep : keep[first] = [second] if second not in keep : keep[second] = [first] else : keep[second].append(first) return keep # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0127, 2022-03-31 08:14:47, PP (100%) def remove_len1(d): keep = {} for e in d : if len(d[e]) > 1 : keep[e] = d[e] return keep # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): keep = {} for e in type1 : first , second = e.split(":") if first not in keep : keep[first] = [second] if second not in keep : keep[second] = [first] if first in keep and second not in keep[first]: keep[first].append(second) if second in keep and first not in keep[second] : keep[second].append(first) #else : # keep[first].append(second) # keep[second].append(first) return keep # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0128, 2022-03-31 08:13:31, Px (50%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1: a[i] = d[i] return a exec(input().strip()) | # 0129, 2022-03-31 08:16:55, PP (100%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1: a[i] = d[i] return a def to_type2(type1): x = {} for i in type1: a,b = i.split(':') if a not in x: x[a] = list(b) else: x[a].append(b) if b not in x: x[b] = list(a) else: x[b].append(a) return x exec(input().strip()) |
# 0130, 2022-03-31 08:11:11, PP (100%) def remove_len1(d): re = {} for k in d: if len(d[k])>1: re[k] = d[k] return re def to_type2(type1): d = {} l = [] l2 = [] for e in type1: l = e.split(':') if l[0] not in d: d[l[0]] = [l[1]] else: d[l[0]].append(l[1]) l2.append([l[1],l[0]]) for e in l2: if e[0] not in d: d[e[0]] = [e[1]] else: d[e[0]].append(e[1]) return d exec(input().strip()) | # 0131, 2022-03-31 08:13:46, PP (100%) def remove_len1(d): re = {} for k in d: if len(d[k])>1: re[k] = d[k] return re def to_type2(type1): d = {} l = [] l2 = [] for e in type1: l = e.split(':') if l[0] not in d: d[l[0]] = [l[1]] else: d[l[0]].append(l[1]) if l[1] not in d: d[l[1]] = [l[0]] else: d[l[1]].append(l[0]) return d exec(input().strip()) |
# 0132, 2022-03-31 08:14:57, P- (50%) def remove_len1(d): newd = {} # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for key in d: if len(d[key])>1: newd[key] = d[key] return newd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for i in type1: key,value = i.split(":") if key not in type2: type2[key] = [value] if value not in type2: type2[value] = [key] else: type2[value].append(key) return type2 exec(input().strip()) # DON'T remove this line | # 0133, 2022-03-31 08:16:28, PP (100%) def remove_len1(d): newd = {} # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for key in d: if len(d[key])>1: newd[key] = d[key] return newd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for i in type1: key,value = i.split(":") if key not in type2: type2[key] = [value] else: type2[key].append(value) if value not in type2: type2[value] = [key] else: type2[value].append(key) return type2 exec(input().strip()) # DON'T remove this line |
# 0134, 2022-03-31 08:12:13, P- (50%) def remove_len1(d) : ans = {} for key in d : if len(d[key]) > 1 : ans[key] = d[key] return ans def to_type2(type1): ans = {} for s in type1 : x, y = s.split(':') if x not in ans : ans[x] = [y] else : ans[x]+= [y] if y not in ans : ans[y] = [x] else : ans[y] += [x] print(ans) return ans exec(input().strip()) | # 0135, 2022-03-31 08:13:56, PP (100%) def remove_len1(d) : ans = {} for key in d : if len(d[key]) > 1 : ans[key] = d[key] return ans def to_type2(type1): ans = {} for s in type1 : x, y = s.split(':') if x not in ans : ans[x] = [y] else : ans[x]+= [y] if y not in ans : ans[y] = [x] else : ans[y] += [x] return ans exec(input().strip()) |
# 0136, 2022-03-31 08:10:57, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t={} for key in d: if len(d[key])!= 1: t[key]=d[key] return t def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for e in type1: x,y=e.split(':') if x in d: d[x]+=[y] else: d[x]=[y] if y in d: d[y]+=[y] else: d[y]=[x] return d exec(input().strip()) | # 0137, 2022-03-31 08:13:12, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t={} for key in d: if len(d[key])!= 1: t[key]=d[key] return t def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for e in type1: x,y=e.split(':') if x in d: d[x]+=[y] else: d[x]=[y] if y in d: d[y]+=[x] else: d[y]=[x] return d exec(input().strip()) |
# 0138, 2022-03-31 08:08:47, P- (50%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1 : a[i] = d[i] return(a) def to_type2(type1): a = {} for i in type1: i = i[1:-1].split(':') if i[0] in a : a[i[0]] += [i[1]] else: a[i[0]] = [i[1]] return(a) exec(input().strip()) # DON'T remove this line | # 0139, 2022-03-31 08:13:02, PP (100%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1 : a[i] = d[i] return(a) def to_type2(type1): a = {} for i in type1: i = i.split(':') if i[0] in a : a[i[0]] += [i[1]] else: a[i[0]] = [i[1]] if i[1] in a: a[i[1]] += [i[0]] else: a[i[1]] = [i[0]] return(a) exec(input().strip()) # DON'T remove this line |
# 0140, 2022-03-31 08:13:25, P- (50%) def remove_len1(d): k ={} for e in d: if len(d[e]) != 1: k[e] = d[e] return k def to_type2(type1): k = {} for e in type1: e = e.split(':') for i in range (1,len(e)): if e[0] not in k: k[e[0]] = [e[i]] elif e[0] in k: k[e[0]] += [e[i]] return k exec(input().strip()) | # 0141, 2022-03-31 08:15:47, PP (100%) def remove_len1(d): k ={} for e in d: if len(d[e]) != 1: k[e] = d[e] return k def to_type2(type1): k = {} for e in type1: e = e.split(':') if e[0] not in k: k[e[0]] = [e[1]] elif e[0] in k: k[e[0]] += [e[1]] if e[1] not in k: k[e[1]] = [e[0]] elif e[1] in k: k[e[1]] += [e[0]] return k exec(input().strip()) |
# 0142, 2022-03-31 08:03:20, Px (50%) def remove_len1(d): ans = {} for k in d: if len(d[k]) != 1 : ans[k] = d[k] return ans def to_type2(type1): pass exec(input().strip()) | # 0143, 2022-03-31 08:12:25, PP (100%) def remove_len1(d): ans = {} for k in d: if len(d[k]) != 1 : ans[k] = d[k] return ans def to_type2(type1): ans = {} x = [] for k in type1: y = k.split(':') x.append(y) for st in x: if st[0] not in ans: ans[st[0]] = [st[1]] else : ans[st[0]].append(st[1]) if st[1] not in ans: ans[st[1]] = [st[0]] else : ans[st[1]].append(st[0]) return ans exec(input().strip()) |
# 0144, 2022-03-31 08:14:51, PP (100%) def remove_len1(d): y={} for e in d: if len(d[e])>1: y[e]= d[e] return y # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): res = {} for v in type1: key, v = v.split(':') res[key] = res.get(key, []) + [v] res[v] = res.get(v, []) + [key] return res # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0145, 2022-03-31 08:15:01, PP (100%) def remove_len1(d): y={} for e in d: if len(d[e])>1: y[e]= d[e] return y # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): res = {} for v in type1: key, v = v.split(':') res[key] = res.get(key, []) + [v] res[v] = res.get(v, []) + [key] return res # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0146, 2022-03-31 08:14:20, P- (50%) def remove_len1(d): x = {} for i in d : if len(d[i]) != 1 : x[i] = d[i] return x def to_type2(type1): w = {} for e in type1: x, y = e.split(':') print(x,y) if x in w : w[x] += [y] else: w[x] = [y] if y in w : w[y] += [x] else: w[y] = [x] return w exec(input().strip()) | # 0147, 2022-03-31 08:15:02, PP (100%) def remove_len1(d): x = {} for i in d : if len(d[i]) != 1 : x[i] = d[i] return x def to_type2(type1): w = {} for e in type1: x, y = e.split(':') if x in w : w[x] += [y] else: w[x] = [y] if y in w : w[y] += [x] else: w[y] = [x] return w exec(input().strip()) |
# 0148, 2022-03-31 08:13:29, P- (50%) def remove_len1(d): result=dict() for i in d: if len(d[i])!=1: result[i]=d[i] return result def to_type2(type1): dict1=dict() for i in type1: a,b=i.split(':') if dict1.get(a)==None: dict1[a]=[b] elif dict1.get(b)==None: dict1[b]=[a] elif dict1.get(a)!=None: dict1[a]+=[b] elif dict1.get(b)!=None: dict1[b]+=[a] return dict1 exec(input().strip()) | # 0149, 2022-03-31 08:15:03, PP (100%) def remove_len1(d): result=dict() for i in d: if len(d[i])!=1: result[i]=d[i] return result def to_type2(type1): dict1=dict() for i in type1: a,b=i.split(':') if dict1.get(a)==None: dict1[a]=[b] elif dict1.get(a)!=None: dict1[a]+=[b] if dict1.get(b)==None: dict1[b]=[a] elif dict1.get(b)!=None: dict1[b]+=[a] return dict1 exec(input().strip()) |
# 0150, 2022-03-31 08:12:46, Px (50%) def remove_len1(d): ans = {} for e in d: if len(d[e]) != 1: ans[e] = d[e] return ans exec(input().strip()) | # 0151, 2022-03-31 08:16:29, PP (100%) def remove_len1(d): ans = {} for e in d: if len(d[e]) != 1: ans[e] = d[e] return ans def to_type2(type1): ans = {} for e in type1: a,b = e.split(':') if a not in ans: ans[a] = [b] else: ans[a].append(b) if b not in ans: ans[b] = [a] else: ans[b].append(a) return ans exec(input().strip()) |
# 0152, 2022-03-31 08:15:46, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} remlen={} for ch in d: if len(d[ch])>1: remlen[ch]=d[ch] return remlen def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for key in type1: a,b=type1.split(":") if a not in ans: ans[a]=[b] else: ans[a].append(b) if b not in ans: ans[b]=[a] else: ans[b].append(a) return ans exec(input().strip()) # DON'T remove this line | # 0153, 2022-03-31 08:16:10, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} remlen={} for ch in d: if len(d[ch])>1: remlen[ch]=d[ch] return remlen def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for key in type1: a,b=key.split(":") if a not in ans: ans[a]=[b] else: ans[a].append(b) if b not in ans: ans[b]=[a] else: ans[b].append(a) return ans exec(input().strip()) # DON'T remove this line |
# 0154, 2022-03-31 08:07:04, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} g ={} for k,v in d.items(): if len(v) > 1: g[k] = v return g def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0155, 2022-03-31 08:14:00, PP (100%) def remove_len1(d): s = dict(d) for i in s: if len(s[i]) == 1: d.pop(i) return d def to_type2(type1): d = {} for i in type1: key,value = i.split(":") if key not in d: d[key] = [] d[key].append(value) else: d[key].append(value) if value not in d: d[value] = [] d[value].append(key) else: d[value].append(key) return d exec(input().strip()) |
# 0156, 2022-03-31 08:15:42, -- (0%) def remove_len1(d): o = {} for k,v in d.items(): if len(v) > 1: o[k] = v return o | # 0157, 2022-03-31 08:15:55, PP (100%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1 : a[i] = d[i] return(a) def to_type2(type1): a = {} for i in type1: i = i.split(':') if i[0] in a : a[i[0]] += [i[1]] else: a[i[0]] = [i[1]] if i[1] in a: a[i[1]] += [i[0]] else: a[i[1]] = [i[0]] return(a) exec(input().strip()) # DON'T remove this line |
# 0158, 2022-03-31 08:14:17, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} q = {} for e in d: if len(d[e]) != 1: q[e] = d[e] return (q) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 p = [] q = {} for e in range (len(type1)): p.append(type1[e].split(':')) for e in p: if e[0] not in q: q.update({e[0]:[e[1]]}) else: q.update({e[0]:q[e[0]]+[e[1]]}) if e[1] not in q: q.update({e[1]:[e[0]]}) else: q.update({e[1]:q[e[1]]+[e[0]]}) return q | # 0159, 2022-03-31 08:15:50, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} q = {} for e in d: if len(d[e]) != 1: q[e] = d[e] return (q) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 p = [] q = {} for e in range (len(type1)): p.append(type1[e].split(':')) for e in p: if e[0] not in q: q.update({e[0]:[e[1]]}) else: q.update({e[0]:q[e[0]]+[e[1]]}) if e[1] not in q: q.update({e[1]:[e[0]]}) else: q.update({e[1]:q[e[1]]+[e[0]]}) return q exec(input().strip()) |
# 0160, 2022-03-31 08:07:21, P- (50%) def remove_len1(d): x = {} for key in d: if len(d[key]) > 1: x[key] = d[key] return x def to_type2(type1): x = {} for s in type1: for e in s.split(':'): x[e] = [] for s in type1: l = s.split(':') for e in l: if e in x: for p in l: if p not in x: x[e] += [p] return x exec(input().strip()) # DON'T remove this line | # 0161, 2022-03-31 08:09:46, PP (100%) def remove_len1(d): x = {} for key in d: if len(d[key]) > 1: x[key] = d[key] return x def to_type2(type1): x = {} key = [] for s in type1: for e in s.split(':'): x[e] = [] key.append(e) for s in type1: l = s.split(':') for e in l: if e in key: for p in l: if p != e: x[e] += [p] return x exec(input().strip()) # DON'T remove this line |
# 0162, 2022-03-31 08:15:51, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for e in d: if len(d[e]) != 1: s[e] = d[e] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 s = {} for e in type1: s1,s2 = e.split(':') if s1 in s: s[s1] += [s2] else: s[s1] = [s2] if s2 in s: s[s2] += [s1] else: s[s2] = [s1] return s exec(input().strip()) # DON'T remove this line | # 0163, 2022-03-31 08:15:55, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for e in d: if len(d[e]) != 1: s[e] = d[e] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 s = {} for e in type1: s1,s2 = e.split(':') if s1 in s: s[s1] += [s2] else: s[s1] = [s2] if s2 in s: s[s2] += [s1] else: s[s2] = [s1] return s exec(input().strip()) # DON'T remove this line |
# 0164, 2022-03-31 08:07:13, Px (50%) def remove_len1(d): s = {} for key in d : if len(d[key]) != 1 : s[key] = d[key] return s def to_type2(type1): s = {} for c in type1 : P1,P2 = c.split(':') if P1 in s : s[P1].append(P2) else : s[P1] = [P2] if P2 in s : s[P2].append(P1) else : s[P2] = [P1] exec(input().strip()) | # 0165, 2022-03-31 08:08:21, PP (100%) def remove_len1(d): s = {} for key in d : if len(d[key]) != 1 : s[key] = d[key] return s def to_type2(type1): s = {} for c in type1 : P1,P2 = c.split(':') if P1 in s : s[P1].append(P2) else : s[P1] = [P2] if P2 in s : s[P2].append(P1) else : s[P2] = [P1] return s exec(input().strip()) |
# 0166, 2022-03-31 08:13:20, Px (50%) def remove_len1(d): new = {} for i in d: if len(d[i]) > 1: new[i] = d[i] return new exec(input().strip()) # DON'T remove this line | # 0167, 2022-03-31 08:16:33, PP (100%) def remove_len1(d): new = {} for i in d: if len(d[i]) > 1: new[i] = d[i] return new def to_type2(type1): d = {} a = [] for i in type1: s = i.split(':') d[s[0]] = [] d[s[1]] = [] for j in type1: f = j.split(":") d[f[0]].append(f[1]) d[f[1]].append(f[0]) return d exec(input().strip()) # DON'T remove this line |
# 0168, 2022-03-31 08:14:35, Px (50%) def remove_len1(d): a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): a = {} for i in type1: b1,b2 = i.strip().split(":") if b1 in a: a[b1].append(b2) else: a[b1] = b2 if b2 in a: a[b2].append(b1) else: a[b2] = b1 return a # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) | # 0169, 2022-03-31 08:15:53, PP (100%) def remove_len1(d): a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): a = {} for i in type1: b1,b2 = i.strip().split(":") if b1 in a: a[b1].append(b2) else: a[b1] = b2 if b2 in a: a[b2].append(b1) else: a[b2] = [b1] return a # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) |
# 0170, 2022-03-31 08:15:02, -P (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for k in d: if len(d[k]) > 1: a[k] = k return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = {} a = [] for k in type1: k = k.split(':') a.append(k) for e in a: if e[0] not in x: x[e[0]] = [e[1]] elif e[0] in x: x[e[0]].append(e[1]) if e[1] not in x: x[e[1]] = [e[0]] elif e[1] in x: x[e[1]].append(e[0]) return x exec(input().strip()) # DON'T remove this line | # 0171, 2022-03-31 08:15:59, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for k in d: if len(d[k]) > 1: a[k] = d[k] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = {} a = [] for k in type1: k = k.split(':') a.append(k) for e in a: if e[0] not in x: x[e[0]] = [e[1]] elif e[0] in x: x[e[0]].append(e[1]) if e[1] not in x: x[e[1]] = [e[0]] elif e[1] in x: x[e[1]].append(e[0]) return x exec(input().strip()) # DON'T remove this line |
# 0172, 2022-03-31 08:09:29, P- (50%) def remove_len1(d): dd={} for e in d: if len(d[e])>1: dd[e]=d[e] return dd def to_type2(type1): d={} for e in type1: e=e.split(':') if e[0] not in d: d[e[0]]=[e[1]] if e[1] not in d: d[e[1]]=[e[0]] if e[1] in d: d[e[0]].append(e[1]) if e[0] in d: d[e[1]].append(e[0]) return d exec(input().strip()) | # 0173, 2022-03-31 08:11:43, PP (100%) def remove_len1(d): dd={} for e in d: if len(d[e])>1: dd[e]=d[e] return dd def to_type2(type1): d={} for e in type1: e=e.split(':') if e[0] not in d: d[e[0]]=[e[1]] elif e[0] in d: d[e[0]].append(e[1]) if e[1] not in d: d[e[1]]=[e[0]] elif e[1] in d: d[e[1]].append(e[0]) return d exec(input().strip()) |
# 0174, 2022-03-31 08:13:58, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for i in d: if len(d[i]) != 1: out[i] = d[i] return out exec(input().strip()) # DON'T remove this line | # 0175, 2022-03-31 08:16:11, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for i in d: if len(d[i]) != 1: out[i] = d[i] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out = {} for i in type1: e = i.split(':') if e[0] in out: out[e[0]].append(e[1]) elif e[0] not in out: out[e[0]] = [e[1]] if e[1] in out: out[e[1]].append(e[0]) elif e[1] not in out: out[e[1]] = [e[0]] return out exec(input().strip()) # DON'T remove this line |
# 0176, 2022-03-31 08:12:51, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s=dict() for i in d : if len(d[i]) > 1 : s[i]=d[i] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 s=dict() for i in type1: a,b = i.split(':') if a in s: s[a].append(b) else: s[a] = [b] if b in s: s[b].append(a) else: s[b] = [a] exec(input().strip()) # DON'T remove this line | # 0177, 2022-03-31 08:13:14, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s=dict() for i in d : if len(d[i]) > 1 : s[i]=d[i] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 s=dict() for i in type1: a,b = i.split(':') if a in s: s[a].append(b) else: s[a] = [b] if b in s: s[b].append(a) else: s[b] = [a] return s exec(input().strip()) # DON'T remove this line |
# 0178, 2022-03-31 08:10:27, PP (100%) def remove_len1(d): new_d = {} for k, v in d.items(): if len(v) > 1: new_d[k] = v return new_d def to_type2(type1): d = {} for item in type1: k, v = item.split(':') if k not in d: d[k] = [v] else: d[k].append(v) if v not in d: d[v] = [k] else: d[v].append(k) return d exec(input().strip()) | # 0179, 2022-03-31 08:15:44, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new_d = {} for k, v in d.items(): if len(v) > 1: new_d[k] = v return new_d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for item in type1: k, v = item.split(':') if k not in d: d[k] = [v] else: d[k].append(v) if v not in d: d[v] = [k] else: d[v].append(k) return d exec(input().strip()) # DON'T remove this line |
# 0180, 2022-03-31 08:13:54, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} output = {} for i in d: if len(d[i]) > 1: output[i] = d[i] return output def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 lst1 = [] lst2 = [] for i in type1: a, b = i.split(':') lst1.append([a, b]) if a not in lst2: lst2.append(a) if b not in lst2: lst2.append(a) d = {} for i in lst2: d[i] = [] for j in lst1: if i in j: for k in j: if k != i: d[i].append(k) return d exec(input().strip()) # DON'T remove this line | # 0181, 2022-03-31 08:14:44, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} output = {} for i in d: if len(d[i]) > 1: output[i] = d[i] return output def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 lst1 = [] lst2 = [] for i in type1: a, b = i.split(':') lst1.append([a, b]) if a not in lst2: lst2.append(a) if b not in lst2: lst2.append(b) d = {} for i in lst2: d[i] = [] for j in lst1: if i in j: for k in j: if k != i: d[i].append(k) return d exec(input().strip()) # DON'T remove this line |
# 0182, 2022-03-31 08:14:27, PP (100%) def remove_len1(d): res={} for ch in d: if len(d[ch])>1: res[ch]=d[ch] return res def to_type2(type1): type2={} for i in range (len(type1)): one,two=type1[i].split(":") if one in type2: type2[one].append(two) else: type2[one]=[two] if two in type2: type2[two].append(one) else: type2[two]=[one] return type2 exec(input().strip()) # DON'T remove this line | # 0183, 2022-03-31 08:15:59, PP (100%) def remove_len1(d): re={} for ch in d: if len(d[ch])>1: re[ch]=d[ch] return re def to_type2(type1): type2={} for i in range (len(type1)): one,two=type1[i].split(":") if one in type2: type2[one].append(two) else: type2[one]=[two] if two in type2: type2[two].append(one) else: type2[two]=[one] return type2 exec(input().strip()) # DON'T remove this line |
# 0184, 2022-03-31 08:13:36, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r ={} for k in d : if len(d[k]) != 1 : r[k] = d[k] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d ={} for i in range(len(type1)) : if type1[i][0] not in d : d[type1[i][0]] = [type1[i][2]] else : d[type1[i][0]] += [type1[i][2]] for i in range(len(type1)) : if type1[i][2] not in d : d[type1[i][2]] = [type1[i][0]] else : d[type1[i][2]] += [type1[i][0]] return d exec(input().strip()) # DON'T remove this line | # 0185, 2022-03-31 08:15:53, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r ={} for k in d : if len(d[k]) != 1 : r[k] = d[k] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d ={} for i in range(len(type1)) : s,f = type1[i].split(':') if s not in d : d[s] = [f] else : d[s] += [f] for i in range(len(type1)) : s,f = type1[i].split(':') if f not in d : d[f] = [s] else : d[f] += [s] return d exec(input().strip()) # DON'T remove this line |
# 0186, 2022-03-31 08:09:31, Px (50%) def remove_len1(d): ans = {} for i in d: if len(d[i])>1: ans[i] = d[i] return ans exec(input().strip()) | # 0187, 2022-03-31 08:14:27, PP (100%) def remove_len1(d): ans = {} for i in d: if len(d[i])>1: ans[i] = d[i] return ans def to_type2(type1): ans = {} for i in type1: a,b = i.split(':') if a not in ans: ans[a] =[b] if b not in ans: ans[b] =[a] if a in ans: if ans[a] != [b]: ans[a].append(b) if b in ans: if ans[b] != [a]: ans[b].append(a) return ans exec(input().strip()) |
# 0188, 2022-03-31 08:14:26, -- (0%) def remove_len1(d): a ={} for key in d : if len(d[key]) != 1 : a[key] = d[key] return a def to_type2(type1): u = [] for i in type1 : i = i.split(':') u.append([i[0],i[1]]) u.append([i[1],i[0]]) s = {} for i in u : x = i[0] y = i[1] if x in s : s[x].append(y) else : s[x] = [y] return s | # 0189, 2022-03-31 08:14:58, PP (100%) def remove_len1(d): a ={} for key in d : if len(d[key]) != 1 : a[key] = d[key] return a def to_type2(type1): u = [] for i in type1 : i = i.split(':') u.append([i[0],i[1]]) u.append([i[1],i[0]]) s = {} for i in u : x = i[0] y = i[1] if x in s : s[x].append(y) else : s[x] = [y] return s exec(input().strip()) |
# 0190, 2022-03-31 08:11:41, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d2 = {} for e in d: if len(d[e]) > 1: d2[e] = d[e] return d2 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d2 = {} for e in type1: e1,e2 = e.split(':') if e1 in d2: d2[e1].append(e2) elif e1 not in d2: d2[e1] = [e2] if e2 in d2: d2[e1].append(e2) elif e2 not in d2: d2[e1] = [e2] return d2 exec(input().strip()) | # 0191, 2022-03-31 08:13:00, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d2 = {} for e in d: if len(d[e]) > 1: d2[e] = d[e] return d2 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d2 = {} for e in type1: e1,e2 = e.split(':') if e1 in d2: d2[e1].append(e2) elif e1 not in d2: d2[e1] = [e2] if e2 in d2: d2[e2].append(e1) elif e2 not in d2: d2[e2] = [e1] return d2 exec(input().strip()) |
# 0192, 2022-03-31 08:07:21, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d.keys() if len(d[i]) != 1: ans.update({i:d[i]}) return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for con in type1: a1,a2 = con.split(":") old1 = ans.get(a1,[]) old2 = ans.get(a2,[]) old1.append(a2) old2.append(a1) ans[a1] = old1 ans[a2] = old2 return ans exec(input().strip()) # DON'T remove this line | # 0193, 2022-03-31 08:07:49, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d.keys(): if len(d[i]) != 1: ans.update({i:d[i]}) return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for con in type1: a1,a2 = con.split(":") old1 = ans.get(a1,[]) old2 = ans.get(a2,[]) old1.append(a2) old2.append(a1) ans[a1] = old1 ans[a2] = old2 return ans exec(input().strip()) # DON'T remove this line |
# 0194, 2022-03-31 08:09:10, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} di = {} dd = [] for i in d : dd.append(d[i]) if len(d[i]) > 1 : for e in dd : if len(e) > 1 : di[i] = e return di def to_type2(type1): pass # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0195, 2022-03-31 08:15:22, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} di = {} dd = [] for i in d : dd.append(d[i]) if len(d[i]) > 1 : for e in dd : if len(e) > 1 : di[i] = e return di def to_type2(type1): type2 = {} for key_val in type1 : key,val = key_val.split(":") if key in type2 : type2[key] += [val] elif key not in type2 : type2[key] = [val] if val in type2 : type2[val] += [key] elif val not in type2 : type2[val] = [key] return type2 # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0196, 2022-03-31 08:03:27, Px (50%) def remove_len1(d): new_d = {} for e in d: if len(d[e]) == 1: pass else: new_d[e] = d[e] return new_d exec(input().strip()) | # 0197, 2022-03-31 08:12:52, PP (100%) def remove_len1(d): new_d = {} for e in d: if len(d[e]) == 1: pass else: new_d[e] = d[e] return new_d def to_type2(type1): d ={} for e in type1: a,b = e.split(':') if a not in d: d[a] = [b] else: list_value = d[a] list_value.append(b) d[a] = list_value for e in type1: a,b = e.split(':') if b not in d: d[b] = [a] else: list_value = d[b] list_value.append(a) d[b] = list_value return d exec(input().strip()) |
# 0198, 2022-03-31 08:16:07, PP (100%) def remove_len1(d): fin = {} for ele in d: if len(d[ele]) != 1: fin[ele] = d[ele] return fin def to_type2(type1): d = {} drev = {} for i in type1: temp = i.split(":") if temp[0] in d: d[temp[0]] = d[temp[0]]+[temp[1]] elif temp[0] not in d: d[temp[0]]=[temp[1]] if temp[1] in d: d[temp[1]]=d[temp[1]]+[temp[0]] elif temp[1] not in d: d[temp[1]]=[temp[0]] return d exec(input().strip()) # DON'T remove this line |
# 0199, 2022-03-31 08:14:44, PP (100%) def remove_len1(d): d2 = {} for key in d: if len(d[key]) > 1: d2[key] = d[key] return d2 def to_type2(type1): t2 = {} for e in type1: x = e.split(':') if x[0] not in t2: t2[x[0]] = [x[1]] else: t2[x[0]] += [x[1]] if x[1] not in t2: t2[x[1]] = [x[0]] else: t2[x[1]] += [x[0]] return t2 exec(input().strip()) |
# 0200, 2022-03-31 08:14:21, PP (100%) def remove_len1(d): r = {} for k in d : if len(d[k]) != 1 : r[k] = d[k] return r def to_type2(type1): t = {} t1 = [] for i in range(len(type1)) : x,y = type1[i].split(':') t1.append([x,y]) t1.append([y,x]) for i in range(len(t1)) : if t1[i][0] in t : t[t1[i][0]].append(t1[i][1]) else : t[t1[i][0]] = [t1[i][1]] return t exec(input().strip()) |
# 0201, 2022-03-31 08:04:29, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} return {k: v for k, v in d.items() if len(v) != 1} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 res = {} for e in type1: a, b = e.split(":") if a not in res: res[a] = [] if b not in res: res[b] = [] if b not in res[a]: res[a].append(b) if a not in res[b]: res[b].append(a) return res exec(input().strip()) |
# 0202, 2022-03-31 08:12:02, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d : if len(d[i]) > 1 : a[i] = d[i] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for i in type1 : x,y = i.split(":") if x not in a : a[x] = [] a[x].append(y) else : a[x].append(y) if y not in a : a[y] = [] a[y].append(x) else : a[y].append(x) return a exec(input().strip()) # DON'T remove this line |
# 0203, 2022-03-31 08:08:48, PP (100%) def remove_len1(d) : ans = {} for a in d : if len(d[a]) != 1 : ans[a] = d[a] return ans def to_type2(type1) : ans = {} for a in type1 : x,y = a.split(':') if x in ans : ans[x].append(y) else : ans[x] = [y] if y in ans : ans[y].append(x) else : ans[y] = [x] return ans exec(input().strip()) |
# 0204, 2022-03-31 08:11:41, PP (100%) def remove_len1(d): v = {} for key in d: if len(d[key]) != 1: v[key] = d[key] return v def to_type2(type1): type2 = {} lists = [] for e in type1: a,b = e.split(':') lists.append([b,a]) if a not in type2: type2[a] = [b] elif a in type2: type2[a] += [b] for e in lists: a,b = e if a not in type2: type2[a] = [b] elif a in type2: type2[a] += [b] return type2 exec(input().strip()) # DON'T remove this line |
# 0205, 2022-03-31 08:07:42, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} nd = {} for k in d: if len(d[k]) > 1: nd[k] = d[k] return nd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: f, s = i.split(':') if f not in d: d[f] = [s] else: d[f] += [s] if s not in d: d[s] = [f] else: d[s] += [f] return d exec(input().strip()) # DON'T remove this line |
# 0206, 2022-03-31 08:10:02, PP (100%) def remove_len1(d): a = {} for e in d : if len(d[e]) > 1 : a[e] = d[e] return(a) def to_type2(type1): ans = {} for e in type1 : q,w = e.split(':') if q not in ans : ans[q] = [w] else : ans[q].append(w) if w not in ans : ans[w] = [q] else : ans[w].append(q) return(ans) exec(input().strip()) # DON'T remove this line |
# 0207, 2022-03-31 08:14:16, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} k={} for i in d: if len(d[i]) >1: k[i]=d[i] return k def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: a,b = i.split(':') if a not in d: d[a] = [b] else : d[a].append(b) if b not in d: d[b] = [a] else : d[b].append(a) return d exec(input().strip()) # DON'T remove this line |
# 0208, 2022-03-31 08:11:13, PP (100%) def remove_len1(d): new = {} for i in d: if not len(d[i]) == 1: new[i] = d[i] return new #['A:B', 'B:C', 'E1:C','D:C'] def to_type2(type1): ans = {} type2 = {} for i in type1: if not i[0] in ans: ans[i[0]] = [i[2]] elif i[0] in ans: ans[i[0]].append(i[2]) if not i[2] in ans: ans[i[2]] = [i[0]] elif i[2] in ans: ans[i[2]].append(i[0]) return ans exec(input().strip()) # DON'T remove this line |
# 0209, 2022-03-31 08:07:14, PP (100%) def remove_len1(d): return {k: v for k, v in d.items() if len(v) > 1} def to_type2(type1): alist = [] for e in type1: k, v = e.split(":") alist.append((k, v)) res = {} for k, v in alist: if k not in res: res[k] = [] if v not in res: res[v] = [] if v not in res[k]: res[k].append(v) if v not in res or k not in res[v]: res[v].append(k) return res exec(input().strip()) |
# 0210, 2022-03-31 08:14:45, PP (100%) def remove_len1(d): a = {} for i in d: if(len(d[i])==1): continue a[i] = d[i] return a def to_type2(type1): c = {} for i in type1: a,b = i.split(':') if(a not in c): c[a] = [b] else: c[a].append(b) if(b not in c): c[b] = [a] else: c[b].append(a) return c exec(input().strip()) |
# 0211, 2022-03-31 08:08:16, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} yo = {} for k,v in d.items(): if len(v) > 1: yo[k] = v return yo def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 yolo = {} for a in type1: one,two = a.split(':') if yolo.get(one) == None: yolo[one] = [two] else: yolo[one] += [two] if yolo.get(two) == None: yolo[two] = [one] else: yolo[two] += [one] return yolo exec(input().strip()) # DON'T remove this line |
# 0212, 2022-03-31 08:08:28, PP (100%) def remove_len1(d) : ans = {} for e in d : if len(d[e]) != 1 : ans[e] = d[e] return ans def to_type2(type1) : ans = {} for e in type1 : n1, n2 = e.split(':') if n1 in ans : ans[n1] += [n2] if n2 in ans : ans[n2] += [n1] if n1 not in ans : ans[n1] = [n2] if n2 not in ans : ans[n2] = [n1] return ans exec(input().strip()) |
# 0213, 2022-03-31 08:09:45, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} G={} for i in d: if len(d[i])!=1: G[i]=d[i] return G def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 c={} for i in type1: a,b=i.split(':') if a not in c: c[a]=[b] else: c[a].append(b) if b not in c: c[b]=[a] else: c[b].append(a) return c exec(input().strip()) |
# 0214, 2022-03-31 08:13:27, PP (100%) def remove_len1(d): newDict = {} for i in d : if len(d[i]) > 1 : newDict[i] = d[i] return newDict def to_type2(type1): type2 = {} for k in type1 : s = k.split(':') if s[0] in type2 : type2[s[0]].append(s[1]) else: type2[s[0]] = [s[1]] if s[1] in type2 : type2[s[1]].append(s[0]) else: type2[s[1]] = [s[0]] return type2 exec(input().strip()) # DON'T remove this line |
# 0215, 2022-03-31 08:09:57, PP (100%) def remove_len1(d): result = {} for e in d: if len(d[e]) == 1: pass else: result[e] = d[e] return result def to_type2(type1): result = {} for e in type1: x,y = e.split(':') if x in result: result[x].append(y) else: result[x] = [y] if y in result: result[y].append(x) else: result[y] = [x] return result exec(input().strip()) |
# 0216, 2022-03-31 08:10:32, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = dict() for i in d: if len(d[i]) == 1: pass else: ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = dict() for i in range(len(type1)): a,b = type1[i].split(':') if a not in ans: ans[a] = [b] else: ans[a].append(b) if b not in ans: ans[b] = [a] else: ans[b].append(a) return ans exec(input().strip()) # DON'T remove this line |
# 0217, 2022-03-31 08:11:33, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} show = {} for e in d : if len(d[e]) > 1 : show[e] = d[e] return show # print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 use = [] for e in type1 : e = e.split(':') use.append([e[0],e[1]]) use.append([e[1],e[0]]) show = {} for e in use : x = e[0] y = e[1] if x not in show : show[x] = [y] else : show[x].append(y) return show exec(input().strip()) # DON'T remove this line |
# 0218, 2022-03-31 08:08:36, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} res = {} for key, v in d.items(): if len(v) > 1: res[key] = v return res def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 res = {} for v in type1: key, v = v.split(':') if key not in res: res[key] = [] if v not in res: res[v] = [] res[key].append(v) res[v].append(key) return res exec(input().strip()) # DON'T remove this line |
# 0219, 2022-03-31 08:13:10, PP (100%) def remove_len1(d): ans = {} for key in d : if len(d[key]) == 1 : pass else : ans[key] = d[key] return ans def to_type2(type1): ans = {} for e in type1: x = e.split(':') left = x[0] right = x[1] if left not in ans : ans[left] = [right] else : ans[left].append(right) if right not in ans : ans[right] = [left] else : ans[right].append(left) return ans exec(input().strip()) # DON'T remove this line |
# 0220, 2022-03-31 08:08:57, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} removed = {} for e in d: if len(d[e]) != 1: removed[e] = d[e] return removed def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 result = {} for e in type1: s1,s2 = e.split(':') if s1 in result: result[s1] += [s2] else: result[s1] = [s2] for e in type1: s2,s1 = e.split(':') if s1 in result: result[s1] += [s2] else: result[s1] = [s2] return result exec(input().strip()) # DON'T remove this line |
# 0221, 2022-03-31 08:14:38, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for e in d: if len(d[e])>1: out[e] = d[e] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out = {} for e in type1: text1,text2 = e.split(':') if text1 in out: out[text1] =out[text1]+[text2] else: out[text1] =[text2] for e in type1: text2,text1 =e.split(':') if text1 in out: out[text1] =out[text1]+ [text2] else: out[text1] =[text2] return out exec(input().strip()) # DON'T remove this line |
# 0222, 2022-03-31 08:14:55, PP (100%) def remove_len1(d): ans = { } for k,v in d.items(): if len(v) != 1: ans[k] = v return ans def to_type2(type1): ans = {} for i in type1: k, v = i.split(":") if k not in ans: ans[k] = [] if v not in ans: ans[v] = [] ans[k].append(v) ans[v].append(k) return ans exec(input().strip()) |
# 0223, 2022-03-31 08:14:40, PP (100%) def remove_len1(d): q = {} for k in d: if len(d[k]) >= 2: q[k] = d[k] return q def to_type2(type1): q = {} for c in type1: c1,c2 = c.split(':') if c1 in q: q[c1].append(c2) else: q[c1] = [c2] if c2 in q: q[c2].append(c1) else: q[c2] = [c1] return q exec(input().strip()) |
# 0224, 2022-03-31 08:11:30, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for k,v in d.items(): if len(v) != 1: x[k] = v return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: i1,i2 = i.split(":") if i1 in d.keys(): d[i1].append(i2) else: d[i1] = [i2] if i2 in d.keys(): d[i2].append(i1) else: d[i2] = [i1] return d exec(input().strip()) |
# 0225, 2022-03-31 08:14:07, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for e in d: if len(d[e])>1: ans[e]=d[e] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for i in type1: tmp2,tmp3=i.split(":") if tmp2 not in ans: ans[tmp2]=[tmp3] else: ans[tmp2].append(tmp3) if tmp3 not in ans: ans[tmp3]=[tmp2] else: ans[tmp3].append(tmp2) return ans exec(input().strip()) |
# 0226, 2022-03-31 08:10:09, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} nd={} for k in d: if len(d[k])>1: nd[k]=d[k] return nd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d={} for e in type1: x=e.split(":") if x[0] not in d: d[x[0]]=[x[1]] if x[1] not in d: d[x[1]]=[x[0]] if x[0] in d: if x[1] not in d[x[0]]: d[x[0]].append(x[1]) if x[1] in d: if x[0] not in d[x[1]]: d[x[1]].append(x[0]) return d exec(input().strip()) # DON'T remove this line |
# 0227, 2022-03-31 08:08:25, PP (100%) def remove_len1(d): ans=dict() for i in d: if len(d[i])>=2: ans[i]=[e for e in d[i]] return ans # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): ans=dict() for i in type1: a,b=i.split(':') if a not in ans: ans[a]=[] if b not in ans: ans[b]=[] ans[a].append(b) ans[b].append(a) return ans # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0228, 2022-03-31 08:11:34, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} D = {} for k in d: if len(d[k]) != 1: D[k] = d[k] return D def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for p in type1: a,b = p.split(':') if a not in d: d[a] = [b] else: d[a].append(b) if b not in d: d[b] = [a] else: d[b].append(a) return d exec(input().strip()) # DON'T remove this line |
# 0229, 2022-03-31 08:09:40, PP (100%) def remove_len1(d): r = {} for e in d: if len(d[e]) > 1: r[e] = d[e] return r def to_type2(type1): p = {} for e in type1: s = e.split(':') if s[0] not in p: p[s[0]] = [s[1]] else: p[s[0]].append(s[1]) if s[1] not in p: p[s[1]] = [s[0]] else: p[s[1]].append(s[0]) return p exec(input().strip()) # DON'T remove this line |
# 0230, 2022-03-31 08:08:18, PP (100%) def remove_len1(d): d2 = {} for i in d: if len(d[i])>1: d2[i]=d[i] return d2 def to_type2(type1): d = {} for i in type1: ss,ss2 = i.split(":") d[ss] = [] d[ss2] = [] for i in type1: ss,ss2 = i.split(":") d[ss].append(ss2) d[ss2].append(ss) return d exec(input().strip()) # DON'T remove this line |
# 0231, 2022-03-31 08:10:28, PP (100%) def remove_len1(d): dout = {} for k,v in d.items(): if len(v) > 1: dout[k] = v return dout def to_type2(type1): type2 = {} for e in type1: a,b = e.split(':') c,d = b,a if a not in type2: type2[a] = [b] else: type2[a] += [b] if c not in type2: type2[c] = [d] else: type2[c] += [d] return type2 exec(input().strip()) # DON'T remove this line |
# 0232, 2022-03-31 08:15:02, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} k = {} g = [] for data in d: if len(d[data]) >1: k[data] = d[data] return k def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 k = {} hi = [] for e in type1: hi.append(e.split(':')) for e in hi: if e[0] not in k: k[e[0]] = [e[1]] elif e[0] in k: k[e[0]].append(e[1]) if e[1] not in k: k[e[1]] = [e[0]] elif e[1] in k: k[e[1]].append(e[0]) return k exec(input().strip()) # DON'T remove this line |
# 0233, 2022-03-31 08:11:38, PP (100%) def remove_len1(d): c = {} for e in d: if len(d[e]) > 1: c[e] = d[e] return c def to_type2(type1): c = {} for e in type1: x = e.split(':') if x[0] in c: c[x[0]] += [x[1]] else: c[x[0]] = [x[1]] if x[1] in c: c[x[1]] += [x[0]] else: c[x[1]] = [x[0]] return c exec(input().strip()) |
# 0234, 2022-03-31 08:10:23, PP (100%) def remove_len1(d): a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a def to_type2(type1): c = {} for i in type1: a,b = i.split(':') if a not in c: c[a] = [b] else: c[a] += [b] if b not in c: c[b] = [a] else: c[b] += [a] return c exec(input().strip()) |
# 0235, 2022-03-31 08:11:09, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} fd = {} for key in d: if len(d[key]) != 1: fd[key] = d[key] return fd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = [] for i in type1: elem = i.split(':') a.append(elem[0]) a.append(elem[1]) a = list(set(a)) fd = {} for i in a: fd[i] = [] for i in type1: elem = i.split(':') fd[elem[0]].append(elem[1]) fd[elem[1]].append(elem[0]) return fd exec(input().strip()) # DON'T remove this line |
# 0236, 2022-03-31 08:08:44, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = dict() for i in d: if len(d[i]) > 1: ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = dict() for i in type1: [a, b] = i.split(':') ans[a] = [] ans[b] = [] for i in type1: [a, b] = i.split(':') ans[a].append(b) ans[b].append(a) return ans exec(input().strip()) |
# 0237, 2022-03-31 08:13:06, PP (100%) def remove_len1(d): out={} for k in d : if len(d[k])>1: out[k]=d[k] return out def to_type2(type1): out={} for k in type1: x=k.split(':') if x[0] in out: out[x[0]].append(x[1]) else: out[x[0]]=[x[1]] if x[1] in out: out[x[1]].append(x[0]) else: out[x[1]]=[x[0]] return out exec(input().strip()) # DON'T remove this line |
# 0238, 2022-03-31 08:13:25, PP (100%) def remove_len1(d): res={} for ch in d: if len(d[ch])>1: res[ch]=d[ch] return res def to_type2(type1): type2={} for i in range (len(type1)): one,two=type1[i].split(":") if one in type2: type2[one].append(two) else: type2[one]=[two] if two in type2: type2[two].append(one) else: type2[two]=[one] return type2 exec(input().strip()) # DON'T remove this line |
# 0239, 2022-03-31 08:08:10, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} n={} for i in d: if len(d[i])>1: n[i]=d[i] return n def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 t={} for i in type1: a,b=i.split(':') if a in t: t[a].append(b) else: t[a]=[b] if b in t: t[b].append(a) else: t[b]=[a] return t exec(input().strip()) # DON'T remove this line |
# 0240, 2022-03-31 08:09:58, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for e in d: if len(d[e]) != 1: ans[e]=d[e] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for e in type1: x,y=e.split(":") if x not in ans: ans[x] = [] if y not in ans: ans[y] = [] ans[x].append(y) ans[y].append(x) return ans exec(input().strip()) # DON'T remove this line |
# 0241, 2022-03-31 08:09:47, PP (100%) def remove_len1(d): dic = {} for e in d: if len(d[e]) != 1: dic[e] = d[e] return dic def to_type2(type1): dic = {} for e in type1: x1,x2 = e.split(':') if x1 not in dic: dic[x1] = [x2] else: dic[x1] += [x2] if x2 not in dic: dic[x2] = [x1] else: dic[x2] += [x1] return dic exec(input().strip()) |
# 0242, 2022-03-31 08:10:25, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} sum = {} for i in d: if len(d[i])>1: sum[i] = d[i] return sum # print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 sum = {} for i in type1: key,value = i.split(':') if key in sum: sum[key].append(value) else: sum[key] = [value] if value in sum: sum[value] += [key] else: sum[value] = [key] return sum # print(to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])) exec(input().strip()) # DON'T remove this line |
# 0243, 2022-03-31 08:08:42, PP (100%) def remove_len1(d): results = {} for e in d: if len(d[e]) != 1: results[e] = d[e] return results def to_type2(type1): results = {} for e in type1: a,b = e.split(':') if a not in results: results[a] = [b] else: results[a].append(b) if b not in results: results[b] = [a] else: results[b].append(a) return results exec(input().strip()) |
# 0244, 2022-03-31 08:08:57, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out={} for i in d: if len(d[i])!=1: out[i]=d[i] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out={} for i in type1: j,k=i.split(':') if j in out: out[j].append(k) else: out[j]=[k] if k in out: out[k].append(j) else: out[k]=[j] return out exec(input().strip()) # DON'T remove this line |
# 0245, 2022-03-31 08:06:16, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: if(len(d[key]) != 1): ans[key] = d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for x in type1: key,value = x.split(':') if(not key in ans): ans[key] = [value] else: ans[key].append(value) if(not value in ans): ans[value] = [key] else: ans[value].append(key) return ans exec(input().strip()) # DON'T remove this line |
# 0246, 2022-03-31 08:13:51, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d : if len(d[i])>1: ans[i]=d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for i in type1: s=i.split(":") for j in range (len(s)): if not s[j] in ans : if j==0: ans[s[j]]=s[1] elif j==1: ans[s[j]]=s[0] else: if j==0: ans[s[j]]+=s[1] elif j==1: ans[s[j]]+=s[0] return ans exec(input().strip()) # DON'T remove this line |
# 0247, 2022-03-31 08:09:46, PP (100%) def remove_len1(d): ans = {} for key in d: if len(d[key]) != 1: ans[key] = d[key] return ans def to_type2(type1): ans = {} for i in type1: a,b = i.split(':') if a not in ans: ans[a] = [b] else: ans[a] += [b] if b not in ans: ans[b] = [a] else: ans[b] += [a] return ans exec(input().strip()) |
# 0248, 2022-03-31 08:14:25, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: count = 0 for i in range(len(d[key])): count = count+1 if count>1: ans[key] = d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dic = {} for i in range(len(type1)): a,b = str(type1[i]).split(':') if a in dic: dic[a] = dic[a] + b else : dic[a] = b if b in dic: dic[b] = dic[b] + a else : dic[b] = a return dic #print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) #print(to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])) exec(input().strip()) # DON'T remove this line |
# 0249, 2022-03-31 08:11:24, PP (100%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i,j in d.items(): if(len(j)>1): ans[i]=j return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for i in type1: consi = i.strip().split(":") if(consi[0]in ans.keys()): ans[consi[0]]=ans[consi[0]]+[consi[1]] else: ans[consi[0]]=[consi[1]] if(consi[1]in ans.keys()): ans[consi[1]]=ans[consi[1]]+[consi[0]] else: ans[consi[1]]=[consi[0]] return ans exec(input().strip()) # DON'T remove this line |
# 0250, 2022-03-31 08:13:32, PP (100%) def remove_len1(d): newd={} for key in d: value=d[key] if len(value)!=1: newd[key]=value return newd # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): data={} for i in type1: x,y=i.split(":") if x in data: data[x]=data[x]+[y] elif x not in data: data[x]=[y] if y in data: data[y]=data[y]+[x] elif y not in data: data[y]=[x] return data # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0251, 2022-03-31 08:11:31, PP (100%) def remove_len1(d): d_out = dict() for k in d: if len(d[k]) > 1: d_out[k] = d[k] return d_out def to_type2(type1): u_type1 = type1 dict_out = dict() for node in u_type1: a, b = node.strip().split(':') if a not in dict_out: dict_out[a] = [] dict_out[a].append(b) if b not in dict_out: dict_out[b] = [] dict_out[b].append(a) return dict_out exec(input().strip()) |
# 0252, 2022-03-31 08:11:30, PP (100%) def remove_len1(d): dd = {} for index, value in d.items(): if len(value) > 1: dd[index] = value return dd def to_type2(type1): type2 = {} for e in type1: left, right = e.split(':') if not(type2.get(left, 0)): type2[left] = [] type2[left] += [right] if not(type2.get(right,0)): type2[right] = [] type2[right] += [left] return type2 exec(input().strip()) |
# 0253, 2022-03-31 08:10:01, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if d[i] != len(1): ans[d] = i return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0254, 2022-03-31 08:13:38, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if d[i] != len(1): ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0255, 2022-03-31 08:14:20, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if d[i] != len(1): ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0256, 2022-03-31 08:15:31, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if d[i] != 1: ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0257, 2022-03-31 08:16:00, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if d[i] != len(1): ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0258, 2022-03-31 08:16:05, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if d[i] != 1: ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0259, 2022-03-31 08:16:16, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if d[i] != len(1): ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0260, 2022-03-31 08:16:31, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if len(d[i]) != 1: ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line |
# 0261, 2022-03-31 08:08:16, compilation error (0%) def remove_len1(d): if len(d[e]) != 1} : for e in d : return {e:d[e] | # 0262, 2022-03-31 08:08:23, -- (0%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} | # 0263, 2022-03-31 08:09:42, compilation error (0%) def remove_len1(d): for e in d : if len(d[e]) != 1} : return {e:d[e] | # 0264, 2022-03-31 08:10:01, -- (0%) def remove_len1(d): for e in d : if len(d[e]) != 1 : return {e:d[e]} | # 0265, 2022-03-31 08:14:43, compilation error (0%) def remove_len1(d): for e in d : if len(d[e]) != 1 : return {e:d[e]} def to_type2(type1): exec(input().strip()) # DON'T remove this line | # 0266, 2022-03-31 08:15:15, -x (0%) def remove_len1(d): for e in d : if len(d[e]) != 1 : return {e:d[e]} exec(input().strip()) # DON'T remove this line | # 0267, 2022-03-31 08:15:47, -x (0%) def remove_len1(d): for e in d : if len(d[e]) != 1 : return {e:d[e]} exec(input().strip()) # DON'T remove this line | # 0268, 2022-03-31 08:16:21, Px (50%) def remove_len1(d): return {x:d[x] for x in d if len(d[x]) != 1} exec(input().strip()) # DON'T remove this line |
# 0269, 2022-03-31 08:06:18, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(i) > 1: x[i] = d[i] return x exec(input().strip()) # DON'T remove this line | # 0270, 2022-03-31 08:06:46, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(d[i]) > 1: x[i] = d[i] return x exec(input().strip()) # DON'T remove this line | # 0271, 2022-03-31 08:10:15, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(d[i]) > 1: x[i] = d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = {} for i in type1: a,b =i.split() if a in x: x[a].append(b) else: x[a] = b return x exec(input().strip()) # DON'T remove this line | # 0272, 2022-03-31 08:13:14, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(d[i]) > 1: x[i] = d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return { 'A': ['B'], 'B': ['A', 'C'], 'C': ['B', 'E1', 'D'], 'E1': ['C'], 'D': ['C'] } exec(input().strip()) # DON'T remove this line | # 0273, 2022-03-31 08:13:40, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(d[i]) > 1: x[i] = d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return {'A': ['B'],'B': ['A', 'C'],'C': ['B', 'E1', 'D'],'E1': ['C'],'D': ['C']} exec(input().strip()) # DON'T remove this line | # 0274, 2022-03-31 08:15:48, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(d[i]) > 1: x[i] = d[i] return x exec(input().strip()) # DON'T remove this line to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])={'A': ['B'],'B': ['A', 'C'],'C': ['B', 'E1', 'D'],'E1': ['C'],'D': ['C']} | # 0275, 2022-03-31 08:15:56, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(d[i]) > 1: x[i] = d[i] return x exec(input().strip()) # DON'T remove this line | # 0276, 2022-03-31 08:16:09, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for i in d: if len(d[i]) > 1: x[i] = d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = {} for i in type1: a,b =i.split() if a in x: x[a].append(b) else: x[a] = b return x exec(input().strip()) # DON'T remove this line |
# 0277, 2022-03-31 08:12:29, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for c in d: if len(d[c]) == 1: continue else: dct[c] = d[c] return dct # def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0278, 2022-03-31 08:15:47, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for c in d: if len(d[c]) == 1: continue else: dct[c] = d[c] return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dct = {} for key in type1: if key in dct: dct[key].append(type1[key]) else: dct[key] = lst(type1[key]) return dct นแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0279, 2022-03-31 08:15:54, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for c in d: if len(d[c]) == 1: continue else: dct[c] = d[c] return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dct = {} for key in type1: if key in dct: dct[key].append(type1[key]) else: dct[key] = lst(type1[key]) return dct exec(input().strip()) # DON'T remove this line | # 0280, 2022-03-31 08:15:59, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for c in d: if len(d[c]) == 1: continue else: dct[c] = d[c] return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dct = {} for key in type1: if key in dct: dct[key].append(type1[key]) else: dct[key] = lst(type1[key]) return dct exec(input().strip()) # DON'T remove this line | # 0281, 2022-03-31 08:16:21, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for c in d: if len(d[c]) == 1: continue else: dct[c] = d[c] return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dct = {} for key in type1: if key in dct: dct[key].append(type1[key]) else: dct[key] = lst(type1[key]) return dct exec(input().strip()) # DON'T remove this line | # 0282, 2022-03-31 08:16:26, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for c in d: if len(d[c]) == 1: continue else: dct[c] = d[c] return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dct = {} for key in type1: if key in dct: dct[key].append(type1[key]) else: dct[key] = lst(type1[key]) return dct exec(input().strip()) # DON'T remove this line | # 0283, 2022-03-31 08:16:50, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for c in d: if len(d[c]) == 1: continue else: dct[c] = d[c] return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dct = {} for key in type1: if key in dct: dct[key].append(type1[key]) else: dct[key] = lst(type1[key]) return dct exec(input().strip()) # DON'T remove this line |
# 0284, 2022-03-31 08:07:16, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C' return {e:d[e] for e in d if len(d[e]) != 1}]} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0285, 2022-03-31 08:07:43, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C' return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0286, 2022-03-31 08:14:17, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C' return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0287, 2022-03-31 08:15:27, x- (0%) def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans exec(input().strip()) # DON'T remove this line | # 0288, 2022-03-31 08:15:46, P- (50%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans exec(input().strip()) # DON'T remove this line | # 0289, 2022-03-31 08:16:32, P- (50%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans exec(input().strip()) # DON'T remove this line |
# 0290, 2022-03-31 08:07:49, compilation error (0%) def remove_len1(d): ans = {} for i in d: if len(d[i]) != 1: ans[i] = d[i] return ans def to_type2(type1): ans = {} x = input() print() | # 0291, 2022-03-31 08:08:05, -- (0%) def remove_len1(d): ans = {} for i in d: if len(d[i]) != 1: ans[i] = d[i] return ans | # 0292, 2022-03-31 08:08:59, -- (0%) def remove_len1(d): ans = {} for i in d: if len(d[i]) != 1: ans[i] = d[i] return ans def to_type2(type1): pass | # 0293, 2022-03-31 08:11:33, -- (0%) def remove_len1(d): ans = {} for e in d: if len(d[e]) != 1: ans[e]=d[e] return e def to_type2(type1): pass | # 0294, 2022-03-31 08:11:43, -- (0%) def remove_len1(d): ans = {} for e in d: if len(d[e]) != 1: ans[e]=d[e] return ans def to_type2(type1): pass | # 0295, 2022-03-31 08:12:08, Px (50%) def remove_len1(d): ans = {} for e in d: if len(d[e]) != 1: ans[e]=d[e] return ans def to_type2(type1): pass exec(input().strip()) |
# 0296, 2022-03-31 08:13:05, -x (0%) def remove_len1(d): google={} for apichart in d: if len(d[apichart])<1: google[apichart]=d[apichart] return google def to_type2(type1): bread={} for jack in type1: if jack not in bread: bread[jack]=[type1[jack]] else: bread[jack].append(type1) if type1[jack] not in bread: bread[type1[jack]]=[jack] else: bread[type1[jack]].append([jack]) return bread exec(input().strip()) # DON'T remove this line | # 0297, 2022-03-31 08:13:29, compilation error (0%) def remove_len1(d): google={} for apichart in d: if len(d[apichart]>1: google[apichart]=d[apichart] return google def to_type2(type1): bread={} for jack in type1: if jack not in bread: bread[jack]=[type1[jack]] else: bread[jack].append(type1) if type1[jack] not in bread: bread[type1[jack]]=[jack] else: bread[type1[jack]].append([jack]) return bread exec(input().strip()) # DON'T remove this line | # 0298, 2022-03-31 08:13:48, Px (50%) def remove_len1(d): google={} for apichart in d: if len(d[apichart])>1: google[apichart]=d[apichart] return google def to_type2(type1): bread={} for jack in type1: if jack not in bread: bread[jack]=[type1[jack]] else: bread[jack].append(type1) if type1[jack] not in bread: bread[type1[jack]]=[jack] else: bread[type1[jack]].append([jack]) return bread exec(input().strip()) # DON'T remove this line | # 0299, 2022-03-31 08:16:41, -- (0%) def remove_len1(d): google={} for apichart in d: if len(d[apichart])>1: google[apichart]=d[apichart] return google def to_type2(type1): bread={} for jack in type1: if jack not in bread: a=[] bread[jack]=a a.append(type1[jack]) else: bread[jack].append(type1) if type1[jack] not in bread: b=[] bread[type1[jack]]=b b.append(type1[jack]) else: bread[type1[jack]].append([jack]) return bread | # 0300, 2022-03-31 08:16:56, Px (50%) def remove_len1(d): google={} for apichart in d: if len(d[apichart])>1: google[apichart]=d[apichart] return google def to_type2(type1): bread={} for jack in type1: if jack not in bread: a=[] bread[jack]=a a.append(type1[jack]) else: bread[jack].append(type1) if type1[jack] not in bread: b=[] bread[type1[jack]]=b b.append(type1[jack]) else: bread[type1[jack]].append([jack]) return bread exec(input().strip()) # DON'T remove this line |
# 0301, 2022-03-31 08:08:48, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dout = {} for key in d: if len(d[key]) != 1: dout[key] = d[key] return dout def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: e = e.split(':') if e[0] not in d: d[e[0]] = [e[1]] elif e[0] in d: d[e[0]] += [e[1]] elif e[1] not in d: d[e[1]] = [e[0]] elif e[1] in d: d[e[1]] += [e[0]] return d exec(input().strip()) # DON'T remove this line | # 0302, 2022-03-31 08:11:01, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dout = {} for key in d: if len(d[key]) != 1: dout[key] = d[key] return dout def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: e = e.split(':') if e[0] not in d: d[e[0]] = [e[1]] elif e[0] in d: d[e[0]].append(e[1]) elif e[1] not in d: d[e[1]] = [e[0]] elif e[1] in d: d[e[1]].append(e[0]) return d exec(input().strip()) # DON'T remove this line | # 0303, 2022-03-31 08:12:12, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dout = {} for key in d: if len(d[key]) != 1: dout[key] = d[key] return dout def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: e = e.split(':') if e[0] not in d: d[e[0]] = [e[1]] if e[0] in d: d[e[0]].append(e[1]) if e[1] not in d: d[e[1]] = [e[0]] if e[1] in d: d[e[1]].append(e[0]) return d exec(input().strip()) # DON'T remove this line | # 0304, 2022-03-31 08:12:50, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dout = {} for key in d: if len(d[key]) != 1: dout[key] = d[key] return dout def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: e = e.split(':') if e[0] not in d: d[e[0]] = [e[1]] if e[0] in d: d[e[0]] += [e[1]] if e[1] not in d: d[e[1]] = [e[0]] if e[1] in d: d[e[1]] + [e[0]] return d exec(input().strip()) # DON'T remove this line | # 0305, 2022-03-31 08:15:43, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dout = {} for key in d: if len(d[key]) != 1: dout[key] = d[key] return dout def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for e in type1: e = e.split(':') if e[0] not in d: d[e[0]] = [e[1]] if e[0] in d and e[1] not in d[e[0]]: d[e[0]] += [e[1]] if e[1] not in d: d[e[1]] = [e[0]] if e[1] in d and e[0] not in d[e[1]] : d[e[1]] + [e[0]] return d exec(input().strip()) # DON'T remove this line |
# 0306, 2022-03-31 08:09:29, compilation error (0%) def remove_len1(d): x={} for i in d: if len(d[i])==1: pass else: a=d[i] x[i]=a return x def exec(input().strip()) | # 0307, 2022-03-31 08:09:42, Px (50%) def remove_len1(d): x={} for i in d: if len(d[i])==1: pass else: a=d[i] x[i]=a return x exec(input().strip()) | # 0308, 2022-03-31 08:13:18, P- (50%) def remove_len1(d): x={} for i in d: if len(d[i])==1: pass else: a=d[i] x[i]=a return x def to_type2(type1): x={} for i in range(len(type1)): x[type1[i][0]]=type1[i][-1] return x exec(input().strip()) | # 0309, 2022-03-31 08:13:53, P- (50%) def remove_len1(d): x={} for i in d: if len(d[i])==1: pass else: a=d[i] x[i]=a return x def to_type2(type1): x={} for i in range(len(type1)): x[type1[i][0]]=type1[i][-1] return x exec(input().strip()) | # 0310, 2022-03-31 08:15:09, P- (50%) def remove_len1(d): x={} for i in d: if len(d[i])==1: pass else: a=d[i] x[i]=a return x def to_type2(type1): x={} for i in range(len(type1)): x[type1[i][0]]=type1[i][-1] return x exec(input().strip()) |
# 0311, 2022-03-31 08:14:49, -- (0%) def remove_len1(d): dd={} for key in d: if len(d[key])>1: dd[key]=d[key] return dd | # 0312, 2022-03-31 08:15:21, -- (0%) def remove_len1(d): dd={} for key in d: if len(d[key])>1: dd[key]=d[key] return dd | # 0313, 2022-03-31 08:15:34, compilation error (0%) def remove_len1(d): dd={} for key in d: if len(d[key])>1: dd[key]=d[key] return dd def to_type2(type1): cre={} for e in type1: li=e.split(':') cre[li[0]]=li[1] fi={} for k in fi: if k not in fi: # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0314, 2022-03-31 08:15:41, compilation error (0%) def remove_len1(d): dd={} for key in d: if len(d[key])>1: dd[key]=d[key] return dd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0315, 2022-03-31 08:15:49, Px (50%) def remove_len1(d): dd={} for key in d: if len(d[key])>1: dd[key]=d[key] return dd # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0316, 2022-03-31 08:05:02, compilation error (0%) def remove_len1(d): n = {} for k in d: if len(d[k]) == 1: n[k] = d[k] def to_type2(type1): exec(input().strip()) # DON'T remove this line | # 0317, 2022-03-31 08:07:56, compilation error (0%) def remove_len1(d): n = {} for k in d: if len(d[k]) != 1: n[k] = d[k] return n def to_type2(type1): exec(input().strip()) # DON'T remove this line | # 0318, 2022-03-31 08:12:40, compilation error (0%) def remove_len1(d): n = {} for k in d: if len(d[k]) != 1: n[k] = d[k] return n def to_type2(type1): exec(input().strip()) | # 0319, 2022-03-31 08:14:00, compilation error (0%) def remove_len1(d): n = {} for k in d: if len(d[k]) != 1: n[k] = d[k] return n exec(input().strip()) | # 0320, 2022-03-31 08:14:21, Px (50%) def remove_len1(d): n = {} for k in d: if len(d[k]) != 1: n[k] = d[k] return n exec(input().strip()) |
# 0321, 2022-03-31 08:07:36, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: if len(d[key]) == 1: ans[key] == d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for key in type1: type1[type1[key]] = key d = {} for key in type1: if key in d: d[key] += [type1[key]] if key not in d: d[key] = [type1[key]] return d | # 0322, 2022-03-31 08:07:56, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: if len(d[key]) == 1: ans[key] == d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for key in type1: type1[type1[key]] = key d = {} for key in type1: if key in d: d[key] += [type1[key]] if key not in d: d[key] = [type1[key]] return d exec(input().strip()) | # 0323, 2022-03-31 08:13:25, compilation error (0%) def remove_len1(d): ans = {} for key in d: if len(d[key]) != 1: ans[key] = d[key] return ans def to_type2(type1): re = {} for key in type1: re[type1[key]] = key d = {} for key in type1: if key in d: d[key] += [type1[key]] if key not in d: d[key] = [type1[key]] for key in re: if key in d: d[key] += [type1[key]] if key not in d: d[key] = [type1[key]] return d exec(input().strip()) | # 0324, 2022-03-31 08:13:45, Px (50%) def remove_len1(d): ans = {} for key in d: if len(d[key]) != 1: ans[key] = d[key] return ans def to_type2(type1): re = {} for key in type1: re[type1[key]] = key d = {} for key in type1: if key in d: d[key] += [type1[key]] if key not in d: d[key] = [type1[key]] for key in re: if key in d: d[key] += [type1[key]] if key not in d: d[key] = [type1[key]] return d exec(input().strip()) | # 0325, 2022-03-31 08:14:15, Px (50%) def remove_len1(d): ans = {} for key in d: if len(d[key]) != 1: ans[key] = d[key] return ans def to_type2(type1): re = {} for key in type1: re[type1[key]] = key d = {} for key in type1: if key in d: d[key] += type1[key] if key not in d: d[key] = type1[key] for key in re: if key in d: d[key] += type1[key] if key not in d: d[key] = type1[key] return d exec(input().strip()) |
# 0326, 2022-03-31 08:14:32, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} sp={} ff=[] for k in d: if len(d[k])!=1: sp[k]=d[k] return sp def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0327, 2022-03-31 08:15:06, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} sp={} ff=[] for k in d: if len(d[k])!=1: sp[k]=d[k] return sp def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0328, 2022-03-31 08:15:24, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} sp={} ff=[] for k in d: if len(d[k])!=1: sp[k]=d[k] return sp def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0329, 2022-03-31 08:15:34, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} sp={} ff=[] for k in d: if len(d[k])!=1: sp[k]=d[k] return sp def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return none exec(input().strip()) # DON'T remove this line | # 0330, 2022-03-31 08:16:27, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} sp={} ff=[] for k in d: if len(d[k])!=1: sp[k]=d[k] return sp def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 xx={} return xx exec(input().strip()) # DON'T remove this line |
# 0331, 2022-03-31 08:13:14, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d : if len(d[i]) != 1 : dic[i] = d[i] return dic | # 0332, 2022-03-31 08:13:33, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic | # 0333, 2022-03-31 08:13:51, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic exec(input().strip()) # DON'T remove this line | # 0334, 2022-03-31 08:16:05, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic def to_type2(type1): dic = {} for i in type1: i = i.split(':') if i[0] not in d: dic[e[0]]=[i[1]] elif i[0] in d: i[e[0]].append(i[1]) if i[1] not in d: dic[e[1]]=[i[0]] elif i[1] in d: dic[e[1]].append(i[0]) return dic exec(input().strip()) # DON'T remove this line | # 0335, 2022-03-31 08:16:47, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d : if len(d[i]) > 1 : dic[i] = d[i] return dic def to_type2(type1): dic = {} for i in type1: i = i.split(':') if i[0] not in d: dic[i[0]]=[i[1]] elif i[0] in d: dic[i[0]].append(i[1]) if i[1] not in d: dic[i[1]]=[i[0]] elif i[1] in d: dic[i[1]].append(i[0]) return dic exec(input().strip()) # DON'T remove this line |
# 0336, 2022-03-31 08:14:07, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} for i in range(len(type1)): y=i x[type1[i][0]]=[type1[i][-1]] return x exec(input().strip()) | # 0337, 2022-03-31 08:15:47, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} for i in range(len(type1)): y=i x[type1[i][0]]=[type1[i][-1]] x[type1[i][-1]]=[type1[i][0]] x={ 'A': ['B'], 'B': ['A', 'C'], 'C': ['B', 'E1', 'D'], 'E1': ['C'], 'D': ['C'] } return x | # 0338, 2022-03-31 08:15:55, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} for i in range(len(type1)): y=i x[type1[i][0]]=[type1[i][-1]] x[type1[i][-1]]=[type1[i][0]] return x | # 0339, 2022-03-31 08:16:07, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} for i in range(len(type1)): y=i x[type1[i][0]]=[type1[i][-1]] x[type1[i][-1]]=[type1[i][0]] x= return x exec(input().strip()) | # 0340, 2022-03-31 08:16:16, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} return x exec(input().strip()) |
# 0341, 2022-03-31 08:09:14, Px (50%) def remove_len1(d): out = {} for i in d: if len(d[i]) > 1: out[i] = d[i] return out def to_type2(type1): out = {} for i in type1: a = [] for n in type1: if i in type1[n]: a.append(n) out[i] = a return out exec(input().strip()) | # 0342, 2022-03-31 08:15:25, P- (50%) def remove_len1(d): out = {} for i in d: if len(d[i]) > 1: out[i] = d[i] return out def to_type2(type1): out = {} b = {} for i in type1: c,d = i.split(':') b[c] = d for i in b: a = [] a.append(b[i]) for n in b: if b[n] == i: a.append(n) out[i] = a return out exec(input().strip()) | # 0343, 2022-03-31 08:15:51, compilation error (0%) def remove_len1(d): out = {} for i in d: if len(d[i]) > 1: out[i] = d[i] return out def to_type2(type1): out = {} b = {} for i in type1: c,d = i.split(':') b[c] = d for i in b: a = [] a.append(b[i]) for n in b: if b[n] == i: a.append(n) out[i] = a return out exec(input().strip()) | # 0344, 2022-03-31 08:16:00, P- (50%) def remove_len1(d): out = {} for i in d: if len(d[i]) > 1: out[i] = d[i] return out def to_type2(type1): out = {} b = {} for i in type1: c,d = i.split(':') b[c] = d for i in b: a = [] a.append(b[i]) for n in b: if b[n] == i: a.append(n) out[i] = a return out exec(input().strip()) | # 0345, 2022-03-31 08:16:21, P- (50%) def remove_len1(d): out = {} for i in d: if len(d[i]) > 1: out[i] = d[i] return out def to_type2(type1): out = {} b = {} for i in type1: c,d = i.split(':') b[c] = d for i in b: a = [] a.append(b[i]) for n in b: if b[n] == i: a.append(n) out[i] = a return out exec(input().strip()) |
# 0346, 2022-03-31 08:05:30, compilation error (0%) def remove_len1(d): new ={} for i in d: if d[i] !=1: new[i] = d[i] return new def to_type(type1): exec(input().strip()) | # 0347, 2022-03-31 08:06:11, compilation error (0%) def remove_len1(d): new ={} for i in d: if len(d[i]) != 1: new[i] = d[i] return new def to_type(type1): exec(input().strip()) | # 0348, 2022-03-31 08:09:15, compilation error (0%) def remove_len1(d): new ={} for i in d: if len(d[i]) != 1: new[i] = d[i] return new def to_type(type1): exec(input().strip()) | # 0349, 2022-03-31 08:13:13, compilation error (0%) def remove_len1(d): new ={} for i in d: if len(d[i]) != 1: new[i] = d[i] return new def to_type(type1): exec(input().strip()) | # 0350, 2022-03-31 08:13:58, Px (50%) def remove_len1(d): new = {} for i in d: if len(d[i]) != 1: new[i] = d[i] return new exec(input().strip()) |
# 0351, 2022-03-31 08:12:22, P- (50%) def remove_len1(d): D ={} for i in d: if len((d[i])) > 1 : D[i] = d[i] return D def to_type2(type1): d = {} for i in type1: a,b = i.split(":") d[a] = [] return d exec(input().strip()) # DON'T remove this line | # 0352, 2022-03-31 08:12:59, P- (50%) def remove_len1(d): D ={} for i in d: if len((d[i])) > 1 : D[i] = d[i] return D def to_type2(type1): d = {} for i in type1: a,b = i.split(":") d[a] = [b] return d exec(input().strip()) # DON'T remove this line | # 0353, 2022-03-31 08:15:34, Px (50%) def remove_len1(d): D ={} for i in d: if len((d[i])) > 1 : D[i] = d[i] return D def to_type2(type1): d = {} for i in type1: a,b = i.split(":") d[a] = [] d[b] = [] for i in type1: a,b = i.split(":") d[a] += [b] d[b] += [a] exec(input().strip()) # DON'T remove this line | # 0354, 2022-03-31 08:15:48, Px (50%) def remove_len1(d): D ={} for i in d: if len((d[i])) > 1 : D[i] = d[i] return D def to_type2(type1): d = {} for i in type1: a,b = i.split(":") d[a] = [] d[b] = [] for i in type1: a,b = i.split(":") d[a] += [b] d[b] += [a] exec(input().strip()) # DON'T remove this line |
# 0355, 2022-03-31 08:05:42, Px (50%) def remove_len1(d): ans = {} for k,v in d.items(): if len(v)>1: ans[k]=v return ans exec(input().strip()) | # 0356, 2022-03-31 08:14:53, P- (50%) def remove_len1(d): ans = {} for k,v in d.items(): if len(v)>1: ans[k]=v return ans def to_type2(type1): ans = {} for i in type1: k=[] v=[] i0,i1=i.split(':') if i0 not in k: k.append(i0) v.append(i1) else: v.append(i1) return { 'A': ['B'], 'B': ['A', 'C'], 'C': ['B', 'E1', 'D'], 'E1': ['C'], 'D': ['C'] } exec(input().strip()) | # 0357, 2022-03-31 08:15:18, Px (50%) def remove_len1(d): ans = {} for k,v in d.items(): if len(v)>1: ans[k]=v return ans exec(input().strip()) | # 0358, 2022-03-31 08:16:57, Px (50%) def remove_len1(d): ans = {} for k,v in d.items(): if len(v)>1: ans[k]=v return ans def to_type2(type1): ans = {} k=[] for i in type1: v=[] i0,i1=i.split(':') if i0 not in k: k.append(i0) v.append(i1) else: v.append(i1) ans[k]=v return ans exec(input().strip()) |
# 0359, 2022-03-31 08:05:04, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: if len(d[key]) > 1: ans[key] = d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0360, 2022-03-31 08:15:29, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: if len(d[key]) > 1: ans[key] = d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return {'A': ['B'], 'B': ['A', 'C'],'C': ['B', 'E1', 'D'],'E1': ['C'], 'D': ['C']} exec(input().strip()) # DON'T remove this line | # 0361, 2022-03-31 08:15:37, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: if len(d[key]) > 1: ans[key] = d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0362, 2022-03-31 08:15:47, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d: if len(d[key]) > 1: ans[key] = d[key] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line |
# 0363, 2022-03-31 08:15:20, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for key,value in d.items(): if len(value) != 1: dct[key] = value return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for item in type1: i1,i2 = item.split(':') value = [] value.append(i2) for itemz in type1: if i2 in itemz: z1,z2 = itemz.split(':') if z1 == i1: value.append(z2) elif z2 == i1: value.append(z1) ans[i1] = value return ans exec(input().strip()) # DON'T remove this line | # 0364, 2022-03-31 08:16:07, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for key,value in d.items(): if len(value) != 1: dct[key] = value return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 print({'A': ['B'], 'B': ['A', 'C'],'C': ['B', 'E1', 'D'],'E1': ['C'], 'D': ['C']}) return exec(input().strip()) # DON'T remove this line | # 0365, 2022-03-31 08:16:11, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for key,value in d.items(): if len(value) != 1: dct[key] = value return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 print({'A': ['B'], 'B': ['A', 'C'],'C': ['B', 'E1', 'D'],'E1': ['C'], 'D': ['C']}) return exec(input().strip()) # DON'T remove this line | # 0366, 2022-03-31 08:16:43, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dct = {} for key,value in d.items(): if len(value) != 1: dct[key] = value return dct def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for item in type1: i1,i2 = item.split(':') value = [] value.append(i2) for itemz in type1: if i2 in itemz: z1,z2 = itemz.split(':') if z1 == i1: value.append(z2) elif z2 == i1: value.append(z1) ans[i1] = value return ans exec(input().strip()) # DON'T remove this line |
# 0367, 2022-03-31 08:11:05, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for e in d: if len(d[e])>1: r[e]=d[e] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 r={} a1=type1.split(', ') for e in a1: if (e[0] not in r) : r[e[0]] =e[2] if e[2] return r exec(input().strip()) # DON'T remove this line | # 0368, 2022-03-31 08:12:07, compilation error (0%) def remove_len1(d): r={} for e in d: if len(d[e])>1: r[e]=d[e] return r def to_type2(type1): r={} a1=type1.split(', ') for e in a1: if (e[0] not in r) : r[e[0]] =e[2] if e[2] return r exec(input().strip()) # DON'T remove this line | # 0369, 2022-03-31 08:13:18, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for e in d: if len(d[e])>1: r[e]=d[e] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 r={} a1=type1.split(', ') for e in a1: if (e[0] not in r) : r[e[0]] =e[2] if e[2]: pass return r exec(input().strip()) # DON'T remove this line | # 0370, 2022-03-31 08:15:40, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for e in d: if len(d[e])>1: r[e]=d[e] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 r={} a1=type1.split(', ') for e in a1: if (e[0] not in r) : r[e[0]] =[e[2]] r[e[2]] =[e[0]] else: r[e[0]] +=[e[2]] r[e[2]] +=[e[0]] return r exec(input().strip()) # DON'T remove this line |
# 0371, 2022-03-31 08:14:34, -- (0%) def remove_len1(d): di=dict(d) ans={} for i in di: x=len(di[i]) if x>1: v=di[i] ans[i]=v return ans | # 0372, 2022-03-31 08:14:51, Px (50%) def remove_len1(d): di=dict(d) ans={} for i in di: x=len(di[i]) if x>1: v=di[i] ans[i]=v return ans exec(input().strip()) | # 0373, 2022-03-31 08:15:05, Px (50%) def remove_len1(d): di=dict(d) ans={} for i in di: x=len(di[i]) if x>1: v=di[i] ans[i]=v return ans def to_type2(type1): return exec(input().strip()) | # 0374, 2022-03-31 08:15:26, compilation error (0%) def remove_len1(d): di=dict(d) ans={} for i in di: x=len(di[i]) if x>1: v=di[i] ans[i]=v return ans def to_type2(type1): return exec(input().strip()) |
# 0375, 2022-03-31 08:06:23, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dict_d = {} for i in d : if len(d[i]) > 1 : dict_d[i] = d[i] else : pass return dict_d | # 0376, 2022-03-31 08:15:47, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dict_d = {} for i in d : if len(d[i]) > 1 : dict_d[i] = d[i] else : pass return dict_d def to_type2(type1): type2_dict = {} for i in type1 : used1 =i.split(':') type2_dict[i[0]] = used1[1] return type2_dict | # 0377, 2022-03-31 08:16:05, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dict_d = {} for i in d : if len(d[i]) > 1 : dict_d[i] = d[i] else : pass return dict_d def to_type2(type1): type2_dict = {} for i in type1 : used1 =i.split(':') type2_dict[i[0]] = used1[1] return type2_dict exec(input().strip()) # DON'T remove this line | # 0378, 2022-03-31 08:16:08, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dict_d = {} for i in d : if len(d[i]) > 1 : dict_d[i] = d[i] else : pass return dict_d def to_type2(type1): type2_dict = {} for i in type1 : used1 =i.split(':') type2_dict[i[0]] = used1[1] return type2_dict exec(input().strip()) # DON'T remove this line |
# 0379, 2022-03-31 08:05:30, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d : if len(d[i])==1: continue else: ans[i]=d[i] return ans | # 0380, 2022-03-31 08:07:28, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d : if len(d[i])== 1: continue else: ans[i]=d[i] return ans exec(input().strip()) | # 0381, 2022-03-31 08:07:39, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d : if len(d[i])== 1: continue else: ans[i]=d[i] return ans exec(input().strip()) | # 0382, 2022-03-31 08:13:46, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d : if len(d[i])== 1: continue else: ans[i]=d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for i in type1: x,y=i.split() if x in ans : ans[x].append[y] else: ans[x] = [y] return ans exec(input().strip()) |
# 0383, 2022-03-31 08:07:47, -- (0%) def remove_len1(d): final = dict() for e in d: if len(d.get(e)) > 1: final[e] = d[e] return final | # 0384, 2022-03-31 08:14:51, P- (50%) def remove_len1(d): final = dict() for e in d: if len(d.get(e)) > 1: final[e] = d[e] return final def to_type2(type1): type2 = dict() for t in type1: t1,t2 = t.split(':') if type2.get(t) == None: type2[t1] = t2 else: type2[t1] += t2 return type2 # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0385, 2022-03-31 08:16:14, P- (50%) def remove_len1(d): final = dict() for e in d: if len(d.get(e)) > 1: final[e] = d[e] return final def to_type2(type1): type2 = dict() for t in type1: t1,t2 = t.split(':') if type2.get(t) == None: type2[t1] = t2 else: type2[t1] = type2[t1].append(t2) return type2 # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0386, 2022-03-31 08:16:39, P- (50%) def remove_len1(d): final = dict() for e in d: if len(d.get(e)) > 1: final[e] = d[e] return final def to_type2(type1): type2 = dict() for t in type1: t1,t2 = t.split(':') if type2.get(t) == None: type2[t1] = [t2] else: type2[t1] = type2[t1].append(t2) return type2 # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0387, 2022-03-31 08:10:21, -- (0%) def remove_len1(d): d_new = {} for data in d : if len(d[data]) != 1 : d_new[data] = d[data] return d_new | # 0388, 2022-03-31 08:10:31, Px (50%) def remove_len1(d): d_new = {} for data in d : if len(d[data]) != 1 : d_new[data] = d[data] return d_new exec(input().strip()) | # 0389, 2022-03-31 08:14:51, Px (50%) def remove_len1(d): d_new = {} for data in d : if len(d[data]) != 1 : d_new[data] = d[data] return d_new def to_type2(type1): x = [] for k in type1 : a = k.split(":") x.append(a[0]) x.append(a[1]) x = list(set(a)) d = {} for m in x: d[m] = [] for k in type1: a = k.split(":") d[a[0]].append(a[1]) d[a[1]].append(a[0]) return d exec(input().strip()) |
# 0390, 2022-03-31 08:04:11, -- (0%) def remove_len1(d): x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x | # 0391, 2022-03-31 08:08:21, Px (50%) def remove_len1(d): x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x def to_type2(type1): pass exec(input().strip()) | # 0392, 2022-03-31 08:15:48, Px (50%) def remove_len1(d): x={} for i in d: if len(d[i]) != 1: x[i]=d[i] return x def to_type2(type1): pass exec(input().strip()) |
# 0393, 2022-03-31 08:12:27, P- (50%) def remove_len1(d): r = {} for i in d: if len(d[i]) != 1: r[i] = d[i] return r def to_type2(type1): r = {} for k in type1: x = 0 a,b = k.split(':') if a not in r: r[a] = [b] if a in r: for i in r[a]: if i == b: x += 1 if x == 0: r[a] += [b] if b not in r: r[b] = [a] if b in r: for i in r[a]: if i == a: x += 1 if x == 0: r[b] += [a] return r exec(input().strip()) | # 0394, 2022-03-31 08:15:12, Px (50%) def remove_len1(d): r = {} for i in d: if len(d[i]) != 1: r[i] = d[i] return r def to_type2(type1): r = {} for k in type1: x = 0 a,b = k.split(':') if a not in r: r[a] = [b] if a in r: if i in r[a]: x += 1 if x == 0: r[a] += [b] if b not in r: r[b] = [a] if b in r: if i in r[b]: x += 1 if x == 0: r[b] += [a] return r exec(input().strip()) | # 0395, 2022-03-31 08:15:40, P- (50%) def remove_len1(d): r = {} for i in d: if len(d[i]) != 1: r[i] = d[i] return r def to_type2(type1): r = {} for k in type1: x = 0 a,b = k.split(':') if a not in r: r[a] = [b] if a in r: if b in r[a]: x += 1 if x == 0: r[a] += [b] if b not in r: r[b] = [a] if b in r: if a in r[b]: x += 1 if x == 0: r[b] += [a] return r exec(input().strip()) |
# 0396, 2022-03-31 08:14:08, compilation error (0%) def remove_len1(d): x = {} for key in d: if len(d[key]) != 1 : x[key] = d[key] return x def to_type2(type1): d = {} for x in type1: key,value = x.split(':') d[key] = value for key in d: return reverse_d,d exec(input().strip()) | # 0397, 2022-03-31 08:14:26, compilation error (0%) def remove_len1(d): x = {} for key in d: if len(d[key]) != 1 : x[key] = d[key] return x def to_type2(type1): d = {} for x in type1: key,value = x.split(':') d[key] = value for key in d: return exec(input().strip()) | # 0398, 2022-03-31 08:15:00, P- (50%) def remove_len1(d): x = {} for key in d: if len(d[key]) != 1 : x[key] = d[key] return x def to_type2(type1): d = {} for x in type1: key,value = x.split(':') d[key] = value return d exec(input().strip()) |
# 0399, 2022-03-31 08:11:52, Px (50%) def remove_len1(d): x = {} for i in d: if len(d[i]) != 1: x[i] = d[i] return x def to_type2(type1): out = {} for i in type1: x,y = i.strip(":") if x not in out: out[x] = y else: out[x] += y if y not in out: out[y] = x else: out[y] += x return out exec(input().strip()) | # 0400, 2022-03-31 08:14:41, Px (50%) def remove_len1(d): x = {} for i in d: if len(d[i]) != 1: x[i] = d[i] return x def to_type2(type1): out = {} for i in type1: x,y = i.strip(":") if x not in out: a = [y] out[x] = a else: out[x] += y if y not in out: a = [x] out[y] = a else: out[y] += x return out exec(input().strip()) | # 0401, 2022-03-31 08:16:17, Px (50%) def remove_len1(d): x = {} for i in d: if len(d[i]) != 1: x[i] = d[i] return x def to_type2(type1): out = {} for i in type1: x,y = i.strip(":") if x not in out: a = [y] out[x] = a else: out[x] += y if y not in out: a = [x] out[y] = a else: out[y] += x return out exec(input().strip()) |
# 0402, 2022-03-31 08:10:22, compilation error (0%) def remove_len1(d): p={} for key is d: if len(d[key])!=1: p[key]=d[key] return p # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): d={} for l in type1: x,y=l.split(":") if x in d: d[x]+=[y] else: d[x]=[y] return d # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0403, 2022-03-31 08:10:55, P- (50%) def remove_len1(d): p={} for key in d: if len(d[key])!=1: p[key]=d[key] return p # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): d={} for l in type1: x,y=l.split(":") if x in d: d[x]+=[y] else: d[x]=[y] return d # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0404, 2022-03-31 08:16:08, P- (50%) def remove_len1(d): p={} for key in d: if len(d[key])!=1: p[key]=d[key] return p # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): d={} for l in type1: x,y=l.split(":") if x in d: d[x]+=[y] if y in d: d[y]+=[x] else: d[x]=[y] d[y]=[x] return d # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0405, 2022-03-31 08:09:37, -- (0%) def remove_len1(d): ans={} for i in d: if len(d[i])>1: ans[i]=d[i] return ans print(remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']})) | # 0406, 2022-03-31 08:12:06, -- (0%) def remove_len1(d): ans={} for i in d: if len(d[i])>1: ans[i]=d[i] return ans | # 0407, 2022-03-31 08:12:20, Px (50%) def remove_len1(d): ans={} for i in d: if len(d[i])>1: ans[i]=d[i] return ans exec(input().strip()) |
# 0408, 2022-03-31 08:03:36, Px (50%) def remove_len1(d): out = {} for m in d: if len(d[m]) > 1: out[m] = d[m] return out exec(input().strip()) | # 0409, 2022-03-31 08:15:32, Px (50%) def remove_len1(d): out = {} for m in d: if len(d[m]) > 1: out[m] = d[m] return out def to_type2(type1): l = {}; out = {}; ready = [] for k in type1: x, y = k.split(':') if x not in ready: ready.append(x) if y not in ready: ready.append(y) l[x] = y for n in ready: st = [] if n in l: st.append(l[n]) for i in l: if l[i] == n: st.append(l[i]) out[n] = st return ready, l, out exec(input().strip()) | # 0410, 2022-03-31 08:15:39, P- (50%) def remove_len1(d): out = {} for m in d: if len(d[m]) > 1: out[m] = d[m] return out def to_type2(type1): l = {}; out = {}; ready = [] for k in type1: x, y = k.split(':') if x not in ready: ready.append(x) if y not in ready: ready.append(y) l[x] = y for n in ready: st = [] if n in l: st.append(l[n]) for i in l: if l[i] == n: st.append(l[i]) out[n] = st return out exec(input().strip()) |
# 0411, 2022-03-31 08:06:59, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-valu','C']} a={} for i in d: if len(d[i])==2: a[i]=d[i] break return(a) exec(input().strip()) # DON'T remove this line | # 0412, 2022-03-31 08:07:27, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-valu','C']} a={} for i in d: if len(d[i])>=2: a[i]=d[i] break return(a) exec(input().strip()) # DON'T remove this line | # 0413, 2022-03-31 08:07:58, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-valu','C']} a={} for i in d: if len(d[i])>=2: a[i]=d[i] return(a) exec(input().strip()) # DON'T remove this line |
# 0414, 2022-03-31 08:09:54, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d1 = {} for i in d: if i in ['A','B','C','D','E1'] and len(d[i]) > 1: d1[i] = d[i] return d1 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0415, 2022-03-31 08:10:39, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d1 = {} for i in d: if len(d[i]) > 1: d1[i] = d[i] return d1 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0416, 2022-03-31 08:16:52, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d1 = {} for i in d: if len(d[i]) > 1: d1[i] = d[i] return d1 def to_type2(t): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} x = [] for i in t: s1,s2 = i.split(':') d[s1].append(s2) d[s].append(s1) return d exec(input().strip()) # DON'T remove this line |
# 0417, 2022-03-31 08:06:21, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d1={} for k in d: if len(d[k])==1: pass else: d1[k]=d[k] return d1 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0418, 2022-03-31 08:06:30, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d1={} for k in d: if len(d[k])==1: pass else: d1[k]=d[k] return d1 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0419, 2022-03-31 08:11:48, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d1={} for k in d: if len(d[k])==1: pass else: d1[k]=d[k] return d1 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d1=[] for k in type1: d1+=k d={d1[0]:type1} return exec(input().strip()) # DON'T remove this line |
# 0420, 2022-03-31 08:14:43, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dict = { } for i in d: if len(d[i]) >= 2: dict[i] = d[i] return dict def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 g = { } x = ','.join(type1) y = [] for i in x : if i not in y and i in 'ABCDEFGHIJKMNOPQRSTUVWXYZ': y.append(i) for j in y: for k in type1: if j in k: for t in k: if t != j and t in 'ABCDEFGHIJKMNOPQRSTUVWXYZ': g[j] += [t] exec(input().strip()) # DON'T remove this line | # 0421, 2022-03-31 08:14:50, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dict = { } for i in d: if len(d[i]) >= 2: dict[i] = d[i] return dict def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 g = { } x = ','.join(type1) y = [] for i in x : if i not in y and i in 'ABCDEFGHIJKMNOPQRSTUVWXYZ': y.append(i) for j in y: for k in type1: if j in k: for t in k: if t != j and t in 'ABCDEFGHIJKMNOPQRSTUVWXYZ': g[j] += [t] exec(input().strip()) # DON'T remove this line | # 0422, 2022-03-31 08:15:07, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dict = { } for i in d: if len(d[i]) >= 2: dict[i] = d[i] return dict def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 g = { } x = ','.join(type1) y = [] for i in x : if i not in y and i in 'ABCDEFGHIJKMNOPQRSTUVWXYZ': y.append(i) for j in y: for k in type1: if j in k: for t in k: if t != j and t in 'ABCDEFGHIJKMNOPQRSTUVWXYZ': g[j] += [t] return g exec(input().strip()) # DON'T remove this line |
# 0423, 2022-03-31 08:06:13, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d : if len(d[i]) > 1 : a[i] = d[i] else: pass return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0424, 2022-03-31 08:06:27, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d : if len(d[i]) > 1 : a[i] = d[i] else: pass return a #def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 #exec(input().strip()) # DON'T remove this line | # 0425, 2022-03-31 08:07:21, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d : if len(d[i]) > 1 : a[i] = d[i] else: pass return a #def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0426, 2022-03-31 08:13:00, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for k in d: if len(d[k])>1: x[k]=d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} k=[] for t in type1: if t[0] not in k: k.append(t.split(':')) for ch in k: c=0 for ch in k exec(input().strip()) # DON'T remove this line | # 0427, 2022-03-31 08:13:15, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for k in d: if len(d[k])>1: x[k]=d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0428, 2022-03-31 08:13:36, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x={} for k in d: if len(d[k])>1: x[k]=d[k] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line |
# 0429, 2022-03-31 08:14:03, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} result = {} for key in d: if len(d[key]) != 1: result[key] = d[key] return result def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 result = {} keys = [] values = [] for e in type1: key, value = e.split(":") result[key] = [value] keys.append(key) values.append(value) if key in values: i = values.index(key) result[key] += [keys[i]] return result exec(input().strip()) # DON'T remove this line | # 0430, 2022-03-31 08:14:56, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} result = {} for key in d: if len(d[key]) != 1: result[key] = d[key] return result def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 result = {} keys = [] values = [] for e in type1: key, value = e.split(":") result[key] = [value] keys.append(key) values.append(value) if key in values: i = values.index(key) result[key] += [keys[i]] result[key].sort() return result exec(input().strip()) # DON'T remove this line | # 0431, 2022-03-31 08:16:02, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} result = {} for key in d: if len(d[key]) != 1: result[key] = d[key] return result def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 result = {} keys = [] values = [] for e in type1: key, value = e.split(":") result[key] = [value] keys.append(key) values.append(value) if key in values: i = values.index(key) result[key] += [keys[i]] result[key].sort() return result exec(input().strip()) # DON'T remove this line |
# 0432, 2022-03-31 08:10:14, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} D = {} for i in d : if len(d[i]) != 1 : D[i] = d[i] return D | # 0433, 2022-03-31 08:10:31, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} D = {} for i in d : if len(d[i]) != 1 : D[i] = d[i] return D exec(input().strip()) | # 0434, 2022-03-31 08:13:59, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} D = {} for i in d : if len(d[i]) != 1 : D[i] = d[i] else : pass return (D) exec(input().strip()) |
# 0435, 2022-03-31 08:05:44, -- (0%) def remove_len1(d): dict = {} for ch in d: if len(d[ch]) == 1: pass else: dict[ch] = d[ch] return dict | # 0436, 2022-03-31 08:06:05, Px (50%) def remove_len1(d): dict = {} for ch in d: if len(d[ch]) == 1: pass else: dict[ch] = d[ch] return dict exec(input().strip()) | # 0437, 2022-03-31 08:14:15, Px (50%) def remove_len1(d): dict = {} for ch in d: if len(d[ch]) == 1: pass else: dict[ch] = d[ch] return dict def to_type2(type1): dict = {} for ch in type1: ch = ch.split(':') dict[ch[0]] = [ch[1]] for ch1 in dict: for ch2 in dict: if dict[ch1] in ch2: dict[ch2].append[ch1] exec(input().strip()) |
# 0438, 2022-03-31 08:06:42, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dnew = {} for i in d: if len(d[i]) > 1: dnew[i] = d[i] return dnew #def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0439, 2022-03-31 08:13:24, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dnew = {} for i in d: if len(d[i]) > 1: dnew[i] = d[i] return dnew def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dnew = {} for i in type1: dnew[i[0]] = [i[2]] return dnew exec(input().strip()) # DON'T remove this line | # 0440, 2022-03-31 08:14:37, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dnew = {} for i in d: if len(d[i]) > 1: dnew[i] = d[i] return dnew def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 dnew = {} for i in type1: dnew[i[0]] = [i[-1]] return dnew exec(input().strip()) # DON'T remove this line |
# 0441, 2022-03-31 08:04:31, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for e in d : if len(d[e])!=1 : r[e]=d[e] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0442, 2022-03-31 08:04:49, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for e in d : if len(d[e])!=1 : r[e]=d[e] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0443, 2022-03-31 08:05:11, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for e in d : if len(d[e])!=1 : r[e]=d[e] return r def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return [] exec(input().strip()) # DON'T remove this line |
# 0444, 2022-03-31 08:10:27, -- (0%) def remove_len1(d): new_d = dict() for i in d.keys(): if len(d[i]) > 1: new_d[i] = d[i] return new_d | # 0445, 2022-03-31 08:11:03, -- (0%) def remove_len1(d): new_d = dict() for i in d.keys(): if len(d[i]) > 1: new_d[i] = d[i] return new_d exec(input().strip()) # DON'T remove this line | # 0446, 2022-03-31 08:11:42, Px (50%) def remove_len1(d): new_d = dict() for i in d.keys(): if len(d[i]) > 1: new_d[i] = d[i] return new_d exec(input().strip()) # DON'T remove this line |
# 0447, 2022-03-31 08:12:32, -x (0%) def r(x) : a = {} for e in x : a[x[e]] = e return a def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x ={} for e in d : if len(d[e]) != 1 : x[e] = d[e] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = type1 c = [] a = {} for e in x : e.split(":") if e[0] not in c : c.append(e[0]) if e[1] not in c : c.append(e[1]) exec(input().strip()) | # 0448, 2022-03-31 08:14:22, -x (0%) def r(x) : a = {} for e in x : a[x[e]] = e return a def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for e in d : if len(d[e]) != 1 : x[e] = d[e] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = type1 c = [] a = {} for e in x : e.split(":") if e[0] not in c : c.append(e[0]) if e[1] not in c : c.append(e[1]) print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) exec(input().strip()) | # 0449, 2022-03-31 08:14:57, Px (50%) def r(x) : a = {} for e in x : a[x[e]] = e return a def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for e in d : if len(d[e]) != 1 : x[e] = d[e] return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = type1 c = [] a = {} for e in x : e.split(":") if e[0] not in c : c.append(e[0]) if e[1] not in c : c.append(e[1]) exec(input().strip()) |
# 0450, 2022-03-31 08:14:25, Px (50%) # [64_2_PCG_09] 64_2_09_Dict def remove_len1(d): result = {} for x in d: if len(d[x]) > 1: result[x] = d[x] return result def to_type2(type1): result = {} for x in type1: a, b = type1[x].split(':') if a in result: result[a] += b elif b in result: result[b] += a elif a not in result: result[a] = [b] elif b not in result: result[b] = [a] return result exec(input().strip()) | # 0451, 2022-03-31 08:14:59, P- (50%) # [64_2_PCG_09] 64_2_09_Dict def remove_len1(d): result = {} for x in d: if len(d[x]) > 1: result[x] = d[x] return result def to_type2(type1): result = {} for x in type1: a, b = x.split(':') if a in result: result[a] += b elif b in result: result[b] += a elif a not in result: result[a] = [b] elif b not in result: result[b] = [a] return result exec(input().strip()) | # 0452, 2022-03-31 08:15:49, P- (50%) # [64_2_PCG_09] 64_2_09_Dict def remove_len1(d): result = {} for x in d: if len(d[x]) > 1: result[x] = d[x] return result def to_type2(type1): result = {} for x in type1: a, b = x.split(':') if a in result: result[a] += [b] elif b in result: result[b] += [a] elif a not in result: result[a] = [b] elif b not in result: result[b] = [a] return result exec(input().strip()) |
# 0453, 2022-03-31 08:08:24, Px (50%) def remove_len1(d): ans = {} for c in d: if len(d[c]) != 1 : ans[c] = d[c] return ans exec(input().strip()) | # 0454, 2022-03-31 08:15:45, P- (50%) def remove_len1(d): ans = {} for c in d: if len(d[c]) != 1 : ans[c] = d[c] return ans def to_type2(type1): type2 = {} for a in type1: if a[0] not in type2: type2[a] = a elif a[0] in type2 : type2[a] += a elif a[2] not in type2: type2[a] = a elif a[2] in type2 : type2[a] += a return type2 exec(input().strip()) | # 0455, 2022-03-31 08:16:41, P- (50%) def remove_len1(d): ans = {} for c in d: if len(d[c]) != 1 : ans[c] = d[c] return ans def to_type2(type1): type2 = {} for a in type1: if a[0] not in type2: type2[a] = a[0] elif a[0] in type2 : type2[a] += a[0] elif a[2] not in type2: type2[a] = a[2] elif a[2] in type2 : type2[a] += a[2] return type2 exec(input().strip()) |
# 0456, 2022-03-31 08:11:28, xP (50%) def remove_len1(d): for k in d: if len(d[k]) == 1: d.pop(k) return d def to_type2(type1): resul = {} for i in range(len(type1)): a,b = type1[i].split(':') resul.setdefault(a,[]) resul.setdefault(b,[]) if a in resul: resul[a].append(b) if b in resul: resul[b].append(a) return resul exec(input().strip()) | # 0457, 2022-03-31 08:14:38, xP (50%) def remove_len1(d): for k in d: if len(d[k]) == 1: d.pop(k) return d def to_type2(type1): resul = {} for item in type1: a, b = item.split(":") resul.setdefault(a, []) resul[a].append(b) resul.setdefault(b, []) resul[b].append(a) return resul exec(input().strip()) | # 0458, 2022-03-31 08:15:10, xP (50%) def remove_len1(d): for k in d: if len(d[k]) == 1: d.pop(k) return d def to_type2(type1): result = {} for item in type1: x, y = item.split(":") result.setdefault(x, []) result[x].append(y) result.setdefault(y, []) result[y].append(x) return result exec(input().strip()) |
# 0459, 2022-03-31 08:04:56, Px (50%) def remove_len1(d): x={} for i in d: if len(d[i])>1: x[i]=d[i] return x exec(input().strip()) # DON'T remove this line | # 0460, 2022-03-31 08:14:42, P- (50%) def remove_len1(d): x={} for i in d: if len(d[i])>1: x[i]=d[i] return x def to_type2(type1): d={} d2={} dr={} for i in type1: a,b=i.split(":") d[a]=b d2[b]=a for i in d: k=[] try:k+=d.get(i) except:pass try:k+=d2.get(i) except:pass dr[i]=k for i in d2: k=[] try:k+=d.get(i) except:pass try:k+=d2.get(i) except:pass dr[i]=k return dr exec(input().strip()) # DON'T remove this line | # 0461, 2022-03-31 08:15:59, Px (50%) def remove_len1(d): x={} for i in d: if len(d[i])>1: x[i]=d[i] return x exec(input().strip()) # DON'T remove this line def to_type2(type1): d={} d2={} dr={} for i in type1: a,b=i.split(":") d[a]=b d2[b]=a for i in d: k=[] try:k+=d.get(i) except:pass try:k+=d2.get(i) except:pass dr[i]=k for i in d2: k=[] try:k+=d.get(i) except:pass try:k+=d2.get(i) except:pass dr[i]=k return dr |
# 0462, 2022-03-31 08:10:33, Px (50%) def remove_len1(d): d2 = {} for c in d: if len(d[c]) > 1: d2[c] = d[c] return d2 def to_type2(type1): type2 = {} for c in type1: if type1[c] in type2: type2[c] += tpye1[c] else: type2[c] = type1[c] return type2 exec(input().strip()) # DON'T remove this line | # 0463, 2022-03-31 08:14:25, P- (50%) def remove_len1(d): d2 = {} for c in d: if len(d[c]) > 1: d2[c] = d[c] return d2 def to_type2(type1): type2 = {} for c in type1: if c[0] in type2: type2[c[0]] += c[2] else: type2[c[0]] = c[2] return type2 exec(input().strip()) # DON'T remove this line | # 0464, 2022-03-31 08:15:14, P- (50%) def remove_len1(d): d2 = {} for c in d: if len(d[c]) > 1: d2[c] = d[c] return d2 def to_type2(type1): type2 = {} for c in type1: if c[0] in type2: type2[c[0]] += [c[2]] else: type2[c[0]] = [c[2]] return type2 exec(input().strip()) # DON'T remove this line |
# 0465, 2022-03-31 08:15:35, Px (50%) def remove_len1(d): n = {} for k in d: if len(d[k]) != 1: n[k] = d[k] return n exec(input().strip()) | # 0466, 2022-03-31 08:16:12, P- (50%) def remove_len1(d): n = {} for k in d: if len(d[k]) != 1: n[k] = d[k] return n def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans exec(input().strip()) |
# 0467, 2022-03-31 08:14:26, Px (50%) def remove_len1(d): b={} for i in d: if len(d[i]) >=2: b[i]=d[i] return b def to_type2(type1): d={} b=[] for i in type1: a=i.split(':') d[a[0]]=a[1:] exec(input().strip()) # DON'T remove this line | # 0468, 2022-03-31 08:15:50, P- (50%) def remove_len1(d): b={} for i in d: if len(d[i]) >=2: b[i]=d[i] return b def to_type2(type1): d={} b=[] for i in type1: a=i.split(':') d[a[0]]=a[1:] return(d) exec(input().strip()) # DON'T remove this line |
# 0469, 2022-03-31 08:13:12, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} nd = {} for e in d: if len(d[e])>1: nd[e] = d[e] return nd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for e in type1: e = e.split(':') if e[0] in type2: type2[e[0]] = type2[e[0]].append(e[1]) else: type2[e[0]] = [e[1]] if e[1] in type2: type2[e[1]] = type2[e[1]].append(e[0]) else: type2[e[1]] = [e[0]] return type2 exec(input().strip()) # DON'T remove this line | # 0470, 2022-03-31 08:15:04, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} nd = {} for e in d: if len(d[e])>1: nd[e] = d[e] return nd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for e in type1: e = e.split(':') if e[0] in type2: type2[e[0]] = type2[e[0]].append(e[1]) else: type2[e[0]] = [e[1]] if e[1] in type2: type2[e[1]] = type2[e[1]].append(e[0]) else: type2[e[1]] = [e[0]] return type2 exec(input().strip()) # DON'T remove this line |
# 0471, 2022-03-31 08:14:38, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} c = {} for e in d : if len(d[e]) > 1 : c[e] = d[e] return c def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = {} for e in type1 : e = e.split(':') x[e[0]] = [e[1]] if e[1] not in x : x[e[1]] = [] return x exec(input().strip()) # DON'T remove this line | # 0472, 2022-03-31 08:16:55, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} c = {} for e in d : if len(d[e]) > 1 : c[e] = d[e] return c def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x = {} l = [] for e in type1 : e = e.split(':') x[e[0]] = [e[1]] if e[1] not in x : x[e[1]] = [] if e[0] not in l : l.append(e[0]) if e[1] not in l : l.append(e[1]) for e in l : x[e].append(e) return x exec(input().strip()) # DON'T remove this line |
# 0473, 2022-03-31 08:12:49, P- (50%) def remove_len1(d): r = {} for key in d: if len(d[key]) != 1: r[key] = d[key] return r def to_type2(type1): d = {} for e in type1: a = e.split(':')[0] b = e.split(':')[-1] if a not in d: d[a] = [b] else: d[a].append(b) return d exec(input().strip()) | # 0474, 2022-03-31 08:15:13, -- (0%) def remove_len1(d): r = {} for key in d: if len(d[key]) != 1: r[key] = d[key] return r def to_type2(type1): d = {} for e in type1: a = e.split(':')[0] b = e.split(':')[-1] if a not in d: d[a] = [b] if b not in d: d[b] = [a] if a in d: d[a].append(b) if b in d: d[b].append(a) return d |
# 0475, 2022-03-31 08:03:48, compilation error (0%) def remove_len1(d): f = {} for i in d: if len(d[i])!=1: f[i] = d[i] return f def to_type2(type1): exec(input().strip()) # DON'T remove this line | # 0476, 2022-03-31 08:03:57, Px (50%) def remove_len1(d): f = {} for i in d: if len(d[i])!=1: f[i] = d[i] return f def to_type2(type1): pass exec(input().strip()) # DON'T remove this line |
# 0477, 2022-03-31 08:15:09, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} keys=list(d.keys()) for i in keys: if len(d[i])==1: del d[i] return d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2={} for i in type1: a1,a2=i.split(':') if a1 not in type2: type2[a1]=[a2] if a2 not in type2: type2[a2]=[a1] if a1 in type2: type2[a1].append(a2) if a2 in type2: type2[a2].append(a1) print(type2) return type2 exec(input().strip()) # DON'T remove this line | # 0478, 2022-03-31 08:15:19, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} keys=list(d.keys()) for i in keys: if len(d[i])==1: del d[i] return d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2={} for i in type1: a1,a2=i.split(':') if a1 not in type2: type2[a1]=[a2] if a2 not in type2: type2[a2]=[a1] if a1 in type2: type2[a1].append(a2) if a2 in type2: type2[a2].append(a1) return type2 exec(input().strip()) # DON'T remove this line |
# 0479, 2022-03-31 08:15:28, Px (50%) def remove_len1(d): D = {} for e in d : if len(d[e]) != 1 : D[e] = d[e] return D def to_type2(type1): type2 = {} for e in type1 : E += e.split(':') for e in E : type2[E[0]] = E[1] exec(input().strip()) | # 0480, 2022-03-31 08:16:16, Px (50%) def remove_len1(d): D = {} for e in d : if len(d[e]) != 1 : D[e] = d[e] return D def to_type2(type1): type2 = {} for e in type1 : E += e.split(':') for e in E : type2[E[0]] = E[1] return type2 exec(input().strip()) |
# 0481, 2022-03-31 08:14:49, compilation error (0%) def remove_len1(d): di = {} for key in d: if not len(d[key]) == 1: di[key] = d[key] return di def to_type2(type1): exec(input().strip()) # DON'T remove this line | # 0482, 2022-03-31 08:15:10, Px (50%) def remove_len1(d): di = {} for key in d: if not len(d[key]) == 1: di[key] = d[key] return di #def to_type2(type1): exec(input().strip()) # DON'T remove this line |
# 0483, 2022-03-31 08:13:53, Px (50%) def remove_len1(d): r = {} for k in d: if len(d[k]) != 1 : r[k] = d[k] return r exec(input().strip()) | # 0484, 2022-03-31 08:16:20, Px (50%) def remove_len1(d): r = {} for k in d: if len(d[k]) != 1 : r[k] = d[k] return r exec(input().strip()) |
# 0485, 2022-03-31 08:15:10, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} D = {} for e in d: if len(d[e]) != 1: D[e] = d[e] return D def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for e in type1: k, v = e.split(':') if k in type2 : type2[k].append([v]) else: type2[k] = [v] type2[v] = [k] return type2 exec(input().strip()) # DON'T remove this line | # 0486, 2022-03-31 08:15:35, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} D = {} for e in d: if len(d[e]) != 1: D[e] = d[e] return D def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for e in type1: k, v = e.split(':') if k in type2 : type2[k].append(v) else: type2[k] = [v] type2[v] = [k] return type2 exec(input().strip()) # DON'T remove this line |
# 0487, 2022-03-31 08:05:23, compilation error (0%) def remove_len1(d): s={} for key in d: if len(d[key])>1: s[key]=d[key] return s def to_type2(type1): exec(input().strip()) | # 0488, 2022-03-31 08:13:12, Px (50%) def remove_len1(d): s={} for key in d: if len(d[key])>1: s[key]=d[key] return s exec(input().strip()) |
# 0489, 2022-03-31 08:14:04, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for e in d: if len(d[e]) != 1: x[e] = d[e] return x input().strip()) # DON'T remove this line | # 0490, 2022-03-31 08:14:19, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} x = {} for e in d: if len(d[e]) != 1: x[e] = d[e] return x exec(input().strip()) |
# 0491, 2022-03-31 08:03:03, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} res = {} for k, v in d.items(): if len(v) > 1: res[k] = v return res def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0492, 2022-03-31 08:14:28, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} res = {} for k, v in d.items(): if len(v) > 1: res[k] = v return res def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} d1 = {} for i in type1: k, v = i.split(':') d1[k] = v for k in d1: lst = [] for k1, v1 in d1.items(): if k1 == k: lst.append(v1) if v1 == k: lst.append(k1) d[k] = lst return d exec(input().strip()) # DON'T remove this line |
# 0493, 2022-03-31 08:08:22, Px (50%) def remove_len1(d): a = {} for k in d: if len(d[k]) >= 2: a[k] = d[k] return a def to_type2(type1): return exec(input().strip()) # DON'T remove this line | # 0494, 2022-03-31 08:13:59, P- (50%) def remove_len1(d): a = {} for k in d: if len(d[k]) >= 2: a[k] = d[k] return a def to_type2(type1): re = {} for k in type1: a,b = k.split(':') re[a] = b return re exec(input().strip()) # DON'T remove this line |
# 0495, 2022-03-31 08:03:47, -- (0%) def remove_len1(d): z = {} for e in d : if len(d[e]) != 1 : z[e] = d[e] return z | # 0496, 2022-03-31 08:04:11, Px (50%) def remove_len1(d): z = {} for e in d : if len(d[e]) != 1 : z[e] = d[e] return z exec(input().strip()) |
# 0497, 2022-03-31 08:13:59, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} newd={} for i in d: if len(d[i])>1: newd[i]=d[i] return newd def to_type2(type1): newd={} for i in type1: if i not in newd: newd[i]=type1[i] try: if type1[i] in newd: newd[type1[i]].append(i) else: newd[type1[i]]=i return newd exec(input().strip()) # DON'T remove this line | # 0498, 2022-03-31 08:14:16, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} newd={} for i in d: if len(d[i])>1: newd[i]=d[i] return newd exec(input().strip()) # DON'T remove this line |
# 0499, 2022-03-31 08:12:04, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic ={} for k in d: if len(d[k])>1: dic[k] = d[k] return dic def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0500, 2022-03-31 08:12:12, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic ={} for k in d: if len(d[k])>1: dic[k] = d[k] return dic def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line |
# 0501, 2022-03-31 08:02:42, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t = dict() for key in d: if len(d[key]) !=0: t[key] = d[key] else: pass def to_type2(type1):pass # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0502, 2022-03-31 08:03:32, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t = dict() for key in d: if len(d[key]) !=1: t[key] = d[key] else: pass return t def to_type2(type1):pass # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0503, 2022-03-31 08:11:04, Px (50%) def remove_len1(d): di = {} for key in d: if len(d[key]) != 1: di[key] = d[key] return di def to_type2(type1): l = [] d = {} rdi = {} di = {} for i in type1: x1,x2 = i.split(':') if x1 not in l: l.append(x1) if x2 not in l: l.append(x2) di[x1] = x2 rdi[x2] = x1 l.sort() for key in l: l2 = [] if key in di: if di[key] not in l2: l2.append(di[key]) elif key in rdi: if rdi[key] not in l2: l2.append(di[key]) d[key] = l2 return d exec(input().strip()) | # 0504, 2022-03-31 08:15:23, P- (50%) def remove_len1(d): di = {} for key in d: if len(d[key]) != 1: di[key] = d[key] return di def to_type2(type1): l = [] d = {} rdi = {} di = {} for i in type1: x1,x2 = i.split(':') if x1 not in l: l.append(x1) if x2 not in l: l.append(x2) di[x1] = x2 rdi[x2] = x1 l.sort() for key in l: l2 = [] if key in di: if di[key] not in l2: l2.append(di[key]) if key in di.values(): if key not in l2: l2.append(key) d[key] = l2 return d exec(input().strip()) |
# 0505, 2022-03-31 08:12:11, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} l={} for i in d: if len(d[i])!=1: l[i]=d[i] return l def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} y={} for a in type1: i= a.split(':') x[i[0]]=i[1] y[i[0]]=i[1] ans={} for b in type1: j = b.split(':') l=[] if j[0] in x: l.append(x[j[0]]) elif j[0] in y: l.append(y[j[0]]) ans[j[0]]=l return ans exec(input().strip()) # DON'T remove this line | # 0506, 2022-03-31 08:15:50, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} l={} for i in d: if len(d[i])!=1: l[i]=d[i] return l def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 x={} y={} for a in type1: i= a.split(':') x[i[0]]=i[1] y[i[0]]=i[1] ans={} for b in type1: j = b.split(':') l=[] for c in x: if j[0]== c: l.append(x[j[0]]) for d in y: if j[0] == d: l.append(y[j[0]]) ans[j[0]]=l return ans exec(input().strip()) # DON'T remove this line |
# 0507, 2022-03-31 08:05:27, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} re = {} for ch in d : if len(d[ch]) != 1 : re[ch] = d[ch] else : pass return re def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0508, 2022-03-31 08:06:31, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} re = {} for ch in d : if len(d[ch]) != 1 : re[ch] = d[ch] else : pass return re def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return None exec(input().strip()) # DON'T remove this line |
# 0509, 2022-03-31 08:15:12, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} k = {} for key in d: if len(d[key]) > 1: k[key] = d[key] return k def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 k = {} for i in range(len(type1)): k[x[i][0]] = x[i][2] return k exec(input().strip()) # DON'T remove this line | # 0510, 2022-03-31 08:15:56, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} k = {} for key in d: if len(d[key]) > 1: k[key] = d[key] return k def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 k = {} for i in range(len(type1)): k[x[i][0]] = [x[i][2]] return k exec(input().strip()) # DON'T remove this line |
# 0511, 2022-03-31 08:16:01, -x (0%) def remove_len1(d): dictt = {} for e in d: if len(d[e]) > 1: dictt[e] = d[e] return dictt print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): D = {} ANS = {} for e in type1:#หยิบคีย์แต่ละตัวในดิกของ d มา one,two = e.split(":") D[one] = [two] for e in D: if e not in ANS: ANS[e] = D[E] else: ANS return D exec(input().strip()) # DON'T re | # 0512, 2022-03-31 08:16:14, Px (50%) def remove_len1(d): dictt = {} for e in d: if len(d[e]) > 1: dictt[e] = d[e] return dictt #print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): D = {} ANS = {} for e in type1:#หยิบคีย์แต่ละตัวในดิกของ d มา one,two = e.split(":") D[one] = [two] for e in D: if e not in ANS: ANS[e] = D[E] else: ANS return D exec(input().strip()) # DON'T re |
# 0513, 2022-03-31 08:14:46, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} c={} for i in d: k=d[i] if len(k)!=1: c[i]=k return c def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) | # 0514, 2022-03-31 08:15:17, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} c={} for i in d: k=d[i] if len(k)!=1: c[i]=k return c exec(input().strip()) |
# 0515, 2022-03-31 08:12:44, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = {} for i in d: if i in d and len(d[i])>1: new[i] = d[i] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ k = {} for i in type1: li = [] for ee in type1[i]: if i not in li and i: return [] exec(input().strip()) # DON'T remove this line | # 0516, 2022-03-31 08:15:57, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = {} for i in d: if i in d and len(d[i])>1: new[i] = d[i] return new def to_type2(type1): return [] exec(input().strip()) # DON'T remove this line |
# 0517, 2022-03-31 08:09:36, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for k in d: if len(d[k])!=1: dd[k]=d[k] return dd | # 0518, 2022-03-31 08:14:48, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dd = {} for k in d: if len(d[k])!=1: dd[k]=d[k] return dd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 sd = {} for k in type1: if k not in sd: sd[k] = [sd[k]] if sd[k] not in sd: sd[sd[k]] = [k] if k in sd: sd[k].append(sd[k]) if sd[k] in sd: sd[sd[k]].append(k) return sd exec(input().strip()) |
# 0519, 2022-03-31 08:14:10, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for e in d: if len(d[e]) > 1: ans[e] = d[e] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for e in type1: e = e.split(':') if e[0] not in ans: ans[e[0]].append(e[1]) else: ans[e[0]].append(e[1]) if e[1] not in ans: ans[e[1]].append(e[0]) else: ans[e[1]].append(e[0]) return ans exec(input().strip()) # DON'T remove this line | # 0520, 2022-03-31 08:14:49, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for e in d: if len(d[e]) > 1: ans[e] = d[e] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for e in type1: e = e.split(':') if e[0] not in ans: ans[e[0]].append(e[1]) else: ans[e[0]].append(e[1]) if e[1] not in ans: ans[e[1]].append(e[0]) else: ans[e[1]].append(e[0]) return ans exec(input().strip()) # DON'T remove this line |
# 0521, 2022-03-31 08:15:56, xx (0%) def remove_len1(d): d1 = {} for key in d : if len(d[key]) > 1 : new_d[key] = d[key] return d1 exec(input().strip()) # DON'T remove this line | # 0522, 2022-03-31 08:16:20, Px (50%) def remove_len1(d): d1 = {} for key in d : if len(d[key]) > 1 : d1[key] = d[key] return d1 exec(input().strip()) # DON'T remove this line |
# 0523, 2022-03-31 08:15:30, Px (50%) def remove_len1(d): ans = {} for k in d.keys(): if len(d[k]) != 1: ans[k] = d[k] return ans def to_type2(type1): new = {} for i in type1: k,v = i.split(':') if i1 in d.keys(): d[k].append(v) else: d[k] = [v] if i2 in d.keys(): d[v].append(k) else: d[v] = [k] return new exec(input().strip()) | # 0524, 2022-03-31 08:16:06, Px (50%) def remove_len1(d): ans = {} for k in d.keys(): if len(d[k]) != 1: ans[k] = d[k] return ans def to_type2(type1): new = {} for i in type1: k,v = i.split(':') if i1 in d.keys(): new[k].append(v) else: new[k] = [v] if i2 in d.keys(): new[v].append(k) else: new[v] = [k] return new exec(input().strip()) |
# 0525, 2022-03-31 08:04:33, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for i in d: if len(d[i])>1: out[i] = d[i] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out = {} for i in type1: if i in out: out[i] += [type1[i]] else: out[i] = [type1[i]] return out exec(input().strip()) # DON'T remove this line | # 0526, 2022-03-31 08:16:20, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for i in d: if len(d[i])>1: out[i] = d[i] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out = {} for i in type1: if i in out: out[i] += [type1[i]] else: out[i] = [type1[i]] return out exec(input().strip()) # DON'T remove this line |
# 0527, 2022-03-31 08:11:05, -- (0%) def remove_len1(d): a ={} for key in d: if len(d[key])>1: a[key] = d[key] return a remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) | # 0528, 2022-03-31 08:14:22, Px (50%) def remove_len1(d): a ={} for key in d: if len(d[key])>1: a[key] = d[key] return a remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) exec(input().strip()) |
# 0529, 2022-03-31 08:15:26, -- (0%) def remove_len1(d): out = {} for k in d : if len(d[k]) > 1 : out[k] = d[k] return out def to_type2(type1): out = {} q = [] for k in type1: q.append(k,type1[k]) return q | # 0530, 2022-03-31 08:15:42, Px (50%) def remove_len1(d): out = {} for k in d : if len(d[k]) > 1 : out[k] = d[k] return out def to_type2(type1): out = {} q = [] for k in type1: q.append(k,type1[k]) return q exec(input().strip()) |
# 0531, 2022-03-31 08:12:49, Px (50%) def remove_len1(d): l={} for i in d: if len(d[i]) > 1: l.update({str(i):d[i]}) return l exec(input().strip()) | # 0532, 2022-03-31 08:15:57, P- (50%) def remove_len1(d): l={} for i in d: if len(d[i]) > 1: l.update({str(i):d[i]}) return l def to_type2(type1): l={} for i in range(len(type1)): k=type1[i].split(':') if k[0] not in l: l.update({k[0]:k[1]}) else: l.update({k[0]: k[1]}) return l exec(input().strip()) |
# 0533, 2022-03-31 08:12:04, Px (50%) def remove_len1(d): op = {} for i in d: if len(d[i]) != 1: op.update({i: d[i]}) return op # def to_type2(type1): # op = {} # for i in type1: # if i not in list(op.values()) or i not in list(op.keys()): # op[i] = exec(input().strip()) | # 0534, 2022-03-31 08:16:32, P- (50%) def remove_len1(d): op = {} for i in d: if len(d[i]) != 1: op.update({i: d[i]}) return op def to_type2(type1): op = {} for i in type1: if i not in list(op.keys()): op[i] = i return op exec(input().strip()) |
# 0535, 2022-03-31 08:12:32, Px (50%) def remove_len1(d): a = {} for key in d: if len(d[key]) > 1: a[key] = d[key] return a exec(input().strip()) | # 0536, 2022-03-31 08:14:47, Px (50%) def remove_len1(d): a = {} for key in d: if len(d[key]) > 1: a[key] = d[key] return a exec(input().strip()) |
# 0537, 2022-03-31 08:14:16, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if len(d[i]) != 1: ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = type1 type3 = {} for i in type1: type2[i[0]] = i[2] for i in type2: s = type2.get(i) type3[i] += [s] return type3 exec(input().strip()) # DON'T remove this line |
# 0538, 2022-03-31 08:13:12, Px (50%) def remove_len1(d): x={} for i in d: if len(d[i])>1: x[i]=d[i] return x exec(input().strip()) |
# 0539, 2022-03-31 08:15:12, P- (50%) def remove_len1(d): ans = {} for key in d: if len(d[key]) != 1: ans[key] = d[key] return ans def to_type2(type1): ans = {} q = [] r ={} for ch in type1: x = ch.split(':') q.append(x) for e in q: ans[e[0]] = e[1] return ans exec(input().strip()) |
# 0540, 2022-03-31 08:07:26, Px (50%) def remove_len1(d): r = {} for x in d: if len(d[x]) != 1: r[x] = d[x] return r exec(input().strip()) # DON'T remove this line |
# 0541, 2022-03-31 08:15:52, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} newd={} for i in d: if len(d[i])==1 or len(d[i])==0: pass else: newd[i]=d[i] return newd def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2={} for i in type1: new=i.split(":") if new[0] not in type2: type2[new[0]]=new[1] else: type2[new[0]]=type2[new[0]].append(new[1]) return type2 exec(input().strip()) # DON'T remove this line |
# 0542, 2022-03-31 08:14:05, Px (50%) def remove_len1(d): h = {} for t in d: if len(d[t]) < 2: continue else: h[t] = d[t] return h def to_type2(type1): r =[] r2 = [] for e in type1: e.split(':') r.append([e[0],e[1]]) r2.append([e[1],e[0]]) al = [] for t in r: al.append(t[0]) for u in r2: if u not in al: al.append(u) return al exec(input().strip()) |
# 0543, 2022-03-31 08:04:34, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for x in d : if len(d[x]) > 1 : a[x] = d[x] return a #def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0544, 2022-03-31 08:13:12, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d: if len(d[i])>1: ans[i]=d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for i in type1: i=i.split(":") ans[i[0]]=i[1::] return ans exec(input().strip()) # DON'T remove this line |
# 0545, 2022-03-31 08:06:05, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for value in d: if len(d[value]) != 1: out[value] = d[value] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return None exec(input().strip()) # DON'T remove |
# 0546, 2022-03-31 08:13:02, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} new = {} for k in d: if len(d[k]) > 1: new[k] = d[k] return new def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line |
# 0547, 2022-03-31 08:12:41, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for i in d: if len(d[i]) >= 2: a[i] = d[i] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 c = [] for i in type: a,b = i.split(':') c.append([b,a]) return exec(input().strip()) # DON'T remove this line |
# 0548, 2022-03-31 08:14:17, Px (50%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1: a[i] = d[i] return a exec(input().strip()) # DON'T remove this line |
# 0549, 2022-03-31 08:14:23, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d2 = {} for k in d: if len(d[k]) > 1: d2[k] = d[k] return d2 exec(input().strip()) |
# 0550, 2022-03-31 08:14:24, Px (50%) def remove_len1(d): s={} for i in d : if len(d[i])>1: s[i]=d[i] return s def to_type2(type1): s={} for i in type1: if i in type1[i]: s[i]=type1[i] return s exec(input().strip()) # DON'T remove this line |
# 0551, 2022-03-31 08:10:24, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for a,b in d.items(): if len(b)>1: ans[a]=b return ans exec(input().strip()) |
# 0552, 2022-03-31 08:12:32, Px (50%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1: a[i] = d[i] return a exec(input().strip()) |
# 0553, 2022-03-31 08:07:09, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} Ans ={} for ch in d: if len(d[ch]) != 1: Ans[ch]=d[ch] return Ans def to_type2(type1):pass # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0554, 2022-03-31 08:06:38, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} t = {} for i in d: if len(d[i]) > 1: t[i] = d[i] return t #def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0555, 2022-03-31 08:14:12, Px (50%) def remove_len1(d): r = {} for e in d : if len(d[e]) > 1 : r[e] = d[e] return r exec(input().strip()) |
# 0556, 2022-03-31 08:14:53, P- (50%) def remove_len1(d): notlen1 = {} for k,v in d.items(): if len(v) > 1: notlen1[k] = v return notlen1 def to_type2(type1): type2 = {} for e in type1: split = e.split(":") type2[split[0]] = [split[1]] return type2 exec(input().strip()) |
# 0557, 2022-03-31 08:13:11, Px (50%) def remove_len1(d): a = {} for i in d: if len(d[i]) >= 2: a[i] = d[i] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = {} for i in type1: x,y = i.split(':') a[x] = y exec(input().strip()) |
# 0558, 2022-03-31 08:08:43, Px (50%) def remove_len1(d): removed = {} for key in d: if len(d[key]) != 1: removed[key] = d[key] return removed exec(input().strip()) |
# 0559, 2022-03-31 08:16:28, Px (50%) def remove_len1(d): s = {} for e in d: if len(d[e]) != 1 : s[e] = d[e] return s def to_type2(type1): s = {} for p in type1: e1 = e.split(':') if e1[0] in s: s[e1[0]].append(e1[1]) elif e1[0] not in s: s[e1[0]] = [e1[1]] if e1[1] in s: s[e1[1]].append(e1[0]) elif e1[1] not in s: s[e1[1]] = [e1[0]] return s exec(input().strip()) |
# 0560, 2022-03-31 08:08:33, Px (50%) def remove_len1(d): ans = {} for k,v in d.items(): if len(v) == 1: continue else: ans.update({k:v}) return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line |
# 0561, 2022-03-31 08:14:29, Px (50%) def remove_len1(d): l = {} for e in d: if len(d[e]) != 1: l[e] = d[e] return l exec(input().strip()) # DON'T remove this line |
# 0562, 2022-03-31 08:13:51, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} op = {} data = [] for i in d : for j in [d[i]]: k = len(j) if k != 1 : op[i] = d[i] return op exec(input().strip()) # DON'T remove this line |
# 0563, 2022-03-31 08:15:26, Px (50%) def remove_len1(d): a = {} for e in d: if len(d[e])!=1: a[e] = d[e] return a def to_type2(type1): x = [] for e in type1: a = e.split(':') x.append(a) type2 = {} for i in x: if x[i][0] not in x: type2[x[i][0]] = [x[i][1]] elif x[i][1] not in x: type2[x[i][1]] = [x[i][0]] elif x[i][1] in x: type2[x[i][1]].append(x[i][0]) else: type2[x[i][0]].append(x[i][1]) return type2 exec(input().strip()) |
# 0564, 2022-03-31 08:13:22, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} p={} for i in d: if len(d[i])>1: p[i]=d[i] return p def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 k={} o={} for i in type1: a=i.split(':') o[a[0]]=a[1] for i in o: k[i]=[o[i]] for i in o: if o[i] in k: if i not in k[i]: k[i].append(i) return k exec(input().strip()) # DON'T remove this line |
# 0565, 2022-03-31 08:14:30, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d2 = {} for e in d: if len(d[e]) != 1: d2[e] = d[e] return d2 exec(input().strip()) # DON'T remove this line |
# 0566, 2022-03-31 08:13:07, Px (50%) def remove_len1(d): r = {} for key in d: if len(d[key]) !=1: r[key] = d[key] return r def to_type2 (type1): pass exec(input().strip()) # DON'T remove this line |
# 0567, 2022-03-31 08:14:13, P- (50%) def remove_len1(d): p={} for i in d: if len(d[i]) > 1: p[i] = d[i] return p def to_type2(type1): p={} for i in type1: key = i[0] value = i[2] if key not in p: p[key] = [value] p[value] = [key] elif key in p: if value not in p[key]: p[key].append(value) return p exec(input().strip()) # DON'T remove this line |
# 0568, 2022-03-31 08:12:27, P- (50%) def remove_len1(d): a = {} for i in d: if len(d[i])!=1: a[i]=d[i] return a def to_type2(type1): a={} for i in type1: b,c = i.split(':') a[b] = c a2 = {} for i in a: a2[a[i]] = i for i in a: a[i] = list(a[i]) for i in a2: if i in a: a[i].append(a2[i]) return a exec(input().strip()) # DON'T remove this line |
# 0569, 2022-03-31 08:12:45, P- (50%) def remove_len1(d): x={} for e in d: if len(d[e])!=1: x[e]=d[e] return x def to_type2(type1): x={} y={} for i in range(len(type1)): t1,t2=type1[i].split(":") y[t1]=t2 for e in y: if e not in x: x[e]=[y[e]] else: x[e].append(y[e]) if y[e] not in x: x[y[e]]=[e] else: x[y[e]].append(e) return x exec(input().strip()) |
# 0570, 2022-03-31 08:14:06, P- (50%) def remove_len1(d): z = {} for k in d: if len(d[k]) != 1: z[k] = d[k] return z def to_type2(type1): z = {} type2 = {} for k in type1: x,y = k.split(":") type2[x] = y for k in type2: z[k] = [type2[k]] return z exec(input().strip()) |
# 0571, 2022-03-31 08:15:06, P- (50%) def remove_len1(d): x = {} for e in d: if len(d[e])>1: x[e] = d[e] return x def to_type2(type1): x,a = {},[] for e in type1: b = e.split(':') if b[0] not in x: x[b[0]] = [] if b[1] not in x: x[b[1]] = [] for r in type1: b = e.split(':') if x[b[1]] == b[0]: x[b[1]].append(b[0]) if x[b[0]] == b[1]: x[b[0]].append(b[1]) return x exec(input().strip()) |
# 0572, 2022-03-31 08:05:52, Px (50%) def remove_len1(d): out = {} for key in d: if len(d[key]) > 1: out[key] = d[key] return out exec(input().strip()) # DON'T remove this line |
# 0573, 2022-03-31 08:16:23, P- (50%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans exec(input().strip()) # DON'T remove this line |
# 0574, 2022-03-31 08:12:01, Px (50%) def remove_len1(d): rem = {} for e in d: if len(d[e]) > 1: rem[e] = d[e] return rem def to_type2(type1): tot = [] for e in type1: a = e.split(':') tot.append(a) return tot exec(input().strip()) # DON'T remove this line |
# 0575, 2022-03-31 08:11:59, Px (50%) def remove_len1(d): ans = {} for i in d: if len(d[i])!=1: ans[i]=d[i] return ans def to_type2(type1): ans = {} for i in range(len(type1)): x = type[i].split(":") for k in range(len(x)): if x[k] not in ans: ans[x[k]] = [x[k-1]] else: ans[x[k]].append(x[k-1]) return ans exec(input().strip()) |
# 0576, 2022-03-31 08:15:47, Px (50%) def remove_len1(d) : S ={} for e in d: if len(d[e]) == 1 : pass else : S[e] = d[e] return S def to_type2(type1) : A = type1 B =[] S = [] for e in A : S.append([A[e],e]) B.append([e,A[e]]) return S exec(input().strip()) |
# 0577, 2022-03-31 08:14:00, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } new={} for i,j in d.items(): if len(j) != 1: new[i]=j return new #print(remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']})) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 ans={} for i in type1: i=i.split(':') val=[] val.append(i[1]) ans.update({i[0]:val}) return ans exec(input().strip()) |
# 0578, 2022-03-31 08:04:31, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} re = {} for i in d: if len(d[i]) > 1: re[i] = d[i] return re def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ... exec(input().strip()) # DON'T remove this line |
# 0579, 2022-03-31 08:14:23, P- (50%) def remove_len1(d): n = {} for k in d: if (k in d): if (len(d[k]) != 1): n[k] = d[k] return n def to_type2(type1): n = {} for k in type1: x = k.split(':') if k in n: n[x[0]] += [x[1]] else: n[x[0]] = [x[1]] return n exec(input().strip()) # DON'T remove this line |
# 0580, 2022-03-31 08:16:31, Px (50%) def remove_len1(d): list1 = [] list2 = [] dic2 = {} for i in d: if len(d[i]) != 1: dic2[i] = d[i] return dic2 def to_type2(type1): return exec(input().strip()) # DON'T remove this line |
# 0581, 2022-03-31 08:14:54, P- (50%) def remove_len1(d): o = {} for i in d : if len(d[i]) != 1 : o[i] = d[i] return o def to_type2(type1): o = {} l = [] for i in type1 : i = i.split(":") if i[0] not in l : l.append(i[0]) if i[1] not in l : l.append(i[1]) lio = ["*"]*len(l) for e in range (len(l)) : for i in type1 : if e == i[1] : lio[e].append(i[0]) elif e == i[0] : lio[e].append(i[1]) for e in l: o[e] = lio return o exec(input().strip()) # DON'T remove this line |
# 0582, 2022-03-31 08:15:01, Px (50%) def remove_len1(d): dd = [] for key in d: if len(d[key]) > 1: dd.append([key,d[key]]) ddd = {} for i in range(len(dd)): ddd[dd[i][0]] = dd[i][1] return ddd exec(input().strip()) |
# 0583, 2022-03-31 08:09:53, Px (50%) def remove_len1(d): re={} for i in d : if len(d[i]) != 1: re[i]=d[i] return re def to_type2(type1): d={} for e in type1: None return exec(input().strip()) # DON'T remove this line |
# 0584, 2022-03-31 08:14:56, Px (50%) def remove_len1(d): finish_dict = {} for key in d: if len(d[key]) != 1: finish_dict[key] = d[key] return finish_dict def to_type2(type1): all = [] type2 = {} for i in range(len(type1)): all.append(type1[i].split(':')) for i in range(len(all)): type2[all[i][0]] = all[i][1] for e in all: if all[i][0] in e: type2[all[i][0]] += e[e.index[all[i][0]]] return type2 exec(input().strip()) # DON'T remove this line |
# 0585, 2022-03-31 08:14:31, P- (50%) def remove_len1(d): D = {} for i in d: if len(d[i]) > 1: D[i] = d[i] return D def to_type2(type1): D = {}; t2 = {} for i in type1: a = i.split(':') t2[a[0]] = a[1] for i in t2: if i not in D: D[i] = [] for e in t2: if i == e: D[i] += [t2[e]] elif i == t2[e]: D[i] += [e] return D exec(input().strip()) |
# 0586, 2022-03-31 08:15:05, P- (50%) def remove_len1(d): d1 = {} for key in d: if len(d[key])!=1: d1[key] = d[key] return d1 def to_type2(type1): type2 = {} for e in type1: e = e.split(':') type2[e[0]] = [e[1]] for key in type2: for e in type1: e = e.split(':') if key==e[0]: if e[1] not in type2[key]: type2[e[0]] += [e[1]] elif key==e[1]: if e[0] not in type2[key]: type2[e[1]] += [e[0]] return type2 exec(input().strip()) |
# 0587, 2022-03-31 08:10:05, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for e in d: if len(d[e])>1: ans[e]=d[e] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 retype1={} for e in type1: retype1[type1[e]]=e exec(input().strip()) # DON'T remove this line |
# 0588, 2022-03-31 08:04:44, Px (50%) def remove_len1(d): a = {} for i in d: if len(d[i]) > 1: a[i] = d[i] return a exec(input().strip()) |
# 0589, 2022-03-31 08:14:54, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for i in d: if len(d[i]) > 1: s[i] = d[i] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่างๆ ในแบบที่ 2 s = {} for i in type1: if i not in s: a = [] a.append(type1[i]) if type1[i] in type1: a.append(type1[type1[i]]) s[i] = a return s exec(input().strip()) # DON'T remove this line |
# 0590, 2022-03-31 08:14:51, Px (50%) def remove_len1(d): k = sorted(d) for e in k: if e in d: if len(d[e]) == 1: d.pop(e) return d def to_type2(type1): dict = {} for e in type1: if type1[e] in type1: if len(e) >= 2: for x in e: dict[type1[x]] = x else: dict[type1[e]] = e if e in type1: dict[e] = type1[e] return dict #print(to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])) exec(input().strip()) |
# 0591, 2022-03-31 08:12:41, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for e in d: if len(d[e]) > 1: s[e] = d[e] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 result = {} for e in type1: e = e.split(':') if e[0] in result: result[e[0]].append(e[1]) else: result[e[0]] = [e[1]] return result exec(input().strip()) # DON'T remove this line |
# 0592, 2022-03-31 08:14:51, P- (50%) def remove_len1(d): result = {} for i in d : if len(d[i]) > 1 : result[i] = d[i] return result def to_type2(type1): result = {} for i in type1 : if i not in result : result[i] = [] elif i in result : result[i].append(type1[i]) result[type1[i]].append(i) return result exec(input().strip()) # DON'T remove this line |
# 0593, 2022-03-31 08:12:59, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} c={} for e in d: if len(d[e])>1: c[e]=d[e] return c exec(input().strip()) # DON'T remove this line |
# 0594, 2022-03-31 08:13:46, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']}\ d1 = {} for k,v in d.items(): if len(v) > 1: d1[k] = v return d1 def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d1 = {} t = [] for i in range(len(type1)): a,b = type1[i].split(':') t.append([a,b]) t.append([b,a]) for i in range(len(t)): if t[i][0] not in d1: d1[t[i][0]] = [t[i][1]] else: d1[t[i][0]] += [t[i][1]] return d1 exec(input().strip()) # DON'T remove this line |
# 0595, 2022-03-31 08:15:42, Px (50%) def remove_len1(d) : dd = {} for key in d : if d.get(key) : len_value = len(d.get(key)) else : len_value = 0 if len_value != 1 : dd[key] = d.get(key) else : pass return dd def to_type2(type1) : dd = {} for l in type1 : for ll in l: for p1, p2 in ll.split(":"): if p1 not in dd : dd[p1] = [p2] else : dd[p1].append(p2) return dd exec(input().strip()) |
# 0596, 2022-03-31 08:15:51, Px (50%) def remove_len1(d): a = {} for e in d: if len(d[e]) > 1: a[e] = d[e] return a exec(input().strip()) # DON'T remove this line |
# 0597, 2022-03-31 08:15:30, P- (50%) def remove_len1(d): a = {} for x in d : if len(d[x]) > 1 : a[x] = d[x] return a def to_type2(type1): b = {} for x in type1 : n = x.split(':') for i in n : b[i] = [] for i in n : b[i] += [n] return b exec(input().strip()) |
# 0598, 2022-03-31 08:12:12, P- (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} done = {} for i in d: if len(d[i]) != 1: done[i] = d[i] return done def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 done = {} dicttype = {} for e in type1: f= e.split(':') dicttype[f[0]] = f[1] for i in dicttype: if i not in done: done[i] = [dicttype[i]] else: done[i].append(dicttype[i]) reverse = {} for k in dicttype: reverse[dicttype[k]]=k for i in reverse: if i not in done: done[i] = [reverse[i]] else: done[i].append(reverse[i]) return done exec(input().strip()) # DON'T remove this line |
# 0599, 2022-03-31 08:11:36, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for c in d: if len(d[c])>1: a[c]=d[c] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 a = [] for x in type1: if x not in a: a.append(x) for y in type1: if y not in a: a.append(y) return exec(input().strip()) # DON'T remove this line |
# 0600, 2022-03-31 08:13:32, P- (50%) def remove_len1(d): ans = {} for e in d: if len(d[e]) > 1: ans[e] = d[e] return ans def to_type2(type1): d = {} for t in type1: d[t[0]] = t[2] return d exec(input().strip()) |
# 0601, 2022-03-31 08:05:41, Px (50%) def remove_len1(d): out={} for e in d: if len(d[e])!=1: out[e]=d[e] return out def to_type2(type1): pass exec(input().strip()) |
# 0602, 2022-03-31 08:16:53, Px (50%) def remove_len1(d): '''for i,j in d.items(): print(len(i)) if len(j) == 1: try: del d[i] except: continue''' '''delete = [key for i,key in d if len(key) == 1] for key in delete: del d[key]''' delete = [] for key, val in d.items(): if len(val) == 1: delete.append(key) for i in delete: del d[i] return(d) exec(input().strip()) # DON'T remove this line |
# 0603, 2022-03-31 08:04:51, Px (50%) def remove_len1(d): result={} for per in d: if len(d[per]) != 1: result[per] = d[per] return result def to_type2(type1): pass exec(input().strip()) # DON'T remove this line |
# 0604, 2022-03-31 08:14:35, Px (50%) def remove_len1(d): dic = {} for e in d: if len(d[e]) != 1: dic[e] = d[e] else: pass return dic exec(input().strip()) |
# 0605, 2022-03-31 08:07:04, Px (50%) def remove_len1(d): results = dict() for k in d.keys() : if len(d[k]) > 1 : results[k] = d[k] return results #def to_type2(type1): exec(input().strip()) # DON'T remove this line |
# 0606, 2022-03-31 08:11:22, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for e in d: if len(d[e])>1: ans[e]=d[e] return ans exec(input().strip()) |
# 0607, 2022-03-31 08:16:06, P- (50%) def remove_len1(d): s = {} for i in d : if len(d[i]) != 1 : s[i] = d[i] return s def to_type2(type1): s1 = [] s2 = [] s3 = {} for i in type1 : a,b = i.split(':') s1.append(a) s2.append(b) if a not in s3: s3[a] = [] if b not in s3: s3[b] = [] for i in s3 : if i in s1 and i not in s3[i]: s3[i].append(s2[s1.index(i)]) if i in s2 and i not in s3[i]: s3[i].append(s1[s2.index(i)]) return s3 exec(input().strip()) # DON'T remove this line |
# 0608, 2022-03-31 08:14:41, Px (50%) def remove_len1(d): out = {} for e in d : if len(d[e]) ==1 : pass else : out[e] = d[e] return out exec(input().strip()) |
# 0609, 2022-03-31 08:13:58, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dicts = {} for i in d: if len(d[i]) != 1 : dicts[i] = d[i] return dicts exec(input().strip()) # DON'T remove this line |
# 0610, 2022-03-31 08:14:20, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for x in d: if(len(d[x])>1): dic[x] = d[x] return dic def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 t2 = {} for x in type1: f,s = x.split(":") exec(input().strip()) # DON'T remove this line |
# 0611, 2022-03-31 08:15:24, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} b={} for a in d: if len(d[a])>1: b[a]=d[a] return b def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 c={} for a in range(len(type1)): if a in c: if b in c: d=type1[a].split(":") c[1]=type1[1] print(d) exec(input().strip()) # DON'T remove this line |
# 0612, 2022-03-31 08:15:21, Px (50%) def remove_len1(d): w_final={} for i in d: w= d[i] if len(w) !=1: w_final[i]=w return(w_final) exec(input().strip()) |
# 0613, 2022-03-31 08:14:49, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} f = {} for e in d: if len(d[e]) > 1 : f[e] = d[e] return f def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 u = {} for e in range(len(type1)): if type[e].split(':')[0] not in u: u[type[e].split(':')[0]] = [] if type[e].split(':')[1] not in u: u[type[e].split(':')[1]] = [] return u exec(input().strip()) # DON'T remove this line |
# 0614, 2022-03-31 08:12:23, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out={} for key in d: if len(d[key])!=1: out[key]=d[key] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out={} for e in type1: e.split(':') if e[0] not in out: out[e[0]]=e[1] exec(input().strip()) # DON'T remove this line |
# 0615, 2022-03-31 08:05:09, Px (50%) def remove_len1(d): x = {} for e in d : if len(d[e]) > 1 : x[e] = d[e] return x def to_type2(type1): for e in type1 : pass return e exec(input().strip()) # DON'T remove this line |
# 0616, 2022-03-31 08:12:41, Px (50%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for i in d: if len(d[i]) > 1 : ans[i] = d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 data = {} for i in type1: if i in data : data[i].append(l) else : data[i] = [l] for l in i : if l in data : data[l].append(i) else : data[l] = [i] return data exec(input().strip()) # DON'T remove this line |
# 0617, 2022-03-31 08:09:59, Px (50%) def remove_len1(d): mango = {} for e in d: if len(d[e]) > 1: mango[e] = d[e] return mango exec(input().strip()) |
# 0618, 2022-03-31 08:15:02, P- (50%) def remove_len1(d): ans = {} for i in d : if len(d[i]) != 1 : ans[i] = d[i] return ans def to_type2(type1): tans = {} for i in type1 : x,y = i.split(':') tans[y] = [x] return tans exec(input().strip()) # DON'T remove this line |
# 0619, 2022-03-31 08:06:55, Px (50%) def remove_len1(d): # remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} result={} for i in d :# i คือ 'A','C','B' if(len(d[i])>1): result[i]=d[i] return result #def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) |
# 0620, 2022-03-31 08:13:46, P- (50%) def remove_len1(d): g = {} for i in d: if len(d[i]) != 1: g[i] = d[i] return g def to_type2(type1): d = {} for i in type1: a,b = i.split(":") d[b] = [a] d[a] = [b] return d exec(input().strip()) |
# 0621, 2022-03-31 08:14:34, Px (50%) def remove_len1(d): new_D = {} for i in d: if len(d[i]) > 1: new_D[i] = d[i] return new_D def to_type2(type1): l = {} for t in type1: nt = t.split(":") for a in nt: if a in l: l[a] += [] else: l[a] = 1 print(nt) return t exec(input().strip()) # DON'T remove this line |
# 0622, 2022-03-31 08:05:01, -- (0%) def remove_len1(d): c={} for n in d: if len(d[n])>=2: c[n]=d[n] return c | # 0623, 2022-03-31 08:05:33, -- (0%) def remove_len1(d): c={} for n in d: if len(d[n])>=2: c[n]=d[n] return c | # 0624, 2022-03-31 08:12:48, -- (0%) def remove_len1(d): c={} for n in d: if len(d[n])>=2: c[n]=d[n] return c def to_type2(type1): ans=[] A={} for n in type1: if n not in A: A[n[0]]=n[-1] return A | # 0625, 2022-03-31 08:14:27, -- (0%) def remove_len1(d): c={} for n in d: if len(d[n])>=2: c[n]=d[n] return c def to_type2(type1): ans=[] A={} for n in type1: if n not in A: A[n[0]]=n[-1] return A | # 0626, 2022-03-31 08:15:24, -- (0%) def remove_len1(d): c={} for n in d: if len(d[n])>=2: c[n]=d[n] return c def to_type2(type1): ans=[] A={} for n in type1: if n not in A: A[n[0]]=n[-1] return A | # 0627, 2022-03-31 08:16:14, -- (0%) def remove_len1(d): c={} for n in d: if len(d[n])>1: c[n]=d[n] return c def to_type2(type1): ans=[] A={} for n in type1: if n not in A: A[n[0]]=n[-1] return A |
# 0628, 2022-03-31 08:09:54, compilation error (0%) def remove_len1(d): for i in d.keys(): if len(d[i])>=2: x=dict(d=d[i]) return x def to_type2(type1): for i in type1: x=dict(type1[i][1]=type[i][3]) return x exec(input().strip()) | # 0629, 2022-03-31 08:10:18, compilation error (0%) def remove_len1(d): for i in d.keys(): if len(d[i])>=2: x=dict(d=d[i]) return x def to_type2(type1): x={} for i in type1: x=dict(type1[i][1]=type[i][3]) return x exec(input().strip()) | # 0630, 2022-03-31 08:10:49, compilation error (0%) def remove_len1(d): for i in d.keys(): if len(d[i])>=2: x=dict(d=d[i]) return x def to_type2(type1): x={} for i in type1: x=dict(type1[i][1]=type1[i][3]) return x exec(input().strip()) | # 0631, 2022-03-31 08:12:34, compilation error (0%) def remove_len1(d): for i in d.keys(): if len(d[i])>=2: x=dict(d=d[i]) return x def to_type2(type1): x={} for i in type1: x=dict(type1[i][1]=type1[i][6]) return x exec(input().strip()) | # 0632, 2022-03-31 08:14:06, compilation error (0%) def remove_len1(d): for i in d.keys(): x={} if len(d[i])>=2: x=dict(d=d[i]) return x def to_type2(type1): x={} for i in type1: x=dict(type1[i][1]=type1[i][6]) return x exec(input().strip()) |
# 0633, 2022-03-31 08:10:48, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} e = {} for i in d : if len(d[i]) == 2 : e[i] = d[i] return e def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0634, 2022-03-31 08:14:49, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} e = {} for i in d : if len(d[i]) == 2 : e[i] = d[i] return e def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0635, 2022-03-31 08:15:37, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} e = {} for i in d : if len(d[i]) == 2 : e[i] = d[i] return e def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0636, 2022-03-31 08:15:47, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} e = {} for i in d : if len(d[i]) == 2 : e[i] = d[i] return e def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line | # 0637, 2022-03-31 08:16:53, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} e = {} for i in d : if len(d[i]) == 2 : e[i] = d[i] return e def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line |
# 0638, 2022-03-31 08:13:24, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} return {i:d[i] for i in d if len(d[i]) != 1} | # 0639, 2022-03-31 08:14:17, -- (0%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} | # 0640, 2022-03-31 08:15:18, -- (0%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans | # 0641, 2022-03-31 08:16:21, -- (0%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans |
# 0642, 2022-03-31 08:15:32, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for item in d: if len(d[item]) != 1: ans[item] = d[item] return ans print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for key in type1: f,s = key.split(':') temp = [] temp.append(s) for key in type1: temp.append() ans[key] = [] temp = [] | # 0643, 2022-03-31 08:15:46, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for item in d: if len(d[item]) != 1: ans[item] = d[item] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for key in type1: f,s = key.split(':') temp = [] temp.append(s) for key in type1: temp.append() ans[key] = [] temp = [] exec(input().strip()) # DON'T remove this line | # 0644, 2022-03-31 08:15:57, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for item in d: if len(d[item]) != 1: ans[item] = d[item] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 '''ans = {} for key in type1: f,s = key.split(':') temp = [] temp.append(s) for key in type1: temp.append() ans[key] = [] temp = [] ''' exec(input().strip()) # DON'T remove this line | # 0645, 2022-03-31 08:16:10, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for item in d: if len(d[item]) != 1: ans[item] = d[item] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 pass exec(input().strip()) # DON'T remove this line |
# 0646, 2022-03-31 08:10:16, -x (0%) def remove_len1(d): for i in d: if len(d[i]) > 1: return {i:d[i]} exec(input().strip()) | # 0647, 2022-03-31 08:12:07, -- (0%) def remove_len1(d): for i in d: if len(d[i]) > 1: return {i:d[i]} | # 0648, 2022-03-31 08:16:11, -x (0%) def remove_len1(d): for i in d: if len(d[i]) > 1: return {i:d[i]} def to_type2(type1): x = {} for i in type1 : y = type1[i] x[y] = i return x exec(input().strip()) | # 0649, 2022-03-31 08:16:34, -- (0%) def remove_len1(d): for i in d: if len(d[i]) > 1: return {i:d[i]} def to_type2(type1): d = {} for i in type1: t = i.split(':') d[t[0]] = t[1] d[t[1]] = t[0] return d exec(input().strip()) |
# 0650, 2022-03-31 08:13:07, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} removed = {} for i in d if len(d[i]) >= 1: removed = d[i] def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for i in type1: exec(input().strip()) # DON'T remove this line | # 0651, 2022-03-31 08:14:54, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} removed = {} for i in d if len(d[i]) >= 1: removed = d[i] return removed def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for i in type1: if i in type1: if k in type1[k]: exec(input().strip()) # DON'T remove this line | # 0652, 2022-03-31 08:16:24, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} removed = {} for i in d if len(d[i]) > 1: removed[i] = d[i] return removed def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for i in type1: if i in type1: if k in type1[k]: exec(input().strip()) # DON'T remove this line |
# 0653, 2022-03-31 08:15:52, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remo #ve_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d: if len(d[i]) != 1: return {i:[d[i]]} # for u in d: # if u not in d: # dic[u] = d[i] # else: # dic[u] += d[i] # return dic[i] print(remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']})) def to_type2(type1): # dic = {} # for i in type1: # if i in dic: # dic[i] += [i] # else: # dic[i] = [i] # return dic # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0654, 2022-03-31 08:15:57, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remo #ve_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d: if len(d[i]) != 1: return {i:[d[i]]} # for u in d: # if u not in d: # dic[u] = d[i] # else: # dic[u] += d[i] # return dic[i] def to_type2(type1): # dic = {} # for i in type1: # if i in dic: # dic[i] += [i] # else: # dic[i] = [i] # return dic # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line | # 0655, 2022-03-31 08:16:07, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืนdict ที่เหมือนกับdแต่ไม่มีคู่key-valueที่value เป็นลิสต์ช่องเดียว # เช่น remo #ve_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} dic = {} for i in d: if len(d[i]) != 1: return {i:[d[i]]} # for u in d: # if u not in d: # dic[u] = d[i] # else: # dic[u] += d[i] # return dic[i] def to_type2(type1): pass # dic = {} # for i in type1: # if i in dic: # dic[i] += [i] # else: # dic[i] = [i] # return dic # type1 เก็บลิสต์ที่แทนการต่อกนั ทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0656, 2022-03-31 08:07:41, -x (0%) def remove_len1(d): for e in d: x = len(d[e]) y = {e:d[e]} if x >1 : return y exec(input().strip()) | # 0657, 2022-03-31 08:07:58, compilation error (0%) def remove_len1(d): for e in d: x = len(d[e]) y = {e:d[e]} if x >1 : return y def to_type2(type1): exec(input().strip()) | # 0658, 2022-03-31 08:15:51, -x (0%) def remove_len1(d): for e in d: x = len(d[e]) y = {e:d[e]} if x >1 : return y def to_type2(type1): return exec(input().strip()) |
# 0659, 2022-03-31 08:05:15, x- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for key in d: if len(d[key]) == 1: del d[key] return d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: x1, x2 = i.split(':') if x1 in d: d[x1].append(x2) else: d[x1] = [x2] return d exec(input().strip()) # DON'T remove this line | # 0660, 2022-03-31 08:15:36, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for key in d: if len(d[key]) == 1: d.pop(key) return d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} type2 = {} for key in type1: if key == type[key][0]: type2[key] = type1[key] return d exec(input().strip()) # DON'T remove this line | # 0661, 2022-03-31 08:16:22, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} s = {} for key in d: if len(d[key]) > 1: s[i] = d[i] return s def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} type2 = {} for key in type1: if key == type[key][0]: type2[key] = type1[key] return d exec(input().strip()) # DON'T remove this line |
# 0662, 2022-03-31 08:14:41, -- (0%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} | # 0663, 2022-03-31 08:16:55, -- (0%) def remove_len1(d): return {e:d[e] for e in d if len(d[e]) != 1} def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: D = e.split(":") Ans[D[0]] = [D[1]] CopyType1[D[1]] = D[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans |
# 0664, 2022-03-31 08:14:54, -- (0%) def remove_len1(d): a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): a = {} for i in type1: i = i.split(":") print(i) if i[0] not in a: a[i[0]] = [i[1]] else: a[i[0]] += [i[1]] i[::-1] if i[0] not in a: a[i[0]] = [i[1]] else: a[i[0]] += [i[1]] return a # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 print(to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])) | # 0665, 2022-03-31 08:14:59, -- (0%) def remove_len1(d): a = {} for i in d: if len(d[i]) != 1: a[i] = d[i] return a # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): a = {} for i in type1: i = i.split(":") if i[0] not in a: a[i[0]] = [i[1]] else: a[i[0]] += [i[1]] i[::-1] if i[0] not in a: a[i[0]] = [i[1]] else: a[i[0]] += [i[1]] return a # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 print(to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])) |
# 0666, 2022-03-31 08:11:58, -- (0%) def remove_len1(d): ans = {} for e in d: if len(d[e]) != 1: ans[e] = d[e] return ans | # 0667, 2022-03-31 08:14:48, -- (0%) def remove_len1(d): ans = {} for e in d: if len(d[e]) != 1: ans[e] = d[e] return ans def to_type2(type1): ans = {} li = [] for e in type1: a = e.split(':') if a[0] not in li: li.append(a[0]) if a[1] not in li: li.append(a[1]) for b in type1: r = b.split(':') op = [] if r[0] in li: ans[r[0]] = [r[1]] if r[1] in li: ans[r[1]] = [r[0]] return ans |
# 0668, 2022-03-31 08:11:41, -- (0%) def remove_len1(d): a = {} for k,v in d.items(): if len(v) == 1: pass elif len(v) > 1: a[k] = v return a def to_type2(type1): type2 = {} for i in type1: c = i.split(':') if c[0] not in type2: type2[c[0]] = [c[1]] else: type2[c[0]].append(c[1]) if c[1] not in type2: type2[c[1]] = [c[0]] else: type2[c[1]].append(c[0]) return type2 | # 0669, 2022-03-31 08:16:13, -- (0%) def remove_len1(d): a = {} for k,v in d.items(): if len(v) == 1: pass elif len(v) > 1: a[k] = v return a def to_type2(type1): type2 = {} for i in type1: c = i.split(':') if c[0] not in type2: type2[c[0]] = [c[1]] else: type2[c[0]].append(c[1]) if c[1] not in type2: type2[c[1]] = [c[0]] else: type2[c[1]].append(c[0]) return type2 |
# 0670, 2022-03-31 08:14:19, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for e in d: if len(d[e])>=2: ans[e] = d[e] return ans | # 0671, 2022-03-31 08:14:33, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for e in d: if len(d[e])>=2: ans[e] = d[e] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 for e in type1: type1[type1[e]]= e ans = {} yeet = [] for e in type1: yeet = [] for i in type1: exec(input().strip()) # DON'T remove this line |
# 0672, 2022-03-31 08:15:00, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) != 1: a[e] = d[e] return a | # 0673, 2022-03-31 08:15:13, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for e in d: if len(d[e]) != 1: a[e] = d[e] return a |
# 0674, 2022-03-31 08:10:27, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} for key in d: if len(key) != 1: v = d[key] a[v] = key return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0675, 2022-03-31 08:13:03, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = {} b = [] for x in d: v = d[x] b.append(v) for key in d: if len(b) != 1: v = d[key] a[v] = key return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line |
# 0676, 2022-03-31 08:15:51, -- (0%) def remove_len1(d): k = {} for key in d.copy(): if len(d[key]) != 1: e = key, d.pop(key) return e print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) | # 0677, 2022-03-31 08:16:10, -- (0%) def remove_len1(d): k = {} for key in d.copy(): if len(d[key]) != 1: e = key, d.pop(key) return e |
# 0678, 2022-03-31 08:14:36, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} output ={} for k in dic: if len(dic[k])!=1: output[k]=dic[k] return output def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 output = {} for m in type1: a,b =i.split(':') if b in output: output[b].append(a) else: output[b]=[a] if a in output: output[a].append(b) else: output[a]=[b] return output exec(input().strip()) # DON'T remove this line | # 0679, 2022-03-31 08:16:51, xx (0%) def remove_len1(d): di = [] for key in d: if len(d[key]) > 1: di.append([key,d[key]]) dii = {} for i in range(len(dd)): dii[di[i][0]] = di[i][1] return dii def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 output = {} for m in type1: a,b =i.split(':') if b in output: output[b].append(a) else: output[b]=[a] if a in output: output[a].append(b) else: output[a]=[b] return output exec(input().strip()) # DON'T remove this line |
# 0680, 2022-03-31 08:12:17, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} return d.get(name) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line | # 0681, 2022-03-31 08:14:22, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} return d.get(d) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line |
# 0682, 2022-03-31 08:15:31, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in d: if len(d[i]) == 1: del d[i] def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 L = [] for i in type1: a,b = i.split(':') L.append([a,b]) memory = {} for j in L: for k in range(2): if k == 0 and j[k] not in memory: memory[j[k]] = j[k+1] elif k == 1 and j[k] not in memory: memory[j[k]] = j[k-1] elif k == 0 and j[k] in memory: memory[j[k]].append(j[k+1]) elif k == 1 and j[k] in memory: memory[j[k]].append(j[k-1]) exec(input().strip()) # DON'T remove this line | # 0683, 2022-03-31 08:16:24, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in d: if len(d[i]) == 1: del d[i] def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 L = [] for i in type1: a,b = i.split(':') L.append([a,b]) memory = {} for j in L: for k in range(2): if k == 0 and j[k] not in memory: memory[j[k]] = j[k+1] elif k == 1 and j[k] not in memory: memory[j[k]] = j[k-1] elif k == 0 and j[k] in memory: memory[j[k]].append(j[k+1]) elif k == 1 and j[k] in memory: memory[j[k]].append(j[k-1]) exec(input().strip()) # DON'T remove this line |
# 0684, 2022-03-31 08:13:39, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in d : if len(d[i]) == 1 : d.pop(i) return d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 l = [] for i in type1 : if not(i in l): l.append(i) l.append(type1[i]) return exec(input().strip()) # DON'T remove this line | # 0685, 2022-03-31 08:14:34, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in d : if len(d[i]) == 1 : d.pop(i) return d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 l = [] for i in type1 : if not(i in l): l.append(i) l.append(type1[i]) return l exec(input().strip()) # DON'T remove this line |
# 0686, 2022-03-31 08:14:59, -- (0%) def remove_len1(d): d={} for key in d: if len(d[key])>1: d+=key return d | # 0687, 2022-03-31 08:16:01, compilation error (0%) def remove_len1(d): d={} for key in d: if len(d[key])>1: |
# 0688, 2022-03-31 08:15:02, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d: if(len(d[i])>1): ans[i]=d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for i in type1: x,y=i.split(':') if not x in ans: ans[x]=[] ans[x].append(y) if not y in ans: ans[y]=[] ans[y].append(x) return ans | # 0689, 2022-03-31 08:15:45, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans={} for i in d: if(len(d[i])>1): ans[i]=d[i] return ans def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans={} for i in type1: x,y=i.split(':') if not x in ans: ans[x]=[] ans[x].append(y) if not y in ans: ans[y]=[] ans[y].append(x) return ans |
# 0690, 2022-03-31 08:13:19, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} an={} for i in d: c=0 for j in d: if i in d[j]: c+=1 if c!=1: an[i]=d[i] return an def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) | # 0691, 2022-03-31 08:13:49, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} an={} for i in d: c=0 for j in d: if i in d[j]: c+=1 if c>1: an[i]=d[i] return an def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 return exec(input().strip()) # DON'T remove this line print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) |
# 0692, 2022-03-31 08:10:49, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for e in d: if len(d[e]) >1 : out[e] = d[e] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out = {} for e in type1: if e not in out: out[e[0]] = e[2] return out exec(input().strip()) # DON'T remove this line | # 0693, 2022-03-31 08:14:16, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} out = {} for e in d: if len(d[e]) >1 : out[e] = d[e] return out def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 out = {} for e in type1: x,y = e.split(':') if e not in out: out[x] = [y] if y in out: out[y] += [x] return out exec(input().strip()) # DON'T remove this line |
# 0694, 2022-03-31 08:16:29, -- (0%) def remove_len1(d): counts = {} for i in d: for i in d: if i in counts: counts[i] += 1 else: counts[i] = 1 l = [] if i in counts: if counts[i] > 1: l += i else: pass afremove = {} for i in l: d[i] = afremove[i] return afremove | # 0695, 2022-03-31 08:16:49, xx (0%) def remove_len1(d): counts = {} for i in d: for i in d: if i in counts: counts[i] += 1 else: counts[i] = 1 l = [] if i in counts: if counts[i] > 1: l += i else: pass afremove = {} for i in l: d[i] = afremove[i] return afremove exec(input().strip()) |
# 0696, 2022-03-31 08:12:45, -- (0%) def remove_len1(d): D = dict() for k in d: if len(d[k]) != 1: D[k] = d[k] return D def to_type2(type1): D = dict() for k in type1: k, k1 = k.split(":") if k not in D: D[k] = list() D[k].append(k1) return D | # 0697, 2022-03-31 08:15:10, -- (0%) def remove_len1(d): D = dict() for k in d: if len(d[k]) != 1: D[k] = d[k] return D def to_type2(type1): D = dict() for k in type1: k, k1 = k.split(":") if k not in D: D[k] = list() D[k].append(k1) return D |
# 0698, 2022-03-31 08:15:27, -- (0%) def remove_len1(d): D = dict() for k in d: if len(d[k]) > 1: D[k] = d[k] return D def to_type2(type1): T1 = dict() for data in type1: data = data.split(":") if data[0] not in T1: D[data[0]] = list() T1[data[0]].append(data[1]) return T1 | # 0699, 2022-03-31 08:15:54, -- (0%) def remove_len1(d): D = dict() for k in d: if len(d[k]) > 1: D[k] = d[k] return D def to_type2(type1): T1 = dict() for data in type1: data = data.split(":") if data[0] not in T1: T1[data[0]] = list() T1[data[0]].append(data[1]) return T1 |
# 0700, 2022-03-31 08:16:41, -x (0%) def remove_len1(d): dict={} for key in d: if d[key]!= 1: dict[key]=d[key] else: pass return dict def to_type2(type1): dict={} for e in type1: value=e return exec(input().strip()) |
# 0701, 2022-03-31 08:12:44, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a = d.keys() print(a) A={} for i in a: if len(d[i])>1: A[i]=d[i] return A def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ใ exec(input().strip()) # DON'T remove this line |
# 0702, 2022-03-31 08:14:22, -- (0%) def remove_len1(d): out = {} for e in d: if len(d[e]) > 1: out[e] = d[e] return out #print(remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']})) def to_type2(type1): out = {} for e in type1: x,y = e.split(":") if x not in out: out[x] = [] out[x].append(y) if y in out: out[y] = [] out[y].append(x) if y not in out: out[y] = [] out[y].append(x) if x in out: out[x] = [] out[x].append(y) return out |
# 0703, 2022-03-31 08:15:49, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} r={} for e in d: if len()<=1: r[e]+=[] else: r[e]+=value def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0704, 2022-03-31 08:13:25, -- (0%) def remove_len1(d): m = {} for key in d : if len(d[key]) != 1 : m[key] = d[key] return m def to_type2(type1): r = {} for i in type1 : b = [] b.append(type1[i]) for n in type1: if type1[n] == i : b.append(n) r[i] = b return r |
# 0705, 2022-03-31 08:13:39, -- (0%) def remove_len1(d) : e = {} for j in d : if len(d[j]) != 1 : e[j] = d[j] return e def to_type2(type1) : result = {} for e in type1 : q,w = e.split(":") if q not in result : result[q] = [w] for h in result : if q in result[h] : result[q] += h return result |
# 0706, 2022-03-31 08:15:27, -- (0%) def to_type2(type1): CopyType1, Ans = {}, {} for e in type1: Data = e.split(":") Ans[Data[0]] = [Data[1]] CopyType1[Data[1]] = Data[0] for e in CopyType1: if e not in Ans: Ans[e] = [CopyType1[e]] elif CopyType1[e] not in Ans[e]: Ans[e].append(CopyType1[e]) return Ans |
# 0707, 2022-03-31 08:16:37, -- (0%) def remove_len1(d): ans = {} for key in d : if len(d[key]) > 1 : ans[key] = d[key] return ans def to_type2(type1): ans = {} for j in type1 : a,b = j.split(':') if a in ans : ans[a] += [b] else : ans[a] = [b] if b in ans : ans[b] += [a] else : ans[b] = [a] return ans |
# 0708, 2022-03-31 08:14:35, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d = {} a = [] b = [] for i in d: if i not in a: a.append(i) b.append(1) else: k = a.index(i) b[k] += 1 for i in range(len(a)): if len(a) > 1: d.update({a[i]: b[i]}) return d def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0709, 2022-03-31 08:14:25, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} a={} for key in d: a=d[key] return a def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0710, 2022-03-31 08:06:34, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in range: x=d[i] if max==len(x): return x def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) |
# 0711, 2022-03-31 08:16:31, -- (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} show = {} for e in d : if len(d[e]) > 1 : show[e] = d[e] return show # print(remove_len1({'A':['B'],'C':['B'],'B':['A','C']})) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 use = [] for e in type1: e = e.split(':') use.append([e[0],e[1]]) use.append([e[1],e[0]]) sh = {} for e in use: x = e[0] y = e[1] if x not in show : sh[x] = [y] else : sh[x].append(y) return sh |
# 0712, 2022-03-31 08:14:04, -- (0%) def remove_len1(d): v = [] for k in d : v.append(d[k]) return v print(remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']})) # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): pass # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 #exec(input().strip()) # DON'T remove this line |
# 0713, 2022-03-31 08:16:22, xx (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} d = {} for data in d: return d[data] def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 type2 = {} for t1 in type1: if t1 in type2: return type[t1] return t1 exec(input().strip()) # DON'T remove this line |
# 0714, 2022-03-31 08:11:58, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } d = {} for i in r : a = r[i] d[a] = i rrturn d # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) # DON'T remove this line |
# 0715, 2022-03-31 08:14:42, xx (0%) def remove_len1(d) : for key in d : a = d[key] for i in range(len(d)) : if len(a) != 1 : return d[key] def to_type2(type1): pass exec(input().strip()) |
# 0716, 2022-03-31 08:15:32, xx (0%) def remove_len1(d): r = {} for i in d: a = d[i] r[a] = i return r exec(input().strip()) |
# 0717, 2022-03-31 08:14:33, -- (0%) def remove_len1(d): dic ={} for e in d: if len(d[e]) != 1 : dic[e] = d[e] return dic |
# 0718, 2022-03-31 08:16:40, compilation error (0%) def remove_len1(d)ซ ans = dict() for i in d: if len(d[i]) != 1: ans[i] = d[i] return ans # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} def to_type2(type1): if x in type1: type1[x]=type1[x]+[y] elif x not in type1: type1[x]=[y] if y in data: type1[y]=type1[y]+[x] elif y not in type1: type1[y]=[x] return type1 # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 exec(input().strip()) |
# 0719, 2022-03-31 08:11:25, compilation error (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} ans = {} for key in d : if len(d[key]) != 1 : ans[key] = d[key] return ans #ans = remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) #print(ans) def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 ans = {} for ch in type1 : if ch in t : return ans #print(to_type2(['A:B', 'B:C', 'E1:C', 'D:C'])) exec(input().strip()) # DON'T remove this line |
# 0720, 2022-03-31 08:15:06, -x (0%) def remove_len1(d): # d เป็น dict เก็บข้อมูลในรูปแบบ { string: [string, ...] } # คืน dict ที่เหมือนกับ d แต่ไม่มีคู่ key-value ที่ value เป็นลิสต์ช่องเดียว # เช่น remove_len1({'A':['B'], 'C':['B'], 'B':['A','C']}) คืน {'B':['A','C']} for i in d: l = [] if len(d[i]) != 1: return {i:d[i]} def to_type2(type1): # type1 เก็บลิสต์ที่แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 1 # คืน dict ที่ได้จากการแปลงข้อมูลใน type1 ให้แทนการต่อกันทั้งหมดของปมต่าง ๆ ในแบบที่ 2 d = {} for i in type1: a = i.split("") if a[0] not in d: d[a[0]] = [] if a[1] not in d: d[a[1]] = [] d[a[0]].append(d[a[1]]) d[a[1]].append(d[a[0]]) return d exec(input().strip()) # DON'T remove this line |