Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Haybale Guessing
Description The cows, who always have an inferiority complex about their intelligence, have a new guessing game to sharpen their brains. A designated 'Hay Cow' hides behind the barn and creates The other cows then ask the Hay Cow a series of What is the smallest number of bales of any stack in the range of stack numbers The Hay Cow answers each of these queries with a single integer Help the other cows determine if the answers given by the Hay Cow are self-consistent or if certain answers contradict others. Input * Line 1: Two space-separated integers: AOutput * Line 1: Print the single integer 0 if there are no inconsistencies among the replies (i.e., if there exists a valid realization of the hay stacks that agrees with all Q queries). Otherwise, print the index from 1..Q of the earliest query whose answer is inconsistent with the answers to the queries before it. Sample Input 20 4 1 10 7 5 19 7 3 12 8 11 15 12 Sample Output 3 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator