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
Provide a correct Python 3 solution for this coding contest problem. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the ho...
instruction
0
68,009
23
136,018
"Correct Solution: ``` a,b,c,d = map(int,(input().split())) print(max(a*b,c*d)) ```
output
1
68,009
23
136,019
Provide a correct Python 3 solution for this coding contest problem. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the ho...
instruction
0
68,010
23
136,020
"Correct Solution: ``` a, b, c, d = map(int, input().split()) list01 = [a * b, c * d] print(max(list01)) ```
output
1
68,010
23
136,021
Provide a correct Python 3 solution for this coding contest problem. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the ho...
instruction
0
68,011
23
136,022
"Correct Solution: ``` A, B, C, D = map(int, input().split()) print((A*B) if (A*B)>(C*D) else (C*D)); ```
output
1
68,011
23
136,023
Provide a correct Python 3 solution for this coding contest problem. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the ho...
instruction
0
68,012
23
136,024
"Correct Solution: ``` a,b,c,d=map(int,input().split()) ans=max(a*b,c*d) print(ans) ```
output
1
68,012
23
136,025
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,013
23
136,026
Yes
output
1
68,013
23
136,027
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,014
23
136,028
Yes
output
1
68,014
23
136,029
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,015
23
136,030
Yes
output
1
68,015
23
136,031
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,016
23
136,032
Yes
output
1
68,016
23
136,033
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,017
23
136,034
No
output
1
68,017
23
136,035
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,018
23
136,036
No
output
1
68,018
23
136,037
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,019
23
136,038
No
output
1
68,019
23
136,039
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides ...
instruction
0
68,020
23
136,040
No
output
1
68,020
23
136,041
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,037
23
136,074
"Correct Solution: ``` from math import sqrt,atan2,cos,sin while(1): try: x1,y1,x2,y2,xq,yq = [float(i) for i in input().split(",")] r = sqrt((xq-x1)**2 + (yq-y1)**2) th1 = atan2(y2-y1,x2-x1) th2 = atan2(yq-y1,xq-x1) th3 = -(th2 - th1) + th1 print("{:.6f} {:.6f}".form...
output
1
68,037
23
136,075
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,038
23
136,076
"Correct Solution: ``` import sys from math import* for e in sys.stdin: a,b,c,d,x,y=map(float,e.split(',')) g=2*atan2(d-b,c-a);s,t=sin(g),cos(g);x-=a;y-=b print(f'{t*x+s*y+a:.6f} {s*x-t*y+b:.6f}') ```
output
1
68,038
23
136,077
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,039
23
136,078
"Correct Solution: ``` while True : try : x1, y1, x2, y2, xq, yq = map(float, input().split(',')) except EOFError : break if x1 != x2 and y1 != y2: ## d_P1_P2 : P1-P2の傾き ## d_P1_P2 = (y2-y1)/(x2-x1) ## d_Q1_Q2 : Q1-Q2の傾き ## d_Q1_Q2 = -1/d_P1_P2 ...
output
1
68,039
23
136,079
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,040
23
136,080
"Correct Solution: ``` import sys from decimal import Decimal for l in sys.stdin: x1,y1,x2,y2,xq,yq=list(map(Decimal,l.split(","))) a=x1-x2 b=y1-y2 c=xq-2*x1 d=yq-2*y1 e=yq-y1 X=(xq*a**2-c*b**2+2*e*a*b)/(a**2+b**2) try: Y=b/a*(X+c)-d except: Y=-a/b*(X-xq)+yq print(" ".join(["{:.6f}".format(i...
output
1
68,040
23
136,081
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,041
23
136,082
"Correct Solution: ``` while True: try: x1, y1, x2, y2, xq, yq = map(float, input().split(",")) if (y2-y1) == 0: xr = xq yr = 2*y1 - yq elif (x2-x1) == 0: xr = 2*x1 - xq yr = yq else: a12 = (y2-y1)/(x2-x1) aqr = ...
output
1
68,041
23
136,083
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,042
23
136,084
"Correct Solution: ``` # -*- coding: utf-8 -*- import sys import os import math class Vector2(): def __init__(self, x, y): self._x = float(x) self._y = float(y) def normalize(self): norm = self.norm() return Vector2(self._x / norm, self._y / norm) def norm(self): ...
output
1
68,042
23
136,085
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,043
23
136,086
"Correct Solution: ``` # AOJ 0081 A Symmetric Point # Python3 2018.6.17 bal4u def dot(a, b): return a.real*b.real + a.imag*b.imag def norm(a): return a.real**2 + a.imag**2 def project(line, p): base = line[1]-line[0] r = dot(p-line[0], base) / norm(base) return line[0] + base*r def symmetric_Point(line, p):...
output
1
68,043
23
136,087
Provide a correct Python 3 solution for this coding contest problem. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Create a program that outputs the ...
instruction
0
68,044
23
136,088
"Correct Solution: ``` import sys from math import* for e in sys.stdin: a,b,c,d,e,f=map(float,e.split(',')) z,w,q=complex(a,b),complex(c,d),complex(e,f) z+=((z-w)/abs(z-w))**2*(q-z).conjugate() print(z.real,z.imag) ```
output
1
68,044
23
136,089
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,045
23
136,090
Yes
output
1
68,045
23
136,091
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,046
23
136,092
Yes
output
1
68,046
23
136,093
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,047
23
136,094
Yes
output
1
68,047
23
136,095
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,048
23
136,096
Yes
output
1
68,048
23
136,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,049
23
136,098
No
output
1
68,049
23
136,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,050
23
136,100
No
output
1
68,050
23
136,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,051
23
136,102
No
output
1
68,051
23
136,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Read a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as ...
instruction
0
68,052
23
136,104
No
output
1
68,052
23
136,105
Provide a correct Python 3 solution for this coding contest problem. Housing maker Yamada House has launched a new featured product, a land for sale in a green home town with a rich environment such as schools and hospitals. This lot is divided into multiple lots and you can buy as many as you like, but the shape of t...
instruction
0
68,053
23
136,106
"Correct Solution: ``` from itertools import product # from line_profiler import LineProfiler def putpiece(X,Y,bitmap,unused,pieces,numans,pcsans): if not unused: return numans + 1, pieces if numans > 1: return 2, pieces b,k,y,x = unused[-1] for h,w in set([ (k//i,k//(k//i)) for i in range(1,min(X+1,k...
output
1
68,053
23
136,107
Provide a correct Python 3 solution for this coding contest problem. Housing maker Yamada House has launched a new featured product, a land for sale in a green home town with a rich environment such as schools and hospitals. This lot is divided into multiple lots and you can buy as many as you like, but the shape of t...
instruction
0
68,054
23
136,108
"Correct Solution: ``` from itertools import product # from line_profiler import LineProfiler def putpiece(X,Y,bitmap,unused,pieces,numans,pcsans,FINFLAG): if FINFLAG: return numans,pcsans if not unused: pcsans = pieces return numans + 1, pcsans if numans > 1: return 2, pie...
output
1
68,054
23
136,109
Provide a correct Python 3 solution for this coding contest problem. Housing maker Yamada House has launched a new featured product, a land for sale in a green home town with a rich environment such as schools and hospitals. This lot is divided into multiple lots and you can buy as many as you like, but the shape of t...
instruction
0
68,055
23
136,110
"Correct Solution: ``` def putpiece(bitmap,unused,pieces,numans,pcsans,FINFLAG): # print(bin(bitmap)) # print(unused,"***",pieces,"***",numans) if FINFLAG: return numans,pcsans if not unused: pcsans = pieces return numans + 1, pcsans if numans > 1: return 2, pieces ...
output
1
68,055
23
136,111
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,104
23
136,208
"Correct Solution: ``` import math c1x,c1y,c1r = [int(i) for i in input().split()] c2x,c2y,c2r = [int(i) for i in input().split()] d = math.sqrt(pow(c1x-c2x, 2) + pow(c1y-c2y, 2)) bcr = 0 scr = 0 if c1r > c2r: bcr = c1r scr = c2r else: bcr = c2r scr = c1r if d > bcr + scr: print(4) elif d == ...
output
1
68,104
23
136,209
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,105
23
136,210
"Correct Solution: ``` import math def dist(x1, y1, x2, y2): return math.sqrt((x1-x2)**2 + (y1-y2)**2) c1x, c1y, c1r = map(int, input().split()) c2x, c2y, c2r = map(int, input().split()) d = dist(c1x, c1y, c2x, c2y) if d>c1r+c2r: print(4) elif d==c1r+c2r: print(3) elif d+c1r==c2r or d+c2r==c1r: print...
output
1
68,105
23
136,211
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,106
23
136,212
"Correct Solution: ``` from math import sqrt c1x, c1y, c1r = map(int, input().split()) c2x, c2y, c2r = map(int, input().split()) d = sqrt((c2x - c1x) ** 2 + (c2y - c1y) ** 2) sr, dr = c1r + c2r, abs(c1r - c2r) eps = 1e-6 if d - sr > eps: print(4) elif abs(d - sr) < eps: print(3) elif d - dr > eps: print(2)...
output
1
68,106
23
136,213
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,107
23
136,214
"Correct Solution: ``` def main(): cx1, cy1, r1 = map(int, input().split()) cx2, cy2, r2 = map(int, input().split()) d = pow((cx2 -cx1)**2 + (cy2 -cy1)**2, 0.5) if d > r1 + r2: # 4(not cross) print("4") elif d == r1 + r2: # 3(circumscribed) print("3") elif abs...
output
1
68,107
23
136,215
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,108
23
136,216
"Correct Solution: ``` from math import sqrt from typing import Tuple def dist(p: Tuple[float, float], q: Tuple[float, float]) -> float: return sqrt((p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2) if __name__ == "__main__": c1x, c1y, c1r = map(lambda x: float(x), input().split()) c2x, c2y, c2r = map(lambda x: ...
output
1
68,108
23
136,217
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,109
23
136,218
"Correct Solution: ``` from math import sqrt c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) d = sqrt((c1[0]-c2[0])**2 + (c1[1]-c2[1])**2) lsum = c1[2] + c2[2] lsub = abs(c1[2] - c2[2]) if d>lsum: print('4') if d == lsum: print('3') if lsub<d<lsum: print('2') if d == lsub: print('1') if d<l...
output
1
68,109
23
136,219
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,110
23
136,220
"Correct Solution: ``` import math cx1,cy1,r1 = map(int,input().split()) cx2,cy2,r2 = map(int,input().split()) xydistance = math.sqrt(pow(abs(cx1-cx2),2)+pow(abs(cy1-cy2),2)) if xydistance > r1+r2: print(4) if xydistance == r1+r2: print(3) if xydistance < r1+r2 and xydistance > abs(r1-r2) and xydistance...
output
1
68,110
23
136,221
Provide a correct Python 3 solution for this coding contest problem. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circl...
instruction
0
68,111
23
136,222
"Correct Solution: ``` c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) dis = (c1[0] - c2[0]) ** 2 + (c1[1] - c2[1]) ** 2 if dis > (c1[2] + c2[2]) ** 2: print(4) elif dis == (c1[2] + c2[2]) ** 2: print(3) elif dis > (c1[2] - c2[2]) ** 2: print(2) elif dis == (c1[2] - c2[2]) ** 2: prin...
output
1
68,111
23
136,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,112
23
136,224
Yes
output
1
68,112
23
136,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,113
23
136,226
Yes
output
1
68,113
23
136,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,114
23
136,228
Yes
output
1
68,114
23
136,229
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,115
23
136,230
Yes
output
1
68,115
23
136,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,116
23
136,232
No
output
1
68,116
23
136,233
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,117
23
136,234
No
output
1
68,117
23
136,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,118
23
136,236
No
output
1
68,118
23
136,237
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they inters...
instruction
0
68,119
23
136,238
No
output
1
68,119
23
136,239
Provide a correct Python 3 solution for this coding contest problem. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,681
23
137,362
"Correct Solution: ``` from heapq import heappush, heappop class MinCostFlow_by_Dijkstra: #Dijkstraによる最小費用流問題 #(参考元:https://tjkendev.github.io/procon-library/python/min_cost_flow/primal-dual.html) INF = float("inf") def __init__(self, N): self.N = N self.G = [[] for i in range(N)] ...
output
1
68,681
23
137,363
Provide a correct Python 3 solution for this coding contest problem. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,682
23
137,364
"Correct Solution: ``` import heapq class PrimalDual: def __init__(self, n: int): """頂点数をnとする。""" self.INF = 10 ** 9 + 7 self.n = n self.graph = [[] for _ in range(n)] def add_edge(self, _from: int, to: int, capacity: int, cost: int): """辺を追加 1. _fromからtoへ向かう容量...
output
1
68,682
23
137,365
Provide a correct Python 3 solution for this coding contest problem. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,683
23
137,366
"Correct Solution: ``` import heapq class mcf_graph: __slots__ = ["n", "pos", "g"] def __init__(self, n): self.n = n self.pos = [] self.g = [[] for _ in range(n)] def add_edge(self, from_, to, cap, cost): assert 0 <= from_ < self.n assert 0 <= to < self.n ...
output
1
68,683
23
137,367