message
stringlengths
2
44.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
276
109k
cluster
float64
23
23
__index_level_0__
int64
552
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three sticks with positive integer lengths of a, b, and c centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can ...
instruction
0
89,711
23
179,422
No
output
1
89,711
23
179,423
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,082
23
180,164
"Correct Solution: ``` while True: h,w = map(int, input().split()) if (w + h) == 0: break print("#"*w) for i in range(h-2): print("#"+"."*(w-2)+"#") print("#"*w) print("") ```
output
1
90,082
23
180,165
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,083
23
180,166
"Correct Solution: ``` while True: y,x = map(int,input().split()) if y == 0 and x == 0: break print("#"*x) for j in range(y-2): print("#"+"."*(x-2)+"#") print("#"*x) print() ```
output
1
90,083
23
180,167
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,084
23
180,168
"Correct Solution: ``` while True: h, w = map(int, input().split()) if(h==0): break print('#'*w) [print('#'+'.'*(w-2)+'#') for i in range(h-2)] print('#'*w) print() ```
output
1
90,084
23
180,169
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,085
23
180,170
"Correct Solution: ``` while True: H,W = map(int,input().split()) if H==0 and W==0: break print("#"*W) for i in range(H-2): print("#","."*(W-2),"#",sep='') print("#"*W) print() ```
output
1
90,085
23
180,171
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,086
23
180,172
"Correct Solution: ``` for i in range(100000): h,w = map(int,input().split(" ")) if h + w == 0: break print("#"*w) for j in range(h-2): print("#" + "."*(w-2) + "#") print("#"*w) print("") ```
output
1
90,086
23
180,173
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,087
23
180,174
"Correct Solution: ``` while True : H,W=map(int,input().split()) if H==0 and W==0 : break print("#"*W) for i in range (H-2): print("{}{}{}".format("#",(".")*(W-2),"#")) print("#"*W) print() ```
output
1
90,087
23
180,175
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,088
23
180,176
"Correct Solution: ``` while True: H,W = map(int,input().split(' ')) if not(H or W):break print('#'*W) for h in range(H-2): print(f'#{"."*(W-2)}#') print('#'*W) print() ```
output
1
90,088
23
180,177
Provide a correct Python 3 solution for this coding contest problem. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ........# Constraints * 3 ≤ H ≤ 300 * 3 ≤ W ≤ 300 Inpu...
instruction
0
90,089
23
180,178
"Correct Solution: ``` while True: h, w = [int(i) for i in input().split()] if w == h == 0: break print("#" * w, end="") print(("\n#" + "." * (w - 2) + "#") * (h - 2)) print("#" * w, end="\n\n") ```
output
1
90,089
23
180,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,090
23
180,180
Yes
output
1
90,090
23
180,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,091
23
180,182
Yes
output
1
90,091
23
180,183
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,092
23
180,184
Yes
output
1
90,092
23
180,185
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,093
23
180,186
Yes
output
1
90,093
23
180,187
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,094
23
180,188
No
output
1
90,094
23
180,189
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,095
23
180,190
No
output
1
90,095
23
180,191
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,096
23
180,192
No
output
1
90,096
23
180,193
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ........# ........# ........# ......
instruction
0
90,097
23
180,194
No
output
1
90,097
23
180,195
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from 1 ...
instruction
0
90,114
23
180,228
Tags: dp, geometry Correct Solution: ``` n=int(input()) tl=tr=bl=br=top=bot=left=right=-200000000 for i in range(n): a,b=map(int,input().split()) top=max(top,b) bot=max(bot,-b) right=max(right,a) left=max(left,-a) tr=max(tr,a+b) tl=max(tl,b-a) br=max(br,a-b) bl=max(bl,-a-b) print(str...
output
1
90,114
23
180,229
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from 1 ...
instruction
0
90,115
23
180,230
Tags: dp, geometry Correct Solution: ``` n = int(input()) north = -100000000 south = 100000000 east = -100000000 west = 100000000 ne = -200000000 nw = -200000000 se = -200000000 sw = -200000000 for i in range(n): x,y = map(int,input().split()) north = max(north,y) east = max(east,x) south = min(south,y)...
output
1
90,115
23
180,231
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from 1 ...
instruction
0
90,116
23
180,232
Tags: dp, geometry Correct Solution: ``` import itertools n = int(input()) xys = [tuple(map(int, input().split())) for _ in range(n)] h = min(xy[0] for xy in xys) j = min(xy[1] for xy in xys) k = max(xy[1] for xy in xys) l = max(xy[0] for xy in xys) ans3 = max( max( abs(x - h) + abs(y - j), abs(...
output
1
90,116
23
180,233
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from 1 ...
instruction
0
90,117
23
180,234
Tags: dp, geometry Correct Solution: ``` from collections import namedtuple import sys XY = namedtuple('XY', 'x y') n = int(input()) pg = [XY(*[int(w) for w in input().split()]) for _ in range(n)] minx = min(p.x for p in pg) miny = min(p.y for p in pg) maxx = max(p.x for p in pg) maxy = max(p.y for p in pg) p4 = 2 ...
output
1
90,117
23
180,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same ...
instruction
0
90,118
23
180,236
No
output
1
90,118
23
180,237
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same ...
instruction
0
90,119
23
180,238
No
output
1
90,119
23
180,239
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same ...
instruction
0
90,120
23
180,240
No
output
1
90,120
23
180,241
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same ...
instruction
0
90,121
23
180,242
No
output
1
90,121
23
180,243
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,226
23
180,452
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` def main(): n = int(input()) lkz = {} lky = {} for i in range(n): px, py, pz = map(int, input().split()) if pz not in lkz: lkz[pz] = set() lkz[...
output
1
90,226
23
180,453
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,227
23
180,454
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` from bisect import bisect def solve(points): def it(): Z = sorted(set(z for x,y,z in points)) z_bin = [[] for _ in range(len(Z))] for i,(x,y,z) in enumerate(points): ...
output
1
90,227
23
180,455
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,228
23
180,456
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` import sys from collections import defaultdict readline = sys.stdin.readline N = int(readline()) XYZ = [tuple(map(int, readline().split())) for _ in range(N) ] XYZI = [(x, y, z, i) for i, (...
output
1
90,228
23
180,457
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,229
23
180,458
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` from collections import defaultdict def filterOut(ans,removed,mapp): # filters adjacent pairs in map values. same line # mapp is like {(x,y):[[z1,idx1],[z2,idx2],...]} for v in mapp.values()...
output
1
90,229
23
180,459
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,230
23
180,460
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` n = int(input()) coords = n*[-1] coordsy = list() coordsz = list() for i in range(n): coords[i] = [int(i) for i in input().split()] + [i] coords.sort() i = 0 while i < len(coords) - 1: if coo...
output
1
90,230
23
180,461
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,231
23
180,462
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) D = {} ans = [] for i in range(N): x, y, z = map(int, input().split()) if z in D: if y in D[z]: ...
output
1
90,231
23
180,463
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,232
23
180,464
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` """ > File Name: c.py > Author: Code_Bear > Mail: secret > Created Time: Thu Oct 17 16:34:03 2019 """ from collections import OrderedDict def SortPoint(p, ids, k, D): if k == D: ...
output
1
90,232
23
180,465
Provide tags and a correct Python 3 solution for this coding contest problem. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i). The number of points n is even. You'd like t...
instruction
0
90,233
23
180,466
Tags: binary search, constructive algorithms, divide and conquer, greedy, implementation, sortings Correct Solution: ``` n = int(input()) arr = [] for _ in range(n): a, b, c = map(int, input().split()) arr.append([a, b, c] + [_ + 1]) arr.sort() ans = [] for i in range(2, -1, -1): st = [] for x in arr: ...
output
1
90,233
23
180,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,234
23
180,468
Yes
output
1
90,234
23
180,469
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,235
23
180,470
Yes
output
1
90,235
23
180,471
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,236
23
180,472
Yes
output
1
90,236
23
180,473
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,237
23
180,474
Yes
output
1
90,237
23
180,475
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,238
23
180,476
No
output
1
90,238
23
180,477
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,239
23
180,478
No
output
1
90,239
23
180,479
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,240
23
180,480
No
output
1
90,240
23
180,481
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is a harder version of the problem. In this version, n ≤ 50 000. There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordinates (x_i, y_i, z_i)...
instruction
0
90,241
23
180,482
No
output
1
90,241
23
180,483
Provide tags and a correct Python 3 solution for this coding contest problem. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding ...
instruction
0
90,508
23
181,016
Tags: binary search, data structures, implementation Correct Solution: ``` # import itertools # import bisect # import math from collections import defaultdict, Counter import os import sys from io import BytesIO, IOBase # sys.setrecursionlimit(10 ** 5) ii = lambda: int(input()) lmii = lambda: list(map(int, input().sp...
output
1
90,508
23
181,017
Provide tags and a correct Python 3 solution for this coding contest problem. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding ...
instruction
0
90,509
23
181,018
Tags: binary search, data structures, implementation Correct Solution: ``` w,h,n=map(int,input().split()) l=[-1]*(w+1) r=[-1]*(w+1) t=[-1]*(h+1) b=[-1]*(h+1) l[0]=0 b[0]=0 t[h]=h r[w]=w V=[0]*(n) H=[0]*(n) for i in range(n): line,index=input().split() index=int(index) if line=="V": r[index]=w ...
output
1
90,509
23
181,019
Provide tags and a correct Python 3 solution for this coding contest problem. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding ...
instruction
0
90,510
23
181,020
Tags: binary search, data structures, implementation Correct Solution: ``` # -*- coding:utf-8 -*- """ created by shuangquan.huang at 1/7/20 reverse thinking of merging instead of split """ import collections import time import os import sys import bisect import heapq from typing import List class Node: val =...
output
1
90,510
23
181,021
Provide tags and a correct Python 3 solution for this coding contest problem. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding ...
instruction
0
90,511
23
181,022
Tags: binary search, data structures, implementation Correct Solution: ``` w, h, n = map(int, input().split()) x = [0, w] y = [0, h] rev = [] for _ in range(n): s, d = input().split() if s == 'H': y.append(int(d)) else: x.append(int(d)) rev.append((s, int(d))) x.sort() y.sort() _max ...
output
1
90,511
23
181,023
Provide tags and a correct Python 3 solution for this coding contest problem. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding ...
instruction
0
90,512
23
181,024
Tags: binary search, data structures, implementation Correct Solution: ``` def main(): from sys import stdin w, h, n = map(int, stdin.readline().split()) res, vrt, hor = [], [], [] vh = (vrt, hor) for i, s in enumerate(stdin.read().splitlines()): x = int(s[2:]) flag = s[0] == 'V' ...
output
1
90,512
23
181,025
Provide tags and a correct Python 3 solution for this coding contest problem. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding ...
instruction
0
90,513
23
181,026
Tags: binary search, data structures, implementation Correct Solution: ``` def main(): from sys import stdin w, h, n = map(int, stdin.readline().split()) res, vrt, hor = [], [], [] vh = (vrt, hor) for i, s in enumerate(stdin.read().splitlines()): x = int(s[2:]) flag = s[0] == 'V' ...
output
1
90,513
23
181,027
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots...
instruction
0
90,514
23
181,028
No
output
1
90,514
23
181,029
Provide a correct Python 3 solution for this coding contest problem. There is a grid with R rows and C columns. We call the cell in the r-th row and c-th column (r,c). Mr. Takahashi wrote non-negative integers into N of the cells, that is, he wrote a non-negative integer a_i into (r_i,c_i) for each i (1≤i≤N). After t...
instruction
0
90,829
23
181,658
"Correct Solution: ``` import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) R,C = map(int,input().split()) N = int(input()) RCA = [tuple(int(x) for x in input().split()) for _ in range(N)] # 二部グラフ graph = [[] for _ in range(R+C)] for r,c,a in RCA: graph[r-1].append((R+c-1,a)) graph[R+c-1].appe...
output
1
90,829
23
181,659
Provide a correct Python 3 solution for this coding contest problem. There is a grid with R rows and C columns. We call the cell in the r-th row and c-th column (r,c). Mr. Takahashi wrote non-negative integers into N of the cells, that is, he wrote a non-negative integer a_i into (r_i,c_i) for each i (1≤i≤N). After t...
instruction
0
90,830
23
181,660
"Correct Solution: ``` import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") h,w = list(map(int, input().split())) n = int(input()) from collections import defaultdict mind = [10**15] * h dw = defaultdict(list) for i in range(n): ...
output
1
90,830
23
181,661