problem_statement stringclasses 5
values | function_signature stringclasses 5
values | function_name stringclasses 5
values | testcase_input stringclasses 20
values | solution stringclasses 20
values |
|---|---|---|---|---|
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 5, [8, 3, 1, 5, 2] | assert fineTriplets(5, [8, 3, 1, 5, 2]) == 3 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 7, [300000, 100000, 499998, 499999, 200000, 400000, 500000] | assert fineTriplets(7, [300000, 100000, 499998, 499999, 200000, 400000, 500000]) == 5 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19] | assert fineTriplets(10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19]) == 10 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | assert fineTriplets(15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 49 |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 4, 998244353 | assert oddEvenGraph(4, 998244353) == [12, 9, 3, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 6, 924844033 | assert oddEvenGraph(6, 924844033) == [810, 2100, 3060, 3030, 2230, 1210, 450, 100, 10, 0, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 10, 433416647 | assert oddEvenGraph(10, 433416647) == [49218750, 419111280, 321937732, 107111441, 372416570, 351559278, 312484809, 334285827, 317777667, 211471846, 58741385, 422156135, 323887465, 54923551, 121645733, 94354149, 346849276, 72744827, 385773306, 163421544, 351691775, 59915863, 430096957, 166653801, 346330874, 185052506, 2... |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 12, 998244353 | assert oddEvenGraph(12, 998244353) == [982775781, 186825509, 296235737, 526954524, 599725645, 18921150, 805820124, 666981224, 908637017, 582955160, 706714698, 529742876, 182466306, 185063989, 971528481, 576034125, 621829834, 354664420, 38237633, 802399317, 1972388, 814086027, 101300526, 391052008, 849543652, 50317402, ... |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [10,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [4,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]]) == [4,1] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]]) == [4,2,1] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)]) == [2, 3, 1, 0, 5] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)] | assert simultaneousKagamimochi2(24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)]) == [0, 0, 0, 0, 2, 6... |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)]) == [2, 3, 1, 0, 2] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)]) == [2, 3, 1, 0, 2] |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 4, 3, 1, 2, 2, 3 | assert snukesKyotoTrip(4, 3, 1, 2, 2, 3) == 192 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 10, 12, 4, 6, 8, 11 | assert snukesKyotoTrip(10, 12, 4, 6, 8, 11) == 4519189 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 9 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 9) == 675935675 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 20 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 20) == 246875194 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 5, [8, 3, 1, 5, 2] | assert fineTriplets(5, [8, 3, 1, 5, 2]) == 3 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 7, [300000, 100000, 499998, 499999, 200000, 400000, 500000] | assert fineTriplets(7, [300000, 100000, 499998, 499999, 200000, 400000, 500000]) == 5 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19] | assert fineTriplets(10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19]) == 10 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | assert fineTriplets(15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 49 |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 4, 998244353 | assert oddEvenGraph(4, 998244353) == [12, 9, 3, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 6, 924844033 | assert oddEvenGraph(6, 924844033) == [810, 2100, 3060, 3030, 2230, 1210, 450, 100, 10, 0, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 10, 433416647 | assert oddEvenGraph(10, 433416647) == [49218750, 419111280, 321937732, 107111441, 372416570, 351559278, 312484809, 334285827, 317777667, 211471846, 58741385, 422156135, 323887465, 54923551, 121645733, 94354149, 346849276, 72744827, 385773306, 163421544, 351691775, 59915863, 430096957, 166653801, 346330874, 185052506, 2... |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 12, 998244353 | assert oddEvenGraph(12, 998244353) == [982775781, 186825509, 296235737, 526954524, 599725645, 18921150, 805820124, 666981224, 908637017, 582955160, 706714698, 529742876, 182466306, 185063989, 971528481, 576034125, 621829834, 354664420, 38237633, 802399317, 1972388, 814086027, 101300526, 391052008, 849543652, 50317402, ... |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [10,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [4,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]]) == [4,1] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]]) == [4,2,1] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)]) == [2, 3, 1, 0, 5] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)] | assert simultaneousKagamimochi2(24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)]) == [0, 0, 0, 0, 2, 6... |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)]) == [2, 3, 1, 0, 2] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)]) == [2, 3, 1, 0, 2] |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 4, 3, 1, 2, 2, 3 | assert snukesKyotoTrip(4, 3, 1, 2, 2, 3) == 192 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 10, 12, 4, 6, 8, 11 | assert snukesKyotoTrip(10, 12, 4, 6, 8, 11) == 4519189 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 9 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 9) == 675935675 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 20 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 20) == 246875194 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 5, [8, 3, 1, 5, 2] | assert fineTriplets(5, [8, 3, 1, 5, 2]) == 3 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 7, [300000, 100000, 499998, 499999, 200000, 400000, 500000] | assert fineTriplets(7, [300000, 100000, 499998, 499999, 200000, 400000, 500000]) == 5 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19] | assert fineTriplets(10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19]) == 10 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | assert fineTriplets(15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 49 |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 4, 998244353 | assert oddEvenGraph(4, 998244353) == [12, 9, 3, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 6, 924844033 | assert oddEvenGraph(6, 924844033) == [810, 2100, 3060, 3030, 2230, 1210, 450, 100, 10, 0, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 10, 433416647 | assert oddEvenGraph(10, 433416647) == [49218750, 419111280, 321937732, 107111441, 372416570, 351559278, 312484809, 334285827, 317777667, 211471846, 58741385, 422156135, 323887465, 54923551, 121645733, 94354149, 346849276, 72744827, 385773306, 163421544, 351691775, 59915863, 430096957, 166653801, 346330874, 185052506, 2... |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 12, 998244353 | assert oddEvenGraph(12, 998244353) == [982775781, 186825509, 296235737, 526954524, 599725645, 18921150, 805820124, 666981224, 908637017, 582955160, 706714698, 529742876, 182466306, 185063989, 971528481, 576034125, 621829834, 354664420, 38237633, 802399317, 1972388, 814086027, 101300526, 391052008, 849543652, 50317402, ... |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [10,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [4,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]]) == [4,1] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]]) == [4,2,1] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)]) == [2, 3, 1, 0, 5] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)] | assert simultaneousKagamimochi2(24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)]) == [0, 0, 0, 0, 2, 6... |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)]) == [2, 3, 1, 0, 2] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)]) == [2, 3, 1, 0, 2] |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 4, 3, 1, 2, 2, 3 | assert snukesKyotoTrip(4, 3, 1, 2, 2, 3) == 192 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 10, 12, 4, 6, 8, 11 | assert snukesKyotoTrip(10, 12, 4, 6, 8, 11) == 4519189 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 9 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 9) == 675935675 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 20 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 20) == 246875194 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 5, [8, 3, 1, 5, 2] | assert fineTriplets(5, [8, 3, 1, 5, 2]) == 3 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 7, [300000, 100000, 499998, 499999, 200000, 400000, 500000] | assert fineTriplets(7, [300000, 100000, 499998, 499999, 200000, 400000, 500000]) == 5 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19] | assert fineTriplets(10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19]) == 10 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | assert fineTriplets(15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 49 |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 4, 998244353 | assert oddEvenGraph(4, 998244353) == [12, 9, 3, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 6, 924844033 | assert oddEvenGraph(6, 924844033) == [810, 2100, 3060, 3030, 2230, 1210, 450, 100, 10, 0, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 10, 433416647 | assert oddEvenGraph(10, 433416647) == [49218750, 419111280, 321937732, 107111441, 372416570, 351559278, 312484809, 334285827, 317777667, 211471846, 58741385, 422156135, 323887465, 54923551, 121645733, 94354149, 346849276, 72744827, 385773306, 163421544, 351691775, 59915863, 430096957, 166653801, 346330874, 185052506, 2... |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 12, 998244353 | assert oddEvenGraph(12, 998244353) == [982775781, 186825509, 296235737, 526954524, 599725645, 18921150, 805820124, 666981224, 908637017, 582955160, 706714698, 529742876, 182466306, 185063989, 971528481, 576034125, 621829834, 354664420, 38237633, 802399317, 1972388, 814086027, 101300526, 391052008, 849543652, 50317402, ... |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [10,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [4,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]]) == [4,1] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]]) == [4,2,1] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)]) == [2, 3, 1, 0, 5] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)] | assert simultaneousKagamimochi2(24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)]) == [0, 0, 0, 0, 2, 6... |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)]) == [2, 3, 1, 0, 2] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)]) == [2, 3, 1, 0, 2] |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 4, 3, 1, 2, 2, 3 | assert snukesKyotoTrip(4, 3, 1, 2, 2, 3) == 192 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 10, 12, 4, 6, 8, 11 | assert snukesKyotoTrip(10, 12, 4, 6, 8, 11) == 4519189 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 9 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 9) == 675935675 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 20 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 20) == 246875194 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 5, [8, 3, 1, 5, 2] | assert fineTriplets(5, [8, 3, 1, 5, 2]) == 3 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 7, [300000, 100000, 499998, 499999, 200000, 400000, 500000] | assert fineTriplets(7, [300000, 100000, 499998, 499999, 200000, 400000, 500000]) == 5 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19] | assert fineTriplets(10, [13, 1, 16, 15, 12, 4, 7, 10, 2, 19]) == 10 |
For integers A, B, C (A < B < C), if they satisfy B - A = C - B, then (A, B, C) is called a fine triplet.You are given a set of N distinct positive integers S = {S1, S2, . . ., SN}. Find the number of fine triplets (A, B, C) with A, B, C ∈ S.Constraints: All input values are integers. 1 <= N <= 10^6. 1 <= Si <= 10^6. ... | def fineTriplets(num: int, integers: List[str]) -> int: pass | fineTriplets | 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | assert fineTriplets(15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 49 |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 4, 998244353 | assert oddEvenGraph(4, 998244353) == [12, 9, 3, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 6, 924844033 | assert oddEvenGraph(6, 924844033) == [810, 2100, 3060, 3030, 2230, 1210, 450, 100, 10, 0, 0] |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 10, 433416647 | assert oddEvenGraph(10, 433416647) == [49218750, 419111280, 321937732, 107111441, 372416570, 351559278, 312484809, 334285827, 317777667, 211471846, 58741385, 422156135, 323887465, 54923551, 121645733, 94354149, 346849276, 72744827, 385773306, 163421544, 351691775, 59915863, 430096957, 166653801, 346330874, 185052506, 2... |
You are given a positive even integer N and a prime number P.For M=N−1,…, N(N−1)/2, solve the following problem.How many undirected connected simple graphs with N vertices labeled from 1 to N and M edges satisfy this: the number of vertices whose shortest distance from vertex 1 is even is equal to the number of vertice... | def oddEvenGraph(positive_even_number: int, prime_number: int) -> List[int]: pass | oddEvenGraph | 12, 998244353 | assert oddEvenGraph(12, 998244353) == [982775781, 186825509, 296235737, 526954524, 599725645, 18921150, 805820124, 666981224, 908637017, 582955160, 706714698, 529742876, 182466306, 185063989, 971528481, 576034125, 621829834, 354664420, 38237633, 802399317, 1972388, 814086027, 101300526, 391052008, 849543652, 50317402, ... |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[12, 10, 6], [1, 1, 3], [8, 6, 7]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [10,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]] | assert denseBuildings(3, 3, [[10, 10, 10], [10, 10, 10], [10, 10, 10]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4]]) == [4,2] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 2, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 5]]) == [4,1] |
There is a city divided into H×W blocks in the north-south-east-west directions, and there is exactly one building in each block.Specifically, in the block at the i-th row from the north (1≤i≤H) and the j-th column from the west (1≤j≤W) (hereafter referred to as block (i,j)), there is a building of Fi,j floors.Takahash... | def denseBuildings(H: int, W: int, F: List[List[int]], Q: int, ABYCDZ: List[List[int]]) -> List[int]: pass | denseBuildings | 3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]] | assert denseBuildings(3, 3, [[20, 20, 20], [20, 20, 20], [20, 20, 20]], 3, [[1, 1, 10, 3, 1, 6], [1, 1, 6, 1, 2, 4], [1, 1, 6, 1, 2, 5]]) == [4,2,1] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (1, 11)]) == [2, 3, 1, 0, 5] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)] | assert simultaneousKagamimochi2(24, [127, 148, 170, 174, 258, 311, 331, 414, 416, 436, 517, 523, 532, 587, 591, 638, 660, 748, 760, 776, 837, 857, 972, 984], 15, [(7, 11), (8, 9), (8, 13), (12, 15), (9, 23), (1, 17), (8, 12), (1, 5), (6, 17), (3, 7), (12, 19), (13, 18), (7, 22), (1, 12), (14, 15)]) == [0, 0, 0, 0, 2, 6... |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (2, 6)]) == [2, 3, 1, 0, 2] |
There are N mochi (rice cakes), arranged in ascending order of size. The size of the i-th mochi (1≤i≤N) is Ai.Given two mochi A and B, with sizes a and b respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi A on top of mochi B if and only if a is at most half of b.You are given Q integer pa... | def simultaneousKagamimochi2(N: int, A: List[int], Q: int, LR: List[tuple(int,int)]) -> List[int]: pass | simultaneousKagamimochi2 | 11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)] | assert simultaneousKagamimochi2(11, [1, 1, 2, 3, 4, 4, 7, 10, 11, 12, 20], 5, [(2, 5), (3, 8), (7, 11), (1, 2), (4, 8)]) == [2, 3, 1, 0, 2] |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 4, 3, 1, 2, 2, 3 | assert snukesKyotoTrip(4, 3, 1, 2, 2, 3) == 192 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 10, 12, 4, 6, 8, 11 | assert snukesKyotoTrip(10, 12, 4, 6, 8, 11) == 4519189 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 9 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 9) == 675935675 |
You are given integers W,H,L,R,D,U.A town of Kyoto is on the two-dimensional plane.In the town, there is exactly one block at each lattice point(x,y) that satisfies all of the following conditions. There are no blocks at any other points.0≤x≤W0≤y≤Hx<L or R<x or y<D or U<ySnuke traveled through the town as follows.First... | def snukesKyotoTrip(W : int, H : int, L : int, R : int, D : int, U: int,) -> int: pass | snukesKyotoTrip | 192, 25, 0, 2, 0, 20 | assert snukesKyotoTrip(192, 25, 0, 2, 0, 20) == 246875194 |
README.md exists but content is empty.
- Downloads last month
- 7