Updated description of 2-coloring contract

Fixed a couple of incorrect statements in the 2-coloring contract
description, as well as rephrasing some things for clarity.
This commit is contained in:
Undeemiss 2022-04-21 10:32:57 -05:00
parent b7e319f360
commit f482e0c4a9

@ -1312,22 +1312,24 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
numTries: 5, numTries: 5,
desc: (data: [number, [number, number][]]): string => { desc: (data: [number, [number, number][]]): string => {
return [ return [
`You are given the following tuple, representing a simple, undirected graph:\n`, `You are given the following data, representing a graph:\n`,
`${JSON.stringify(data)}\n`, `${JSON.stringify(data)}\n`,
`The first element of the tuple represents the number of vertices in the graph.`, `Note that "graph", as used here, refers to the field of graph theory, and has`,
`Each vertex is a unique number in the range [0,${data[0]}].`, `no relation to statistics or plotting functions.`,
`The next element of the tuple represents the edge set of the graph.`, `The first element of the data represents the number of vertices in the graph.`,
`Each vertex is a unique number between 0 and ${data[0]-1}.`,
`The next element of the data represents the edges of the graph.`,
`Two vertices u,v in a graph are said to be adjacent if there exists an edge [u,v].`, `Two vertices u,v in a graph are said to be adjacent if there exists an edge [u,v].`,
`Note that the graph is undirected, meaning an edge [u,v] is the same as an edge [v,u].`, `Note that an edge [u,v] is the same as an edge [v,u], as order does not matter.`,
`You must construct a 2-coloring of the graph, meaning that you have to assign each`, `You must construct a 2-coloring of the graph, meaning that you have to assign each`,
`vertex in the graph a "color", either 0 or 1, such that no two adjacent vertices have`, `vertex in the graph a "color", either 0 or 1, such that no two adjacent vertices have`,
`the same color. Submit your answer in the form of an array, where element i`, `the same color. Submit your answer in the form of an array, where element i`,
`represents the color of vertex i. If it is impossible to construct a 2-coloring of`, `represents the color of vertex i. If it is impossible to construct a 2-coloring of`,
`the given graph, instead submit an empty array.\n\n`, `the given graph, instead submit an empty array.\n\n`,
`Examples:\n\n`, `Examples:\n\n`,
`Input: [4, [[1, 3], [1, 4], [2, 3], [2, 4]]]\n`, `Input: [4, [[0, 2], [0, 3], [1, 2], [1, 3]]]\n`,
`Output: [0, 0, 1, 1]\n\n`, `Output: [0, 0, 1, 1]\n\n`,
`Input: [3, [[1, 2], [1, 3], [2, 3]]]\n`, `Input: [3, [[0, 1], [0, 2], [1, 2]]]\n`,
`Output: []`, `Output: []`,
].join(" "); ].join(" ");
}, },