message
stringlengths
2
19.9k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
322
108k
cluster
float64
15
15
__index_level_0__
int64
644
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is under rook's attack, if there is at least one rook ...
instruction
0
15,547
15
31,094
Tags: data structures, math Correct Solution: ``` from sys import stdin input=lambda : stdin.readline().strip() from math import ceil,sqrt,factorial INT_MIN=float("-infinity") INT_MAX=float("infinity") n,m=map(int,input().split()) row=set() col=set() su=n*n for i in range(m): a,b=map(int,input().split()) if a not in ...
output
1
15,547
15
31,095
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is under rook's attack, if there is at least one rook ...
instruction
0
15,548
15
31,096
Tags: data structures, math Correct Solution: ``` n,m = map(int, input().split()) all_x = set() all_y = set() ans = [] for i in range(m): x,y = map(int, input().split()) all_x.add(x) all_y.add(y) ans.append((n - len(all_x)) * (n - len(all_y))) print(*ans) ```
output
1
15,548
15
31,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,549
15
31,098
Yes
output
1
15,549
15
31,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,550
15
31,100
Yes
output
1
15,550
15
31,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,551
15
31,102
Yes
output
1
15,551
15
31,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,552
15
31,104
Yes
output
1
15,552
15
31,105
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,553
15
31,106
No
output
1
15,553
15
31,107
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,554
15
31,108
No
output
1
15,554
15
31,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,555
15
31,110
No
output
1
15,555
15
31,111
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is unde...
instruction
0
15,556
15
31,112
No
output
1
15,556
15
31,113
Provide a correct Python 3 solution for this coding contest problem. Let us consider a grid of squares with N rows and N columns. You want to put some domino pieces on this grid. Each domino piece covers two squares that have a common side. Each square can be covered by at most one piece. For each row of the grid, le...
instruction
0
15,731
15
31,462
"Correct Solution: ``` n=int(input());f=["aabbc","hi..c","hi..d","g.jjd","gffee"];x=list("cdcd");a=[n*["."]for _ in range(n)];z={2:[-1],3:["abb","a.c","ddc"],5:["aabbc","hi..c","hi..d","g.jjd","gffee"],7:["..abc..","..abc..","aax..aa","bbx..bb","cc.yycc","..abc..","..abc.."]} if n in z:print(*z[n]);exit() if n%2: for...
output
1
15,731
15
31,463
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,967
15
31,934
Tags: binary search, two pointers Correct Solution: ``` from bisect import bisect_left def readint(): return int(input()) def readline(): return [int(c) for c in input().split()] # similar to 45311982 def main(): MAX = 10**9 n, m = readline() v = sorted([readint() for _ in range(n)]) h = []...
output
1
15,967
15
31,935
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,968
15
31,936
Tags: binary search, two pointers Correct Solution: ``` #n=int(input()) n,m=map(int,input().split()) vert=[] for i in range(n): v=int(input()) vert.append(v) horz=[] for i in range(m): x1,x2,y=map(int,input().split()) if x1==1: horz.append(x2) vert.sort() horz.sort() vert.append(1000000000...
output
1
15,968
15
31,937
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,969
15
31,938
Tags: binary search, two pointers Correct Solution: ``` n, m = map(int, input().split()) ver = [int(input()) for _ in range(n)] ver.append(10 ** 9) hor = [] for _ in range(m): x1, x2, y = map(int, input().split()) if x1 == 1: hor.append(x2) hor.sort() ver.sort() j = 0 ans = 10 ** 18 for i in range(n + 1...
output
1
15,969
15
31,939
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,970
15
31,940
Tags: binary search, two pointers Correct Solution: ``` n,m = map(int, input().split()) vertical_blocks = [] for i in range(n): vertical_blocks.append(int(input())) vertical_blocks.append(10**9) horizontal_blocks = [] for i in range(m): x1,x2,y = map(int, input().split()) if x1 == 1: horizontal_bl...
output
1
15,970
15
31,941
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,971
15
31,942
Tags: binary search, two pointers Correct Solution: ``` n, m = map(int, input().split()) V = [] for i in range(n): V.append(int(input())) V.sort() V.append(10 ** 9) n += 1 X2 = [] for i in range(m): x1, x2, y = map(int, input().split()) if x1 == 1: X2.append(x2) X2.sort() k = len(X2) i = 0 j = 0 ans...
output
1
15,971
15
31,943
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,972
15
31,944
Tags: binary search, two pointers Correct Solution: ``` n,m=[int(x) for x in input().split()] v=[] h=[] for i in range(n): x=int(input()) v.append(x) for i in range(m): x,y,z=[int(x) for x in input().split()] if x==1: h.append(y) h.sort() v.sort() m=len(h) n=len(v) if n==0 or v[n-1]!=1000000000:...
output
1
15,972
15
31,945
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,973
15
31,946
Tags: binary search, two pointers Correct Solution: ``` from collections import namedtuple import sys HS = namedtuple('HS', 'x1 x2 y') n, m = [int(w) for w in input().split()] vs = [int(input()) for _ in range(n)] hs = [HS(*[int(w) for w in input().split()]) for _ in range(m)] vs.sort() hr = len([s for s in hs if s...
output
1
15,973
15
31,947
Provide tags and a correct Python 3 solution for this coding contest problem. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the...
instruction
0
15,974
15
31,948
Tags: binary search, two pointers Correct Solution: ``` import bisect n, m = map(int, input().split()) ar1 = [1] + [int(input()) for _ in range(n)] ar1.append(10 ** 9) ar1.sort() ar2 = [list(map(int, input().split())) for _ in range(m)] kek = list() for x in ar2: j1 = bisect.bisect_left(ar1, x[0]) j2 = bisect.b...
output
1
15,974
15
31,949
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,975
15
31,950
Yes
output
1
15,975
15
31,951
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,976
15
31,952
Yes
output
1
15,976
15
31,953
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,977
15
31,954
Yes
output
1
15,977
15
31,955
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,978
15
31,956
Yes
output
1
15,978
15
31,957
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,979
15
31,958
No
output
1
15,979
15
31,959
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,980
15
31,960
No
output
1
15,980
15
31,961
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,981
15
31,962
No
output
1
15,981
15
31,963
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for...
instruction
0
15,982
15
31,964
No
output
1
15,982
15
31,965
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,146
15
32,292
Tags: brute force, greedy, implementation Correct Solution: ``` t = int(input()) for _ in range(t): n, m = map(int, input().split()) a = [input() for i in range(n)] ans = 0 for i in range(n): if a[i][m-1] == 'R': ans += 1 ans += a[-1].count("D") print(ans) ```
output
1
16,146
15
32,293
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,147
15
32,294
Tags: brute force, greedy, implementation Correct Solution: ``` t=int(input()) for i in range(t): n,m=map(int,input().split()) a=[] for j in range(n): b=input() a.append(b) if j==n-1: d=b.count('D') c=[a[j][m-1] for j in range(n)] r=c.count("R") print(r+d) ```
output
1
16,147
15
32,295
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,148
15
32,296
Tags: brute force, greedy, implementation Correct Solution: ``` import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not i...
output
1
16,148
15
32,297
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,149
15
32,298
Tags: brute force, greedy, implementation Correct Solution: ``` import math t=int(input()) for _ in range(t): n,m=map(int,input().split()) cnt=0 for i in range(n): a=input() if(i!=n-1): if(a[-1]!="D"): cnt+=1 else: cnt+=a.count("D") #pr...
output
1
16,149
15
32,299
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,150
15
32,300
Tags: brute force, greedy, implementation Correct Solution: ``` from collections import Counter def solve(n,m) : step=0 for i in range(n): st=input() if(st[m-1]=='R'): step +=1 if(i==(n-1)): for j in range(m): if(st[j]=='D'): s...
output
1
16,150
15
32,301
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,151
15
32,302
Tags: brute force, greedy, implementation Correct Solution: ``` # -*- coding: utf-8 -*- #hamza = payaso for _ in range(int(input())): n,m = map(int,input().split()) cont = 0 for i in range(n): s = input() if s[m-1] == 'R': cont += 1 cont += s.count('D') print(cont) ```
output
1
16,151
15
32,303
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,152
15
32,304
Tags: brute force, greedy, implementation Correct Solution: ``` t=int(input()) for q in range(0,t): n,m=map(int,input().split()) a=[] for i in range(0,n): b=input() b=list(b) a.append(b) count=0 for i in range(0,n-1): if a[i][m-1]=='R': count+=1 for i ...
output
1
16,152
15
32,305
Provide tags and a correct Python 3 solution for this coding contest problem. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, except (n,m), has a direction R (Right) or D (Down...
instruction
0
16,153
15
32,306
Tags: brute force, greedy, implementation Correct Solution: ``` t = int(input()) for q in range(t): n, m = map(int, input().split()) matr = [] for i in range(n): matr.append(input()) kol = 0 for j in range(m - 1): if matr[n - 1][j] != "R": kol += 1 for i in range(n - 1): if matr[i][m - 1] != "D": kol ...
output
1
16,153
15
32,307
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,154
15
32,308
Yes
output
1
16,154
15
32,309
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,155
15
32,310
Yes
output
1
16,155
15
32,311
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,156
15
32,312
Yes
output
1
16,156
15
32,313
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,157
15
32,314
Yes
output
1
16,157
15
32,315
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,158
15
32,316
No
output
1
16,158
15
32,317
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,159
15
32,318
No
output
1
16,159
15
32,319
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,160
15
32,320
No
output
1
16,160
15
32,321
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). Every cell, exc...
instruction
0
16,161
15
32,322
No
output
1
16,161
15
32,323
Provide tags and a correct Python 3 solution for this coding contest problem. You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid. In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ...
instruction
0
16,178
15
32,356
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search Correct Solution: ``` import sys input = sys.stdin.buffer.readline from itertools import permutations def prog(): for _ in range(int(input())): ans = 10**10 points = [] for i in range(4...
output
1
16,178
15
32,357
Provide tags and a correct Python 3 solution for this coding contest problem. You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid. In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ...
instruction
0
16,179
15
32,358
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search Correct Solution: ``` def read_int(): return int(input()) def read_ints(): return map(int, input().split(' ')) def solve(x, y): xcost = x[1] - x[0] + x[3] - x[2] ycost = y[1] - y[0] + y[3] - y[2...
output
1
16,179
15
32,359
Provide tags and a correct Python 3 solution for this coding contest problem. You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid. In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ...
instruction
0
16,180
15
32,360
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search Correct Solution: ``` def move(ps): for i in range(3): for j in range(i+1,4): if ps[j] < ps[i]: x = ps[i] ps[i] = ps[j] ps[j] = x ...
output
1
16,180
15
32,361
Provide tags and a correct Python 3 solution for this coding contest problem. You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid. In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ...
instruction
0
16,181
15
32,362
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search Correct Solution: ``` import sys;input=sys.stdin.readline from itertools import permutations def fx(a, b, c, d): return min(b, c) - max(a, d), max(b, c) - min(a, d), abs(b-c)+abs(a-d) T, = map(int, input().spl...
output
1
16,181
15
32,363
Provide tags and a correct Python 3 solution for this coding contest problem. You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid. In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ...
instruction
0
16,182
15
32,364
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search Correct Solution: ``` T = int(input());ans = [0]*T for t in range(T): X,Y = [0]*4,[0]*4;A = [0]*4 for i in range(4):X[i],Y[i] = map(int, input().split());A[i] = [X[i], Y[i]] X.sort(); Y.sort(); A.sort();cnt =...
output
1
16,182
15
32,365
Provide tags and a correct Python 3 solution for this coding contest problem. You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid. In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ...
instruction
0
16,183
15
32,366
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search Correct Solution: ``` import sys from array import array # noqa: F401 import typing as Tp # noqa: F401 def input(): return sys.stdin.buffer.readline().decode('utf-8') def main(): from itertools import...
output
1
16,183
15
32,367
Provide tags and a correct Python 3 solution for this coding contest problem. You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid. In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ...
instruction
0
16,184
15
32,368
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search Correct Solution: ``` import sys sys.setrecursionlimit(10**5) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.buffer.readline()) def MI(): return map(int, sys.stdin.buf...
output
1
16,184
15
32,369