Clicountingd2
SRM 696 · 2016-07-09 · by subscriber
Problem Statement
Constraints
- g will contain n elements.
- n will be between 1 and 20, inclusive.
- Each element in g will contain exactly n characters.
- Each character in g will be either '0', '1' or '?'.
- For each valid i and j, g[i][j] will be equal to g[j][i].
- For each valid i, g[i][i] will be '0'.
- Number of unknown edges (number of '?' characters divided by 2) will be between 0 and 20, inclusive.
Statement by TopCoder, Inc. — view the original on the archive.
{"01","10"}
Returns: 2
{"0?","?0"}
Returns: 3
Here the maximum clique size is either 2 (if the unknown edge is present) or 1 (if the edge is absent).
{"011","101","110"}
Returns: 3
This is a complete graph on 3 vertices. The size of the maximum clique is 3.
{"0?1","?01","110"}
Returns: 5
Hero is not sure about a single edge. If the edge is in the graph, we get the situation from Example 2. If the edge is not there, we get a graph in which the size of the maximum clique is 2. The answer is therefore 3+2 = 5.
{"0???","?0??","??0?","???0"}
Returns: 151
Submissions are judged against all 87 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Clicountingd2 with a public method int count(vector<string> g) · 87 test cases · 2 s / 256 MB per case