DWITE Online Computer Programming Contest

Verifying Distributed Work

January 2010
Problem 2

Distributed Computing – the use of a large network of computers to perform work together – could be an interesting field of computer science. Supercomputers are assembled as such closely connected networks. Alternatively, one could potentially create a larger network, and for cheaper, by letting individual computers contribute over a bigger network, such as the Internet (some might have heard of SETI@home). Since individual nodes are someone else’s computer that runs untrusted code, the results are also not trusted, so some verification needs to take place that the work performed is legitimate.

The input file DATA2.txt will contain 5 sets of input, each beginning with a line containing an odd integer 1 ≤ N ≤ 7. This is followed by N lines of one integer each, 0 ≤ R ≤ 100, which are “results” for the same piece of work from N workers.

The output file OUT2.txt will contain 5 lines, each being a decision about the work performed. If the majority of the results agree (that is, they are the same), then it is taken as verified. If there is no major consensus, but one result has more matches than any other result, then it is taken as unverified, otherwise the result is unknown. Print just the decision.

Note: The majority (more than half) of 1 is 1, so a single result is always “verified”.

Sample Input:
3
42
42
42
3
42
42
41
5
42
42
50
51
52
3
42
41
40
1
42
Sample Output:
verified
verified
unverified
unknown
verified