시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 | 512 MB | 48 | 25 | 24 | 52.174% |
You are playing a game where the battlefield consists of N cities and R bidirectional roads. Your goal is to start at some city C of your choice and visit all R roads exactly once ending this trip at C. If this is not possible you must add the minimum number of additional roads to the initial set of roads to make this trip feasible. Please note that there might be more than one road connecting the same pair of cities and that you are allowed to add roads between any pair of cities regardless of whether they already had roads connecting them or not as shown in the sample input/output.
The first line of input gives the number of test cases, T. T test cases follow. For each test case there will be:
For each test case, output one line containing "Case #x: ", where x is the number of the test case, followed by the minimum number of roads needed.
3 2 2 0 1 0 1 3 3 1 2 1 2 2 1 4 5 0 1 2 0 0 3 1 2 3 1
Case #1: 0 Case #2: 1 Case #3: 1
Contest > Google > Google's Coding Competitions > Code Jam Africa and Arabia 2011 > Online Competition B2번